[BUGFIX] Set multi-value music tags as a list with single value

This commit is contained in:
Jesse Bannon 2022-11-21 13:45:24 -08:00
parent ffaf07d628
commit 7ec9e30ad0
6 changed files with 20 additions and 5 deletions

View file

@ -20,7 +20,9 @@ presets:
embed_thumbnail: False # Set to True to embed album art embed_thumbnail: False # Set to True to embed album art
tags: tags:
artist: "{custom_artist_name}" artist: "{custom_artist_name}"
artists: "{custom_artist_name}"
albumartist: "{custom_artist_name}" albumartist: "{custom_artist_name}"
albumartists: "{custom_artist_name}"
title: "{custom_track_name}" title: "{custom_track_name}"
album: "{custom_album_name}" album: "{custom_album_name}"
track: "{custom_track_number}" track: "{custom_track_number}"

View file

@ -99,6 +99,11 @@ class MusicTagsPlugin(Plugin[MusicTagsOptions]):
if not self.is_dry_run: if not self.is_dry_run:
audio_file = mediafile.MediaFile(entry.get_download_file_path()) audio_file = mediafile.MediaFile(entry.get_download_file_path())
for tag_name, tag_value in tags_to_write.items(): for tag_name, tag_value in tags_to_write.items():
# If the attribute is a List-type, set it as the first element of the list
if isinstance(getattr(audio_file, tag_name), list):
setattr(audio_file, tag_name, [tag_value])
# Otherwise, set as single value
else:
setattr(audio_file, tag_name, tag_value) setattr(audio_file, tag_name, tag_value)
if self.plugin_options.embed_thumbnail: if self.plugin_options.embed_thumbnail:

View file

@ -1,5 +1,5 @@
{ {
"Jesse's Minecraft Server [Trailer - Feb.1].ogg": "0d4509c21883fbc46584d25f6ec4fd80", "Jesse's Minecraft Server [Trailer - Feb.1].ogg": "e8802a80b3011ba4ebdb2fdd8da4f84d",
"Jesse's Minecraft Server [Trailer - Feb.27].ogg": "7ab2863ee0e1c215102c4512085f877d", "Jesse's Minecraft Server [Trailer - Feb.27].ogg": "e9a8a0f2aa98a37610b9418333026f58",
"Jesse's Minecraft Server [Trailer - Mar.21].ogg": "ed6a54d5b3ec6303ea6a175e02c69511" "Jesse's Minecraft Server [Trailer - Mar.21].ogg": "87fd3e42e238374ae1411479d35d38b7"
} }

View file

@ -1,3 +1,3 @@
{ {
"YouTube Rewind 2019 For the Record #YouTubeRewind.mp3": "8e531bfb93b144fe652f44950e31b3f7" "YouTube Rewind 2019 For the Record #YouTubeRewind.mp3": "5df65e724b3c305195473c42bbc53da9"
} }

View file

@ -5,7 +5,9 @@ Files created:
Music Tags: Music Tags:
album: Singles album: Singles
albumartist: Project Zombie albumartist: Project Zombie
albumartists: Project Zombie
artist: Project Zombie artist: Project Zombie
artists: Project Zombie
genre: Unset genre: Unset
title: Jesse's Minecraft Server [Trailer - Feb.1] title: Jesse's Minecraft Server [Trailer - Feb.1]
track: 3 track: 3
@ -14,7 +16,9 @@ Files created:
Music Tags: Music Tags:
album: Singles album: Singles
albumartist: Project Zombie albumartist: Project Zombie
albumartists: Project Zombie
artist: Project Zombie artist: Project Zombie
artists: Project Zombie
genre: Unset genre: Unset
title: Jesse's Minecraft Server [Trailer - Feb.27] title: Jesse's Minecraft Server [Trailer - Feb.27]
track: 2 track: 2
@ -23,7 +27,9 @@ Files created:
Music Tags: Music Tags:
album: Singles album: Singles
albumartist: Project Zombie albumartist: Project Zombie
albumartists: Project Zombie
artist: Project Zombie artist: Project Zombie
artists: Project Zombie
genre: Unset genre: Unset
title: Jesse's Minecraft Server [Trailer - Mar.21] title: Jesse's Minecraft Server [Trailer - Mar.21]
track: 1 track: 1

View file

@ -5,7 +5,9 @@ Files created:
Embedded Thumbnail, Music Tags: Embedded Thumbnail, Music Tags:
album: Singles album: Singles
albumartist: YouTube albumartist: YouTube
albumartists: YouTube
artist: YouTube artist: YouTube
artists: YouTube
genre: Unset genre: Unset
title: YouTube Rewind 2019: For the Record | #YouTubeRewind title: YouTube Rewind 2019: For the Record | #YouTubeRewind
track: 1 track: 1