StreamMusic
StreamMusic copied to clipboard
连接Airsonic-advance时ID处理错误导致内容错乱
Describe the bug (BUG 描述) 如果继续使用search2,那么音流对于文件夹的ArtistID,还有歌曲和专辑的artistID处理错误。具体来讲,文件夹的ArtistID被直接当成歌手ID了,实际上这是文件夹的ID,要用/getMusicDirectory进一步处理才行。歌曲的artistID实际上是单曲的歌手,专辑的歌手要先/getAlbum再获取。
还有一种做法是换用search3,这样是基于ID3信息返回搜索结果的,可以解决音流的问题。
To Reproduce (复现步骤) Steps to reproduce the behavior:
Expected behavior (期望行为) 正确显示内容
Screenshots (截图)
Platform and Device Info (操作系统及设备信息)
- OS: macOS
- Browser [e.g. chrome, safari]
- Version 1.2.9
Music Server Type (音乐服务器类型) e.g. airsonic-advance
Additional context (额外信息) 举例说明: 文件夹[Mad tea party]的ID是458,artist "tinvan"的ID是458, 在搜索Mad tea party时,显示的歌手(实际上是个文件夹的形式)"[Mad tea party]"里面的实际内容是歌手tinvan的内容
进行search2 API调用:
http://100.82.248.136:8088/rest/search2?query=Mad%20tea%20party?u=&t=&s=&v=1.12.0&c=myapp&
<artist id="458" name="[Mad Tea Party]"/>
然后getMusicDirectory
http://[100.82.248.136:8088/rest/getMusicDirectory?id=458](http://100.82.248.136:8088/rest/getMusicDirectory?id=458)
<directory id="458" name="[Mad Tea Party]" playCount="0">
<child id="154717" parent="458" isDir="true" title="2010.03.14 [MTPD-0001] HEADSHOT [例大祭7]" album="HEADSHOT" artist="Mad Tea Party" year="2010" coverArt="154717" playCount="0" created="2024-05-15T19:44:27.939Z"/>
<child id="154711" parent="458" isDir="true" title="2010.08.14 [MTPD-0002] GODMOTHER [C78]" album="GODMOTHER" artist="Mad Tea Party" year="2010" genre="Game" coverArt="154711" playCount="0" created="2024-05-15T19:44:21.859Z"/>
</directory>
然后继续进入子文件夹:
http://[100.82.248.136:8088/rest/getMusicDirectory?id=154717](http://100.82.248.136:8088/rest/getMusicDirectory?id=154717)
<directory id="154717" parent="458" name="2010.03.14 [MTPD-0001] HEADSHOT [例大祭7]" playCount="0">
<child id="154722" parent="154717" isDir="false" title="妖しの疾風、罷り通る" album="HEADSHOT" artist="椎名治美" track="1" year="2010" coverArt="154717" size="42160771" contentType="audio/flac" suffix="flac" duration="301" bitRate="1120" path="[Mad Tea Party]/2010.03.14 [MTPD-0001] HEADSHOT [例大祭7]/Mad Tea Party - HEADSHOT.flac" isVideo="false" playCount="0" created="2022-01-16T08:53:14.000Z" albumId="14975" artistId="3375" type="music"/>
<child id="154723" parent="154717" isDir="false" title="不倶戴天、押し通して候" album="HEADSHOT" artist="椎名治美" track="2" year="2010" coverArt="154717" size="41040218" contentType="audio/flac" suffix="flac" duration="293" bitRate="1120" path="[Mad Tea Party]/2010.03.14 [MTPD-0001] HEADSHOT [例大祭7]/Mad Tea Party - HEADSHOT.flac" isVideo="false" playCount="0" created="2022-01-16T08:53:14.000Z" albumId="14975" artistId="3375" type="music"/>
<child id="154724" parent="154717" isDir="false" title="BLOODY CHRONOS" album="HEADSHOT" artist="椎名治美" track="3" year="2010" coverArt="154717" size="41740563" contentType="audio/flac" suffix="flac" duration="298" bitRate="1120" path="[Mad Tea Party]/2010.03.14 [MTPD-0001] HEADSHOT [例大祭7]/Mad Tea Party - HEADSHOT.flac" isVideo="false" playCount="0" created="2022-01-16T08:53:14.000Z" albumId="14975" artistId="3375" type="music"/>
<child id="154725" parent="154717" isDir="false" title="SP@RK OF LUV" album="HEADSHOT" artist="椎名治美" track="4" year="2010" coverArt="154717" size="30535043" contentType="audio/flac" suffix="flac" duration="218" bitRate="1120" path="[Mad Tea Party]/2010.03.14 [MTPD-0001] HEADSHOT [例大祭7]/Mad Tea Party - HEADSHOT.flac" isVideo="false" playCount="0" created="2022-01-16T08:53:14.000Z" albumId="14975" artistId="3375" type="music"/>
<child id="154726" parent="154717" isDir="false" title="Groovy on the Doll~少女ハ踊ル~" album="HEADSHOT" artist="椎名治美" track="5" year="2010" coverArt="154717" size="34597044" contentType="audio/flac" suffix="flac" duration="247" bitRate="1120" path="[Mad Tea Party]/2010.03.14 [MTPD-0001] HEADSHOT [例大祭7]/Mad Tea Party - HEADSHOT.flac" isVideo="false" playCount="0" created="2022-01-16T08:53:14.000Z" albumId="14975" artistId="3375" type="music"/>
<child id="154727" parent="154717" isDir="false" title="蓬莱山の女" album="HEADSHOT" artist="椎名治美" track="6" year="2010" coverArt="154717" size="40059735" contentType="audio/flac" suffix="flac" duration="286" bitRate="1120" path="[Mad Tea Party]/2010.03.14 [MTPD-0001] HEADSHOT [例大祭7]/Mad Tea Party - HEADSHOT.flac" isVideo="false" playCount="0" created="2022-01-16T08:53:14.000Z" albumId="14975" artistId="3375" type="music"/>
<child id="154728" parent="154717" isDir="false" title="はてなくひろいそのさきへ" album="HEADSHOT" artist="椎名治美" track="7" year="2010" coverArt="154717" size="39079252" contentType="audio/flac" suffix="flac" duration="279" bitRate="1120" path="[Mad Tea Party]/2010.03.14 [MTPD-0001] HEADSHOT [例大祭7]/Mad Tea Party - HEADSHOT.flac" isVideo="false" playCount="0" created="2022-01-16T08:53:14.000Z" albumId="14975" artistId="3375" type="music"/>
<child id="154729" parent="154717" isDir="false" title="月の輝る夜に" album="HEADSHOT" artist="椎名治美" track="8" year="2010" coverArt="154717" size="41570607" contentType="audio/flac" suffix="flac" duration="297" bitRate="1120" path="[Mad Tea Party]/2010.03.14 [MTPD-0001] HEADSHOT [例大祭7]/Mad Tea Party - HEADSHOT.flac" isVideo="false" playCount="0" created="2022-01-16T08:53:14.000Z" albumId="14975" artistId="3375" type="music"/>
</directory>
(这里返回的歌曲artistID是专辑的,因为我的服务端自己魔改过,实际上应该是歌曲的artistID)
然后用文件的albumID就能去到真正的专辑,然后获取相关数据(比如专辑的artistID)。
简单做法是换成search3,这样获取的就是正确信息了(截图是把服务器端的search2函数用search3的代码替换掉)
我明白了。返回的是文件夹。参考https://github.com/airsonic/airsonic/issues/534,要用/getMusicDirectory 传入那个所谓的artistID((实际上是文件夹ID),然后进到随便一个专辑文件夹。这里每一个文件的artistID是这首歌的artistID,如果用文件的albumID就能去到真正的专辑,然后获取相关数据(比如专辑的artistID)。其他的bug也和这个逻辑有关,比如#308
如果要获取专辑艺术家,必须要从专辑信息里面获取吗?
如果能省略获取文件夹的步骤,用search3也行(不过得支持空字符串搜索全部歌曲才行,之后我试试看),之前是因为抓包syf,看它用的这个接口
如果要获取专辑艺术家,必须要从专辑信息里面获取吗?
如果能省略获取文件夹的步骤,用search3也行(不过得支持空字符串搜索全部歌曲才行,之后我试试看),之前是因为抓包syf,看它用的这个接口
应该是search3是可以的,我直接把服务器端的search2代码换成search3,音流就能够正常搜索了,别的地方也没有出问题
从文档来看,多数情况下应该使用带数字后缀的(对于search是3,其他是2),因为这样是符合绝大多数其他服务端的做法的。不带后缀的(/search2)则是基于文件夹结构的,结构为:artist/album/song,所有的ID都是dictionary ID
The API is divided between functions with no suffix, and functions that have a "2" suffix (or "3" in the case of Search3). Generally, things with "2" on the end are organized by file tags rather than folder structure. This is how you'd expect most music players to work and is recommended. The variants without a suffix organize the library by directory structure; artists are a directory, albums are children of that directory, songs (subsonic.Child) are children of albums. This has some disadvantages: possibly duplicating items with identical directory names, treating songs and albums in much the same fashion, and being more difficult to query consistently.
https://pkg.go.dev/github.com/delucks/go-subsonic
测试版本 https://devmusic.aqzscn.cn/docs/versions/latest 已经改成 search3 了,看下还有问题吗
测试版本 https://devmusic.aqzscn.cn/docs/versions/latest 已经改成 search3 了,看下还有问题吗
这个版本登陆都不行,一直在登陆中。。。转圈圈。不过除了这个 song artist也要改成album artist
此时substreamer 是可以登陆的
奇怪了,,没有改过登录逻辑的