Sort audiobook chapter files based on disk number (#2302)
authorJamie Gravendeel <me@jamie.garden>
Fri, 8 Aug 2025 09:30:42 +0000 (11:30 +0200)
committerGitHub <noreply@github.com>
Fri, 8 Aug 2025 09:30:42 +0000 (11:30 +0200)
Fixes https://github.com/music-assistant/support/issues/3905

music_assistant/providers/filesystem_local/__init__.py

index c75d3a1fe3383bbfa3e16bf5324718a44d01abf1..222b3f7397c458b4a054f26bac98fa5a918c30e2 100644 (file)
@@ -1708,7 +1708,7 @@ class LocalFileSystemProvider(MusicProvider):
                 if item_tags.track is None:
                     continue
                 chapter_file_tags.append(item_tags)
-            chapter_file_tags.sort(key=lambda x: x.track or 0)
+            chapter_file_tags.sort(key=lambda x: (x.disc or 0, x.track or 0))
             for chapter_tags in chapter_file_tags:
                 assert chapter_tags.duration is not None
                 chapters.append(