Stop Service File items from containing more than one audio file

This commit is contained in:
Tim Bentley 2024-04-20 22:14:29 +00:00 committed by Raoul Snyman
parent d2a2b94273
commit 9b9d8feafa
1 changed files with 3 additions and 1 deletions

View File

@ -628,9 +628,11 @@ class SongMediaItem(MediaManagerItem):
if State().check_preconditions('media'):
service_item.add_capability(ItemCapabilities.HasBackgroundAudio)
total_length = 0
# We could have stored multiple files but only the first one will be played.
for m in song.media_files:
total_length += self.media_controller.media_length(m.file_path)
service_item.background_audio = [(m.file_path, m.file_hash) for m in song.media_files]
service_item.background_audio = [(m.file_path, m.file_hash)]
break
service_item.set_media_length(total_length)
service_item.metadata.append('<em>{label}:</em> {media}'.
format(label=translate('SongsPlugin.MediaItem', 'Media'),