use beets mediafile in favor of old music-tag library
This commit is contained in:
parent
d5b99a501c
commit
424a6969f5
4 changed files with 34 additions and 25 deletions
|
|
@ -22,7 +22,7 @@ presets:
|
|||
albumartist: "{artist}"
|
||||
title: "{title}"
|
||||
album: "{album}"
|
||||
tracknumber: "{track_number}"
|
||||
track: "{track_number}"
|
||||
year: "{album_year}"
|
||||
genre: "{genre}"
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ install_requires =
|
|||
argparse==1.4.0
|
||||
dicttoxml==1.7.4
|
||||
mergedeep==1.3.4
|
||||
music-tag==0.4.3
|
||||
mediafile==0.9.0
|
||||
Pillow==9.1.0
|
||||
PyYAML==6.0
|
||||
yt-dlp==2022.4.8
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import music_tag
|
||||
import mediafile
|
||||
|
||||
from ytdl_sub.entries.entry import Entry
|
||||
from ytdl_sub.plugins.plugin import Plugin
|
||||
|
|
@ -28,7 +28,16 @@ class MusicTagsPlugin(Plugin[MusicTagsOptions]):
|
|||
"""
|
||||
Tags the entry's audio file using values defined in the metadata options
|
||||
"""
|
||||
audio_file = music_tag.load_file(entry.get_download_file_path())
|
||||
audio_file = mediafile.MediaFile(entry.get_download_file_path())
|
||||
for tag, tag_formatter in self.plugin_options.tags.dict.items():
|
||||
audio_file[tag] = self.overrides.apply_formatter(formatter=tag_formatter, entry=entry)
|
||||
if tag not in audio_file.fields():
|
||||
# TODO: Add proper logger and warn here
|
||||
print(
|
||||
f"[ytld-sub: WARN] tag {tag} is not supported for {entry.ext} files. Supported "
|
||||
f"tags: {', '.join(audio_file.sorted_fields())}"
|
||||
)
|
||||
|
||||
tag_value = self.overrides.apply_formatter(formatter=tag_formatter, entry=entry)
|
||||
setattr(audio_file, tag, tag_value)
|
||||
|
||||
audio_file.save()
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@
|
|||
# artist: "DeLorra"
|
||||
# genre: "Synthwave / Electronic"
|
||||
#
|
||||
#bl00dwave:
|
||||
# preset: "soundcloud_with_id3_tags"
|
||||
# soundcloud:
|
||||
# username: bl00dwave
|
||||
# overrides:
|
||||
# artist: "bl00dwave"
|
||||
# genre: "Synthwave / Electronic"
|
||||
bl00dwave:
|
||||
preset: "soundcloud_with_id3_tags"
|
||||
soundcloud:
|
||||
username: bl00dwave
|
||||
overrides:
|
||||
artist: "bl00dwave"
|
||||
genre: "Synthwave / Electronic"
|
||||
#
|
||||
#tom_petty:
|
||||
# preset: "music_videos"
|
||||
|
|
@ -56,16 +56,16 @@
|
|||
# overrides:
|
||||
# artist: "The Gogos"
|
||||
|
||||
recent_channel_test:
|
||||
preset: "yt_channel"
|
||||
ytdl_options:
|
||||
break_on_reject: True
|
||||
youtube:
|
||||
channel_id: "UCsvn_Po0SmunchJYOWpOxMg"
|
||||
after: today-13days
|
||||
output_options:
|
||||
output_directory: "/tmp/dunkey"
|
||||
keep_files:
|
||||
after: today-3days
|
||||
overrides:
|
||||
tv_show_name: "Youtube: Dunkey"
|
||||
#recent_channel_test:
|
||||
# preset: "yt_channel"
|
||||
# ytdl_options:
|
||||
# break_on_reject: True
|
||||
# youtube:
|
||||
# channel_id: "UCsvn_Po0SmunchJYOWpOxMg"
|
||||
# after: today-13days
|
||||
# output_options:
|
||||
# output_directory: "/tmp/dunkey"
|
||||
# keep_files:
|
||||
# after: today-3days
|
||||
# overrides:
|
||||
# tv_show_name: "Youtube: Dunkey"
|
||||
Loading…
Reference in a new issue