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.
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user