crustymonkey / py-sonic

A python library to wrap the Subsonic REST API
http://stuffivelearned.org/doku.php?id=programming:python:py-sonic
GNU General Public License v3.0
56 stars 26 forks source link

Compatibility with Airsonic #24

Closed xzys closed 4 years ago

xzys commented 5 years ago

I made this issue to identify what issues there are that are preventing this from being used with https://github.com/airsonic/airsonic.

I am using https://github.com/Prior99/mopidy-subidy, which uses py-sonic, and am running into errors along with the following log message:

WARNING  Connecting to subsonic failed when loading list of playlists.

I'll try to spend some time later this week to figure out what is going wrong.

crustymonkey commented 5 years ago

Do you have test code or anything I can use to repro this?

lrusak commented 4 years ago

It works for me with airsonic, however you have to specify the apiVersion which is 1.15.0

>>> conn = libsonic.Connection('<snip>', '<snip>', '<snip>', port=443, insecure=True, apiVersion='1.15.0')
>>> songs = conn.getRandomSongs(size=2)
>>> pprint(songs)
{'randomSongs': {'song': [{'album': 'Futurism',
                           'albumId': '467',
                           'artist': 'Muse',
                           'artistId': '187',
                           'bitRate': 192,
                           'contentType': 'audio/mpeg',
                           'coverArt': '7065',
                           'created': '2014-02-27T00:10:48.000Z',
                           'discNumber': 1,
                           'duration': 206,
                           'genre': 'Rock',
                           'id': '7155',
                           'isDir': False,
                           'isVideo': False,
                           'parent': '7065',
                           'path': 'Muse/Futurism/1-18 Who Knows Who_.mp3',
                           'playCount': 0,
                           'size': 4985701,
                           'suffix': 'mp3',
                           'title': 'Who Knows Who?',
                           'track': 18,
                           'type': 'music',
                           'year': 2010},
                          {'album': 'I Might Be Wrong',
                           'albumId': '431',
                           'artist': 'Radiohead',
                           'artistId': '175',
                           'bitRate': 192,
                           'contentType': 'audio/mpeg',
                           'coverArt': '6582',
                           'created': '2014-03-04T19:16:44.000Z',
                           'duration': 292,
                           'genre': 'Alternative',
                           'id': '6731',
                           'isDir': False,
                           'isVideo': False,
                           'parent': '6582',
                           'path': 'Radiohead/I Might Be Wrong/02 - I Might Be '
                                   'Wrong.mp3',
                           'playCount': 0,
                           'size': 7014400,
                           'suffix': 'mp3',
                           'title': 'I Might Be Wrong',
                           'track': 2,
                           'type': 'music',
                           'year': 2001}]},
 'status': 'ok',
 'version': '1.15.0'}
crustymonkey commented 4 years ago

As @lrusak noted above, you can simply specify the api version implemented on the server side, which is why the option exists.