Closed DelphDes closed 3 years ago
Ok, first, I can't repro this against the latest Subsonic, but I'm not surprised by that.
In [4]: c.getRandomSongs(size=2)
Out[4]:
{'status': 'ok',
'version': '1.16.1',
'randomSongs': {'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'},
{'id': '65591',
'parent': '65339',
'isDir': False,
'title': 'Wish',
'album': 'Slaughter in the Air',
'artist': 'Nine Inch Nails',
'genre': 'Industrial',
'coverArt': '65339',
'size': 3494681,
'contentType': 'audio/mpeg',
'suffix': 'mp3',
'duration': 218,
'bitRate': 128,
'path': 'Nine Inch Nails/Slaughter In The Air (Disc 1)/Nine Inch Nails_Slaughter In The Air (Disc 1)_Wish.mp3',
'playCount': 0,
'created': '2007-12-06T08:57:22.000Z',
'albumId': '4986',
'artistId': '2181',
'type': 'music'}]}}
I know people have had trouble with Airsonic compatibility and a fair amount of time that's due to API version incompatibility. Have you tried manually setting the apiVersion
argument of the Connection
class to match the API version that your Airsonic install supports? That generally fixes the issue for others. What version of Airsonic are you running, btw?
Jay,
The airsonic version is 10.6.0.20200424173747 and I believe the API version is 1.15.0. I tried specifically naming the version number, but it didn't seem to make a difference either. I'm open to any other suggestions you might have. The only reason that I believe I am accessing the device at all is because when I use a known bad password, I get a 403 error returned in the stack log. The good password gets the stack trace log that I showed before. I have been able to successfully access the airsonic server using various android clients, so it's at least theoretically possible. I've tried just about every combo of urls, credentials, apiVersions and what not -- I don't get what's wrong.
From: Jay Deiman notifications@github.com Sent: Sunday, January 10, 2021 2:30 PM To: crustymonkey/py-sonic py-sonic@noreply.github.com Cc: DelphDes delpheus@msn.com; Author author@noreply.github.com Subject: Re: [crustymonkey/py-sonic] Issues returning anything from Airsonic server (#27)
Ok, first, I can't repro this against the latest Subsonic, but I'm not surprised by that.
In [4]: c.getRandomSongs(size=2) Out[4]: {'status': 'ok', 'version': '1.16.1', 'randomSongs': {'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'}, {'id': '65591', 'parent': '65339', 'isDir': False, 'title': 'Wish', 'album': 'Slaughter in the Air', 'artist': 'Nine Inch Nails', 'genre': 'Industrial', 'coverArt': '65339', 'size': 3494681, 'contentType': 'audio/mpeg', 'suffix': 'mp3', 'duration': 218, 'bitRate': 128, 'path': 'Nine Inch Nails/Slaughter In The Air (Disc 1)/Nine Inch Nails_Slaughter In The Air (Disc 1)_Wish.mp3', 'playCount': 0, 'created': '2007-12-06T08:57:22.000Z', 'albumId': '4986', 'artistId': '2181', 'type': 'music'}]}}
I know people have had trouble with Airsonic compatibility and a fair amount of time that's due to API version incompatibility. Have you tried manually setting the apiVersion argument of the Connection class to match the API version that your Airsonic install supports? That generally fixes the issue for others. What version of Airsonic are you running, btw?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/crustymonkey/py-sonic/issues/27#issuecomment-757530350, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AP5EBSIOAFDHDR3ECMTDQMDSZH567ANCNFSM4V4UXYUQ.
Which version of python are you using?
On Sun, Jan 10, 2021, 12:32 DelphDes notifications@github.com wrote:
Jay,
The airsonic version is 10.6.0.20200424173747 and I believe the API version is 1.15.0. I tried specifically naming the version number, but it didn't seem to make a difference either. I'm open to any other suggestions you might have. The only reason that I believe I am accessing the device at all is because when I use a known bad password, I get a 403 error returned in the stack log. The good password gets the stack trace log that I showed before. I have been able to successfully access the airsonic server using various android clients, so it's at least theoretically possible. I've tried just about every combo of urls, credentials, apiVersions and what not -- I don't get what's wrong.
From: Jay Deiman notifications@github.com Sent: Sunday, January 10, 2021 2:30 PM To: crustymonkey/py-sonic py-sonic@noreply.github.com Cc: DelphDes delpheus@msn.com; Author author@noreply.github.com Subject: Re: [crustymonkey/py-sonic] Issues returning anything from Airsonic server (#27)
Ok, first, I can't repro this against the latest Subsonic, but I'm not surprised by that.
In [4]: c.getRandomSongs(size=2) Out[4]: {'status': 'ok', 'version': '1.16.1', 'randomSongs': {'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'}, {'id': '65591', 'parent': '65339', 'isDir': False, 'title': 'Wish', 'album': 'Slaughter in the Air', 'artist': 'Nine Inch Nails', 'genre': 'Industrial', 'coverArt': '65339', 'size': 3494681, 'contentType': 'audio/mpeg', 'suffix': 'mp3', 'duration': 218, 'bitRate': 128, 'path': 'Nine Inch Nails/Slaughter In The Air (Disc 1)/Nine Inch Nails_Slaughter In The Air (Disc 1)_Wish.mp3', 'playCount': 0, 'created': '2007-12-06T08:57:22.000Z', 'albumId': '4986', 'artistId': '2181', 'type': 'music'}]}}
I know people have had trouble with Airsonic compatibility and a fair amount of time that's due to API version incompatibility. Have you tried manually setting the apiVersion argument of the Connection class to match the API version that your Airsonic install supports? That generally fixes the issue for others. What version of Airsonic are you running, btw?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub< https://github.com/crustymonkey/py-sonic/issues/27#issuecomment-757530350>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/AP5EBSIOAFDHDR3ECMTDQMDSZH567ANCNFSM4V4UXYUQ
.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/crustymonkey/py-sonic/issues/27#issuecomment-757539369, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEAO4VOPAPT6RTEQ5BZI3TSZIFHDANCNFSM4V4UXYUQ .
Jay,
I'm using Python version 3.9.1
From: Jay Deiman notifications@github.com Sent: Sunday, January 10, 2021 9:34 PM To: crustymonkey/py-sonic py-sonic@noreply.github.com Cc: DelphDes delpheus@msn.com; Author author@noreply.github.com Subject: Re: [crustymonkey/py-sonic] Issues returning anything from Airsonic server (#27)
Which version of python are you using?
On Sun, Jan 10, 2021, 12:32 DelphDes notifications@github.com wrote:
Jay,
The airsonic version is 10.6.0.20200424173747 and I believe the API version is 1.15.0. I tried specifically naming the version number, but it didn't seem to make a difference either. I'm open to any other suggestions you might have. The only reason that I believe I am accessing the device at all is because when I use a known bad password, I get a 403 error returned in the stack log. The good password gets the stack trace log that I showed before. I have been able to successfully access the airsonic server using various android clients, so it's at least theoretically possible. I've tried just about every combo of urls, credentials, apiVersions and what not -- I don't get what's wrong.
From: Jay Deiman notifications@github.com Sent: Sunday, January 10, 2021 2:30 PM To: crustymonkey/py-sonic py-sonic@noreply.github.com Cc: DelphDes delpheus@msn.com; Author author@noreply.github.com Subject: Re: [crustymonkey/py-sonic] Issues returning anything from Airsonic server (#27)
Ok, first, I can't repro this against the latest Subsonic, but I'm not surprised by that.
In [4]: c.getRandomSongs(size=2) Out[4]: {'status': 'ok', 'version': '1.16.1', 'randomSongs': {'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'}, {'id': '65591', 'parent': '65339', 'isDir': False, 'title': 'Wish', 'album': 'Slaughter in the Air', 'artist': 'Nine Inch Nails', 'genre': 'Industrial', 'coverArt': '65339', 'size': 3494681, 'contentType': 'audio/mpeg', 'suffix': 'mp3', 'duration': 218, 'bitRate': 128, 'path': 'Nine Inch Nails/Slaughter In The Air (Disc 1)/Nine Inch Nails_Slaughter In The Air (Disc 1)_Wish.mp3', 'playCount': 0, 'created': '2007-12-06T08:57:22.000Z', 'albumId': '4986', 'artistId': '2181', 'type': 'music'}]}}
I know people have had trouble with Airsonic compatibility and a fair amount of time that's due to API version incompatibility. Have you tried manually setting the apiVersion argument of the Connection class to match the API version that your Airsonic install supports? That generally fixes the issue for others. What version of Airsonic are you running, btw?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub< https://github.com/crustymonkey/py-sonic/issues/27#issuecomment-757530350>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/AP5EBSIOAFDHDR3ECMTDQMDSZH567ANCNFSM4V4UXYUQ
.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/crustymonkey/py-sonic/issues/27#issuecomment-757539369, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEAO4VOPAPT6RTEQ5BZI3TSZIFHDANCNFSM4V4UXYUQ .
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/crustymonkey/py-sonic/issues/27#issuecomment-757594896, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AP5EBSLKUVX75VS4S2A2TDLSZJPTXANCNFSM4V4UXYUQ.
Ok, that eliminates that suspicion. If you're amenable to it, we can drastically speed up debugging if you setup a temporary account on your Airsonic server so I can connect and step through with a debugger. It would save me the time and effort of having to stand up Airsonic to test. If you're ok with that, you can send a user/pass to admin@splitstreams.com with the info.
Jay,
I interactively debugged with Spyder and I was getting req objects correctly built, which when I copied and pasted the url into Chrome, correct responses came back. I realized that when I was logged into Airsonic in another Chrome tab, the url's worked fine; if I wasn't logged in, I would get a bad username/password combination. Anyway, long story short is that I had to add the legacyAuth=True parameter to the connection. That finally got everything working correctly. I was kind of surprised that I had to do this as it was a vanilla out-of-the-box Airsonic install with the 1.15 API. This is the final connection string that I created which worked:
conn = libsonic.Connection(baseUrl='http://192.168.1.113', username='snip', password='snip', port=8080, serverPath='/airsonic/rest', apiVersion='1.15.0', legacyAuth=True)
Thought I would pass it along to you in case anyone else runs into the same problem. Might save them 2 or 3 hours of troubleshooting. Thanks for your quick response, time and cool library!
Regards,
Scott
From: Jay Deiman notifications@github.com Sent: Tuesday, January 12, 2021 2:52 PM To: crustymonkey/py-sonic py-sonic@noreply.github.com Cc: DelphDes delpheus@msn.com; Author author@noreply.github.com Subject: Re: [crustymonkey/py-sonic] Issues returning anything from Airsonic server (#27)
Ok, that eliminates that suspicion. If you're amenable to it, we can drastically speed up debugging if you setup a temporary account on your Airsonic server so I can connect and step through with a debugger. It would save me the time and effort of having to stand up Airsonic to test. If you're ok with that, you can send a user/pass to admin@splitstreams.commailto:admin@splitstreams.com with the info.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/crustymonkey/py-sonic/issues/27#issuecomment-758896439, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AP5EBSJWRB7NQDVSTWAZ2YDSZSR7LANCNFSM4V4UXYUQ.
Ahhh, yes, I vaguely remember legacyAuth
coming up with Airsonic in the past. This also reminds me that I should update the wiki with a bunch Airsonic specific info for others. Thanks for closing the loop on this :-)
I've run into the same issue, but setting legacyAuth=True
doesn't seem to have resolved it. Running on Python 3.8.6, attempting to connect to an Airsonic 10.6.2 server. Any ideas what might be causing this?
EDIT: Some debugging later and it seems to be an SSL issue. This line is throwing an exception, and if I log it, it says that the SSL handshake failed. Maybe there's an SSL misconfiguration on the Airsonic side? I'll look into it further.
EDIT 2: I've found the issue, and I've opened a PR that fixes it (#28).
Thanks for digging into this @Sorixelle. I've merged in your pull request and pushed a new version (0.7.8) with your changes.
It might be really beneficial for Sorixelle to set a breakpoint on say, the ping operation in the py-sonic code, make sure that he/she is logged into the Airsonic server through a browser and then paste the returned URL from the py-sonic call into the browser to see if the "view" pages can be accessed. Since the ping view is about the simplest out there, it's a good place to start. Along the way to get to my solution, I realized that I needed http and not https in the baseURL as well as the path to the view pages being "/airsonic/rest" and not just "airsonic". I also made sure that I ran logging in as the admin account in the py-sonic connection so that I knew I had full privileges on the Airsonic device. That was finally when I discovered that I needed the legacyAuth piece. Even little things like having the wrong API version stated can make a big difference. Go slow, don't assume anything and keep playing until pasted URLs in a browser work.
From: Jay Deiman notifications@github.com Sent: Sunday, January 24, 2021 12:30 PM To: crustymonkey/py-sonic py-sonic@noreply.github.com Cc: DelphDes delpheus@msn.com; Author author@noreply.github.com Subject: Re: [crustymonkey/py-sonic] Issues returning anything from Airsonic server (#27)
Thanks for digging into this @Sorixellehttps://github.com/Sorixelle. I've merged in your pull request and pushed a new version (0.7.8) with your changes.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/crustymonkey/py-sonic/issues/27#issuecomment-766399086, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AP5EBSMLT5ZXKOYMPRGWLBDS3RKLJANCNFSM4V4UXYUQ.
Nice job on the implementation, but I cannot get the sample code to execute. I copied it from your site and I believe that I am correctly connecting since when I debug, I see the API version number that's running on my Airsonic server (a fork of subsonic). The username, password and salting all seem to be working correctly. When I try to execute .getRandomSongs(size=2), I receive the following error messages:
Traceback (most recent call last):
File "C:\Users\james\Documents\SVSU Python Scripts\pysonic.py", line 8, in
songs = conn.getRandomSongs(size=2)
File "C:\Users\james\AppData\Local\Continuum\anaconda3\lib\site-packages\libsonic\connection.py", line 1374, in getRandomSongs res = self._doInfoReq(req)
File "C:\Users\james\AppData\Local\Continuum\anaconda3\lib\site-packages\libsonic\connection.py", line 2802, in _doInfoReq res = self._opener.open(req)
File "C:\Users\james\AppData\Local\Continuum\anaconda3\lib\urllib\request.py", line 525, in open response = self._open(req, data)
File "C:\Users\james\AppData\Local\Continuum\anaconda3\lib\urllib\request.py", line 543, in _open '_open', req)
File "C:\Users\james\AppData\Local\Continuum\anaconda3\lib\urllib\request.py", line 503, in _call_chain result = func(*args)
File "C:\Users\james\AppData\Local\Continuum\anaconda3\lib\site-packages\libsonic\connection.py", line 77, in https_open return self.do_open(HTTPSConnectionChain, req)
File "C:\Users\james\AppData\Local\Continuum\anaconda3\lib\urllib\request.py", line 1350, in do_open encode_chunked=req.has_header('Transfer-encoding'))
File "C:\Users\james\AppData\Local\Continuum\anaconda3\lib\http\client.py", line 1277, in request self._send_request(method, url, body, headers, encode_chunked)
File "C:\Users\james\AppData\Local\Continuum\anaconda3\lib\http\client.py", line 1323, in _send_request self.endheaders(body, encode_chunked=encode_chunked)
File "C:\Users\james\AppData\Local\Continuum\anaconda3\lib\http\client.py", line 1272, in endheaders self._send_output(message_body, encode_chunked=encode_chunked)
File "C:\Users\james\AppData\Local\Continuum\anaconda3\lib\http\client.py", line 1032, in _send_output self.send(msg)
File "C:\Users\james\AppData\Local\Continuum\anaconda3\lib\http\client.py", line 993, in send self.sock.sendall(data)
AttributeError: 'NoneType' object has no attribute 'sendall'
It looks like the HTTP library is bombing out in the send method. I traced through and I watched that the proper request string is being built up and that's where it stops. I have upgraded all of my Anaconda installation to the latest version of the various tools. I also tried using other requests, like .getUser, but the same thing happens. Any ideas? I'd really much rather use your library than starting to code a REST API from scratch. Thanks!