Fix: Provide a proper track number for Deezer tracks if available (#1900)
authorawhiemstra <ahiemstra@heimr.nl>
Tue, 21 Jan 2025 19:04:38 +0000 (20:04 +0100)
committerGitHub <noreply@github.com>
Tue, 21 Jan 2025 19:04:38 +0000 (20:04 +0100)
Use the track_position attribute if it's available as the track number.
This ensures we get the right track number for things like multi-disc
albums. Without this, tracks seem to follow the order in which they have
been added, which does not match the actual track numbering.

music_assistant/providers/deezer/__init__.py

index a2b77b19eaab32570d1d48259d12ed446c5ca488..181f3f54bf1f21d368e683f4c9009b1b85fb2b79 100644 (file)
@@ -674,7 +674,7 @@ class DeezerProvider(MusicProvider):
                 )
             },
             metadata=self.parse_metadata_track(track=track),
-            track_number=position,
+            track_number=getattr(track, "track_position", position),
             position=position,
             disc_number=getattr(track, "disk_number", 0),
         )