tehkillerbee / mopidy-tidal

Tidal Backend plugin for Mopidy
Apache License 2.0
93 stars 28 forks source link

Unauthorized for lossless playback #55

Closed abaj8494 closed 2 years ago

abaj8494 commented 2 years ago

I am unable to play any tracks through Tidal. Last month when I was on the Tidal HiFi Plus subscription I was only able to play master quality tracks (even though my mopidy config was set to LOSSLESS), but this month since my subscription only allows up to lossless, I am unable to hear even those master tracks.

Here is the output from journalctl

Mar 08 11:09:12 alarmpi mopidy[18375]: ERROR    2022-03-08 11:09:12,664 [18375:Core-12 (_actor_loop)] mopidy.core.playback
Mar 08 11:09:12 alarmpi mopidy[18375]:   TidalBackend backend caused an exception.
Mar 08 11:09:12 alarmpi mopidy[18375]: Traceback (most recent call last):
Mar 08 11:09:12 alarmpi mopidy[18375]:   File "/usr/lib/python3.10/site-packages/mopidy/core/playback.py", line 350, in _change
Mar 08 11:09:12 alarmpi mopidy[18375]:     if not backend.playback.change_track(pending_tl_track.track).get():
Mar 08 11:09:12 alarmpi mopidy[18375]:   File "/usr/lib/python3.10/site-packages/pykka/_threading.py", line 55, in get
Mar 08 11:09:12 alarmpi mopidy[18375]:     raise exc_value
Mar 08 11:09:12 alarmpi mopidy[18375]:   File "/usr/lib/python3.10/site-packages/pykka/_actor.py", line 186, in _actor_loop
Mar 08 11:09:12 alarmpi mopidy[18375]:     response = self._handle_receive(envelope.message)
Mar 08 11:09:12 alarmpi mopidy[18375]:   File "/usr/lib/python3.10/site-packages/pykka/_actor.py", line 286, in _handle_receive
Mar 08 11:09:12 alarmpi mopidy[18375]:     return callee(*message.args, **message.kwargs)
Mar 08 11:09:12 alarmpi mopidy[18375]:   File "/usr/lib/python3.10/site-packages/mopidy/backend.py", line 313, in change_track
Mar 08 11:09:12 alarmpi mopidy[18375]:     uri = self.translate_uri(track.uri)
Mar 08 11:09:12 alarmpi mopidy[18375]:   File "/usr/lib/python3.10/site-packages/Mopidy_Tidal-0.2.7-py3.10.egg/mopidy_tidal/playback.py", line 16, in translate_uri
Mar 08 11:09:12 alarmpi mopidy[18375]:     newurl = self.backend._session.get_media_url(track_id)
Mar 08 11:09:12 alarmpi mopidy[18375]:   File "/usr/lib/python3.10/site-packages/tidalapi-0.6.9-py3.10.egg/tidalapi/__init__.py", line 466, in get_media_url
Mar 08 11:09:12 alarmpi mopidy[18375]:     r = self.request('GET', 'tracks/%s/streamUrl' % track_id, params)
Mar 08 11:09:12 alarmpi mopidy[18375]:   File "/usr/lib/python3.10/site-packages/tidalapi-0.6.9-py3.10.egg/tidalapi/__init__.py", line 335, in request
Mar 08 11:09:12 alarmpi mopidy[18375]:     request.raise_for_status()
Mar 08 11:09:12 alarmpi mopidy[18375]:   File "/usr/lib/python3.10/site-packages/requests/models.py", line 943, in raise_for_status
Mar 08 11:09:12 alarmpi mopidy[18375]:     raise HTTPError(http_error_msg, response=self)
Mar 08 11:09:12 alarmpi mopidy[18375]: requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://api.tidalhifi.com/v1/tracks/134858531/streamUrl?sessionId=76bdd793-4259-4e27-b281-9c48f94bd523&countryCode=AU&limit=999&soundQuality=LOSSLESS

To reiterate, I am on the HiFi subscription, and I have authenticated Tidal.

tehkillerbee commented 2 years ago

Lossless playback works well for me on the latest tidalapi and mopidy-tidal.

However, it looks like you are still using tidalapi 0.6.9. You should update to the latest one and see if it solves the issue

51

abaj8494 commented 2 years ago

Lossless playback works well for me on the latest tidalapi and mopidy-tidal.

However, it looks like you are still using tidalapi 0.6.9. You should update to the latest one and see if it solves the issue #51

Thanks, I tried this and both master and non-master quality music stopped playing. Reverting back to TidalApi 0.6.9 worked for me. (I remembered to remove the oauth file and relink. no luck)

tehkillerbee commented 2 years ago

@br1ttle EDIT: So if I understand you correctly, it used to work on tidalapi 0.6.9 but does not on the latest tidalapi?

I have not tested master/non master playback on latest tidalapi as I do not have a subscription (Mine only goes to HiFi).

Does it work if you switch to HIFI?

If it works with HIFI, then I suggest creating an issue with tidalapi.

tehkillerbee commented 2 years ago

Closing this issue, as there has been no updates.