Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Album and playlist that contains unavailable tracks fails to download #66

Open
cstaelen opened this issue Jan 5, 2025 · 2 comments
Open
Labels
bug Something isn't working

Comments

@cstaelen
Copy link

cstaelen commented Jan 5, 2025

Hello @oskvr37,

First of all, thank you for your great work 🙌
It works like a charm.

I just encountered an issue (v1.9.3) while downloading an album (or playlist) that contains unavailable tracks, like here :
https://listen.tidal.com/album/116964573

In my country, it looks like that :
Capture d’écran 2025-01-06 à 00 20 47

When downloading it, running :

tiddl https://listen.tidal.com/album/116964573

It crashes with output :

[ TIDDL ] album: Electronic Music Anthology Vol. 2 (by FG)
[ TIDDL ] sleeping for 2.3s
Traceback (most recent call last):
  File "/root/.venvs/bin/tiddl", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/root/.venvs/lib/python3.12/site-packages/tiddl/__init__.py", line 276, in main
    downloadAlbum(input_id, skip_existing)
  File "/root/.venvs/lib/python3.12/site-packages/tiddl/__init__.py", line 226, in downloadAlbum
    file_dir, file_name = downloadTrack(
                          ^^^^^^^^^^^^^^
  File "/root/.venvs/lib/python3.12/site-packages/tiddl/__init__.py", line 164, in downloadTrack
    stream = api.getTrackStream(track["id"], track_quality)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.venvs/lib/python3.12/site-packages/tiddl/api.py", line 62, in getTrackStream
    return self._request(
           ^^^^^^^^^^^^^^
  File "/root/.venvs/lib/python3.12/site-packages/tiddl/api.py", line 52, in _request
    raise ApiError(req.text, data)
tiddl.api.ApiError: {"status":403,"subStatus":4032,"userMessage":"No content matching subscription location."}

This is happening too while downloading playlist with unavailable tracks.

Regarding the API, track.allowStreaming seems to discriminate available/unavailable tracks.
Maybe Tiddl could skip track processing if allowStreaming is false ? What do you think ?

Thanks for your feedback :)

Regards.

@teddybee-r
Copy link

Temporary fix for this issue.

#__init__.py 
[...]
def downloadAlbum(album_id: str | int, skip_existing: bool):
[...]
            if item["type"] != "track":
                logger.warning(f"item is not a track: {track["title"]} ({track["id"]})")
                continue

            # skip song if it cannot be streamed
            if track["allowStreaming"] == False:
                logger.warning(f"The track is not streamable: {track["title"]} ({track["id"]})")
                continue
[...]    

There should be a better location to put this but I am still learning some more python.
The error will obviously still appear trying to download the track directly: track/116964574

Another issue I've ran into was an empty cover also crashing the downloads.

Temporary fix (resulting in errors)

#download.py
        # str() is required or .replace() will crash on NoneType
        self.uid = str(uid)

Example of a missing cover: album/63467449

I would put these in a PR if I was more confident in the solutions.

@oskvr37 oskvr37 added the bug Something isn't working label Jan 8, 2025
oskvr37 added a commit that referenced this issue Jan 14, 2025
@oskvr37
Copy link
Owner

oskvr37 commented Jan 14, 2025

I think now it should work with latest commit
Please check if your albums are downloaded with no problems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants