Prior99 / mopidy-subidy

Mopidy extension for playing music from Subsonic servers.
BSD 3-Clause "New" or "Revised" License
30 stars 10 forks source link

Not Working With Airsonic - "Connecting to subsonic failed when loading list of artists" #36

Open seniorm0ment opened 4 years ago

seniorm0ment commented 4 years ago

Currently using Airsonic (fork of Subsonic) and it shows it connects to the Airsonic server and reads the API version, but then when it starts to fetch stuff I get constant errors of: [154926:SubidyBackend-3] mopidy_subidy.subsonic_api Connecting to subsonic failed when loading list of artists

My Mopidy file is as follows:

[mpd]
hostname = 127.0.0.1

[subidy]
url=https://airsonic.xxx.xxx/index
api_version=1.15.0
username=x
password=x

In case the above isn't clear, I'm using Mopidy-Subidy plugin and the Mopidy-MPD plugin, I run Mopidy on my laptop, then open NCMPCPP for the player.

Genuinely hope it is possible to use Airsonic with this and it's an easy fix that can be resolved soon, I have used my Airsonic server with Ultrasonic (App), I believe they're similar APIs. If this is not possible, I'd highly appreciate guidance towards an alternative plugin for Mopidy that isn't deprecated (the only few I found were deprecated).

Also on a sidenote, dependencies for mopidy-subidy are flagged out of date on the AUR. But I installed via pip so that shouldn't be an issue. Just wanted to point that out.

lyarenei commented 3 years ago

I have the same problem. In my case, my instance is behind a caddy reverse proxy. When I try to connect using the public address using the library call, the connection fails:

>>> conn = libsonic.Connection('https://<address>, username='<username>', password='<password>', port=443, apiVersion='1.15.0', legacyAuth=True)
>>> conn.getRandomSongs(size=2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.8/site-packages/libsonic/connection.py", line 1374, in getRandomSongs
    res = self._doInfoReq(req)
  File "/usr/local/lib/python3.8/site-packages/libsonic/connection.py", line 2802, in _doInfoReq
    res = self._opener.open(req)
  File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 542, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python3.8/site-packages/libsonic/connection.py", line 77, in https_open
    return self.do_open(HTTPSConnectionChain, req)
  File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1350, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1255, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1301, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1250, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 1010, in _send_output
    self.send(msg)
  File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py", line 971, in send
    self.sock.sendall(data)
AttributeError: 'NoneType' object has no attribute 'sendall'

However, when I made an SSH tunnel to connect to the instance directly, I was successful:

>>> conn = libsonic.Connection('http://localhost', username='<username>', password='<password>', port=8888, apiVersion='1.15.0', legacyAuth=True)
>>> conn.getRandomSongs(size=2)
{'status': 'ok', 'version': '1.15.0', 'randomSongs': {'song': [{'id': '9333', 'parent': '9330', 'isDir': False, 'title': 'Shoot to Thrill', 'album': 'Back in Black', 'artist': 'AC/DC', 'track': 2, 'year': 2003, 'genre': 'Hard Rock', 'coverArt': '9330', 'size': 41667217, 'contentType': 'audio/flac', 'suffix': 'flac', 'transcodedContentType': 'audio/mpeg', 'transcodedSuffix': 'mp3', 'duration': 317, 'bitRate': 1047, 'path': 'AC_DC/Back in Black/02 - Shoot to Thrill.flac', 'isVideo': False, 'playCount': 0, 'discNumber': 1, 'created': '2020-07-20T10:01:57.500Z', 'albumId': '156', 'artistId': '71', 'type': 'music'}, {'id': '9746', 'parent': '9489', 'isDir': False, 'title': 'Memories That You Call (ODESZA & Golden Features VIP Remix)', 'album': 'A Moment Apart', 'artist': 'ODESZA feat. Monsoonsiren', 'track': 18, 'year': 2018, 'genre': 'Chillwave', 'coverArt': '9489', 'size': 32986126, 'contentType': 'audio/flac', 'suffix': 'flac', 'transcodedContentType': 'audio/mpeg', 'transcodedSuffix': 'mp3', 'duration': 220, 'bitRate': 894, 'path': 'ODESZA/A Moment Apart/18 - Memories That You Call (ODESZA & Golden Features VIP Remix).flac', 'isVideo': False, 'playCount': 0, 'discNumber': 1, 'created': '2020-07-20T16:07:32.035Z', 'albumId': '225', 'type': 'music'}]}}
>>>

This looks like caddy is interfering with the connection in some way, however, I don't have any interest to look into this further since I plan to move from Airsonic to Jellyfin anyway.

mihapiha commented 3 years ago

I had the same problem when connecting to Ampache, Subsonic API version 1.13.0. It connected correctly and displayed artists when I set legacy_auth=true in mopidy config section subidy. Didn't manage to play any songs though.

kaythomas0 commented 2 years ago

I also found that this had something to do with the reverse proxy. Since I'm running this on my local network, I just connected to my airsonic instance through it's private ip on my local network rather than through my public reverse proxy. Not really a solution unfortunately, but it works for me.

r3k2 commented 2 years ago

This is happening to me now with ncmpcpp and mopidy mopidy[64182]: Connecting to subsonic failed when loading list of playlists.

ebiscaia commented 1 year ago

I am with the same problem. In my case I use nginx reverse proxy.

I tried to open a port in my router and redirect to it and with no issues, which means somehow the reverse proxy and the server do not seem to work well together.

Edit: I just changed from http to https and it is working. I don't what the problem can be because my previous install used the same config file and everything was fine