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

getSong() returns list instead of dict #26

Open mihapiha opened 3 years ago

mihapiha commented 3 years ago

As in title getSong(id) returns list instead of just dictionary.

>>> s1 = conn.getSong(300000076)
>>> s1.get("song")
[{'id': 300000076, 'parent': 200000006, 'title': 'Marina', 'isDir': False, 'isVideo': False, 'type': 'music', 'albumId': 200000006, 'album': 'The Ultimate Collectio
n - CD1', 'artistId': 100000005, 'artist': 'Azra', 'coverArt': 200000006, 'duration': 183, 'bitRate': 320, 'track': 7, 'year': 2007, 'genre': 'Rock', 'size': 748435
6, 'discNumber': 1, 'suffix': 'mp3', 'contentType': 'audio/mpeg', 'path': 'Azra - The Ultimate Collection (2007)-MuSi/CD 1/07 - Azra - Marina.mp3'}]
>>>

In documentation it says only dict is returned.

crustymonkey commented 3 years ago

Apparently I missed this report. Sorry about that.

I just tested this against the latest Subsonic and from what I see, I get a single song back in the form of a dict:

In [5]: c.getSong(9285)                 
Out[5]: 
{'status': 'ok',
 'version': '1.16.1',
 'song': {'id': '9285',
  'parent': '9274',
  'isDir': False,
  'title': 'Mighty Love',
  'album': 'Affection',
  'artist': 'Lisa Stansfield',
  'track': 2,
  'genre': 'General R&B',
  'coverArt': '9274',
  'size': 7145759,
  'contentType': 'audio/mpeg',
  'suffix': 'mp3',
  'duration': 312,
  'bitRate': 182,
  'path': 'Lisa Stansfield/Affection/Lisa Stansfield - Affection - 02 - Mighty Love.mp3',
  'playCount': 0,
  'created': '2005-01-17T03:46:36.000Z',
  'albumId': '608',
  'artistId': '292',
  'type': 'music'}}

What version of Subsonic are you using? Or are you using Airsonic?