summaryrefslogtreecommitdiff
path: root/tidal_dl_ng
diff options
context:
space:
mode:
authorRobert Honz <exislow+github@gmail.com>2025-10-20 08:12:34 +0200
committerRobert Honz <exislow+github@gmail.com>2025-10-20 08:12:34 +0200
commitffbd7849a11c7ef1c39294c8e92686edb6775c71 (patch)
treeea8cec482bc1f1d26ce340a2b7fb261167aab9cb /tidal_dl_ng
parenta4c36ff6f502aff1dad72bbdce755502aa400f79 (diff)
downloadtidal-dl-ng-ffbd7849a11c7ef1c39294c8e92686edb6775c71.tar.gz
fix(download): 🐛 handle missing `st_birthtime` attribute in track sorting
* Updated the sorting method for track paths to check for the presence of `st_birthtime`. * If `st_birthtime` is not available, fallback to using `st_ctime` for sorting.
Diffstat (limited to 'tidal_dl_ng')
-rw-r--r--tidal_dl_ng/download.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/tidal_dl_ng/download.py b/tidal_dl_ng/download.py
index cf9e260..f6ddf48 100644
--- a/tidal_dl_ng/download.py
+++ b/tidal_dl_ng/download.py
@@ -1560,7 +1560,9 @@ class Download:
path_tracks.sort()
elif not is_album:
# If it is not an album sort by creation time
- path_tracks.sort(key=lambda x: x.stat().st_birthtime)
+ path_tracks.sort(
+ key=lambda x: x.stat().st_birthtime if hasattr(x.stat(), "st_birthtime") else x.stat().st_ctime
+ )
# Write data to m3u file
with path_playlist.open(mode="w", encoding="utf-8") as f: