-
-
Save Cajivah/df5bd06448a2f3bf09534b23d0928043 to your computer and use it in GitHub Desktop.
| #!/usr/bin/python3 | |
| import tidalapi | |
| import json | |
| from pathlib import Path | |
| from configparser import ConfigParser | |
| strawberry_conf_file_path = str(Path.home()) + "/.config/strawberry/strawberry.conf" | |
| strawberry_conf_file = ConfigParser() | |
| strawberry_conf_file.read(strawberry_conf_file_path) | |
| session = tidalapi.Session() | |
| session.login_pkce() | |
| creds = { | |
| "token_type": session.token_type, | |
| "session_id": session.session_id, | |
| "access_token": session.access_token, | |
| "refresh_token": session.refresh_token, | |
| } | |
| strawberry_conf_file["Tidal"]["type"] = "2" | |
| strawberry_conf_file["Tidal"]["streamurl"] = "2" | |
| strawberry_conf_file["Tidal"]["oauth"] = "true" | |
| strawberry_conf_file["Tidal"]["enabled"] = "true" | |
| strawberry_conf_file["Tidal"]["client_id"] = session.config.client_id_pkce | |
| strawberry_conf_file["Tidal"]["quality"] = "HI_RES_LOSSLESS" | |
| strawberry_conf_file["Tidal"]["country_code"] = "PL" | |
| strawberry_conf_file["Tidal"]["token_type"] = "Bearer" | |
| strawberry_conf_file["Tidal"]["access_token"] = creds["access_token"] | |
| strawberry_conf_file["Tidal"]["refresh_token"] = creds["refresh_token"] | |
| with open(strawberry_conf_file_path, "w") as configfile: | |
| strawberry_conf_file.write(configfile) | |
| print(json.dumps(creds, indent=4)) |
Well, it seems to partially work, but in Strawberry I get this error
Error transferring https://api.tidalhifi.com/v1/users/0/favorites/artists?countryCode=DK - server replied: (201)
Hmm, that's strange -- if 201 is the http response code, then it sounds correct(-ish). I'm afraid I won't be able to help much. Is the app usable or it's bricked due to this error?
Hello. Thanks for this. It seems to let me log into Tidal on Strawberry, however, playing a song results in this error: "Asset is not ready for playback (401) (4005)". They really seem to be guarding ClientID pretty tight. I guess I will be sticking to Qobuz for now.
This is just strange as it seems that Tidal do allow third party API clients, Remember did not read any text for time being, just noticed the menu option https://account.tidal.com/third-party-apps
@mull3s how do you connect Qobuz with Strawberry?
Yes I did try to create a developer account to get a clientID to test its functionality, but it does not seem to work. The only method that seems to work right now is to download an older android app version of tidal and process files from an associated folder on your phone. This is limited to 44.1khz/16bit FLAC files from my testing, which is the standard for high quality audio.
To get Hi-Res I connected Qobuz. Strawberry has integration in the settings, you need your: username+password, App ID, and App secret. To get the latter 2 I used "qobuz-dl" which has a script for extracting them: https://github.com/vitiko98/qobuz-dl. let me know if you run into any trouble @spirillen .
@mull3s thx for the hint, but I can only see what appears to be the app-secret in cat etc/aau_token (using miniconda), I can't find the app-id in there
For other, the info are stored in /home/$USER/.config/qobuz-dl/config.ini
Well, I could log in, retrieve the lists (album|artist|tracks) but when trying to play...
Maybe we should move this to the strawberry repo...
Update: moved to strawberrymusicplayer/strawberry#1832 @Cajivah you can delete these OT now if you like to
@spirillen Yes that may be the case. We might need to move this there. As for the app secret and ID I believe in the python file I also printed the values so it returns them that is now I got it.
As for the problem you got with tidal, I had the same exact issue. Login and list retrieval successful, but that error popped when I tried to play anything.
for windows users:
Run
strawberry_tidal.regfile to import settings into strawberry.