tehkillerbee / mopidy-tidal

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

Selecting HI_RES (OAUTH) still plays HI_RES_LOSSLESS #168

Closed fmarzocca closed 6 months ago

fmarzocca commented 6 months ago

I have set HI_RES and OAUTH, as confirmed by the log:

Mar 29 17:40:29 pab mopidy[642]: INFO     [TidalBackend-3 (_actor_loop)] mopidy_tidal.backend Mopidy-Tidal version: v0.3.6
Mar 29 17:40:29 pab mopidy[642]: INFO     [TidalBackend-3 (_actor_loop)] mopidy_tidal.backend Python-Tidal version: v0.7.5
Mar 29 17:40:29 pab mopidy[642]: INFO     [TidalBackend-3 (_actor_loop)] mopidy_tidal.backend PKCE login web server port: 8989
Mar 29 17:40:29 pab mopidy[642]: INFO     [TidalBackend-3 (_actor_loop)] mopidy_tidal.backend Quality: HI_RES
Mar 29 17:40:29 pab mopidy[642]: INFO     [TidalBackend-3 (_actor_loop)] mopidy_tidal.backend Authentication: OAuth
Mar 29 17:40:29 pab mopidy[642]: WARNING  [TidalBackend-3 (_actor_loop)] mopidy_tidal.backend AUTO login implies lazy connection, setting lazy=Tru>
Mar 29 17:40:29 pab mopidy[642]: INFO     [TidalBackend-3 (_actor_loop)] mopidy_tidal.backend Login method: AUTO
Mar 29 17:40:29 pab mopidy[642]: INFO     [TidalBackend-3 (_actor_loop)] mopidy_tidal.backend Using default client id & client secret from python->

but it still plays HI_RES_LOSSLESS/FLAC for tracks that also have HI_RES/MQA available:

Mar 30 12:56:17 pab mopidy[642]: DEBUG    [mopidy-tidal-images-_0] mopidy_tidal.library Image URL for 'tidal:album:244731': 'https://resources.tidal.com/images/4f9e1be6/>
Mar 30 13:00:28 pab mopidy[642]: INFO     [TidalBackend-3 (_actor_loop)] mopidy_tidal.playback TIDAL uri: tidal:track:15796:77661290:77661291
Mar 30 13:00:29 pab mopidy[642]: INFO     [TidalBackend-3 (_actor_loop)] mopidy_tidal.playback MimeType:application/dash+xml
Mar 30 13:00:29 pab mopidy[642]: INFO     [TidalBackend-3 (_actor_loop)] mopidy_tidal.playback Starting playback of track:77661291, (quality:HI_RES_LOSSLESS, codec:flac,>

The track uri tidal:track:15796:77661290:77661291 has MQA capability, but it plays HI_RES_LOSSLESS/FLAC:

./tidalQuality.py "tidal:track:15796:77661290:77661291"
Playing: {"quality": "HI_RES_LOSSLESS", "codec": "flac"}
Track metadata: ['LOSSLESS', 'HIRES_LOSSLESS', 'MQA']

Shouldn't TidalPlaybackProvider take care of this?

tehkillerbee commented 6 months ago

Hires lossless playback should not be possible if oauth is used. I believe this is related to the bug I talked about in the other issue. You can check what is_pkce is set to in your session json file.

Try to delete your oauth session and sign in again and see if it helps.

fmarzocca commented 6 months ago

Hires lossless playback should not be possible if oauth is used.

I know. That's why I opened the ticket. This is in tidal-oauth.json: "is_pkce": {"data": true}

Try to delete your oauth session and sign in again and see if it helps.

Again?.... :-( Can't I just edit the json and put false? Why it has true? I have regenerated it a week ago.

fmarzocca commented 6 months ago

I have deleted oauth session and signed in again. Now the track is correctly reported as HI-RES/MQA, but in the session json there is always: is_pkce": {"data": true}

tehkillerbee commented 6 months ago

Yep, I believe I have found the cause of this bug. A fix will be added in the next release of mopidy-tidal / tidalapi.

fmarzocca commented 6 months ago

@tehkillerbee Johannes, I am experiencing this problem every day. As I don't currently have the budget to buy a new DAC, but my converter works great with MQA, I would like to continue using my mopidy's playlists.

If you don't have planned to publish the new release soon, can I have the patch to apply locally?

tehkillerbee commented 6 months ago

This is already fixed on the latest master.

You could always install that until the next release of tidalapi/ mopidy-tidal is ready.

Otherwise I'll try to get the next release ready ASAP

fmarzocca commented 6 months ago

Ah, ok. Does it extends to tidalapi too?

tehkillerbee commented 6 months ago

The issue is caused by tidalapi but probably the best idea to update both mopidy-tidal and tidalapi.

fmarzocca commented 6 months ago

Otherwise I'll try to get the next release ready ASAP

Thanks!

fmarzocca commented 6 months ago

I am afraid it is still there... With OAUTH and HI_RES, the track tidal:track:2579:77622430:77622437 plays at: {"quality": "HI_RES_LOSSLESS", "codec": "flac"}

Should I have (again) to delete the session json file?

fmarzocca commented 6 months ago

I have deleted the session file and now it looks OK. I will report any future issue. Now the session oauth file correctly contains: "is_pkce": {"data": false}