🐛 Fixed album data that was not available while downloading playlists (#226)

* fetch album while handling playlist when there is "{album}" in template

* add note to the docs
This commit is contained in:
Oskar Dudziński
2025-11-17 15:46:41 +01:00
committed by GitHub
parent 02919e38e6
commit 74e45ef39a
2 changed files with 16 additions and 1 deletions
+8
View File
@@ -73,6 +73,14 @@ Each object type exposes fields you can use inside templates.
| `playlist.created` | Creation date (`datetime`) | `2024-01-15 10:42:00` |
| `playlist.updated` | Last updated date (`datetime`) | `2024-03-02 09:00:00` |
> [!NOTE]
> Tidal API does not provide full album data for playlist tracks,
> if you are downloading a playlist with template that contains `{album...}`,
> then `tiddl` is making additional request to the API to fetch album data for a track.
> The download may take a little longer but it's not a big deal - just one more request for every playlist track.
> If there are multiple tracks from the same album, then the album data is cached locally,
> and there is only one request per album. Related issue: #217
---
### Explicit
+8 -1
View File
@@ -486,13 +486,20 @@ def download_callback(
for playlist_item in playlist_items.items:
playlist_index += 1
template = TEMPLATE or CONFIG.templates.playlist
if "{album" in template:
album = ctx.obj.api.get_album(playlist_item.item.album.id)
else:
album = None
futures.append(
handle_item(
item=playlist_item.item,
file_path=format_template(
template=TEMPLATE or CONFIG.templates.playlist,
template=template,
item=playlist_item.item,
album=album,
playlist=playlist,
playlist_index=playlist_index,
quality=get_item_quality(playlist_item.item),