From 2598790093e47121a21937e527ecfb91393f59d7 Mon Sep 17 00:00:00 2001 From: Lev Plyusnin Date: Wed, 3 Jan 2024 15:16:10 +0700 Subject: [PATCH] Revert MutagenMetadataPP --- yt_dlp/__init__.py | 5 --- yt_dlp/postprocessor/__init__.py | 1 - yt_dlp/postprocessor/mutagenmetadata.py | 42 ------------------------- 3 files changed, 48 deletions(-) delete mode 100644 yt_dlp/postprocessor/mutagenmetadata.py diff --git a/yt_dlp/__init__.py b/yt_dlp/__init__.py index 025b97a31..57a487157 100644 --- a/yt_dlp/__init__.py +++ b/yt_dlp/__init__.py @@ -670,11 +670,6 @@ def get_postprocessors(opts): 'add_metadata': opts.addmetadata, 'add_infojson': opts.embed_infojson, } - # MutagenMetadata must run after FFmpegMetadata - if opts.addmetadata: - yield { - 'key': 'MutagenMetadata', - } # Deprecated # This should be above EmbedThumbnail since sponskrub removes the thumbnail attachment # but must be below EmbedSubtitle and FFmpegMetadata diff --git a/yt_dlp/postprocessor/__init__.py b/yt_dlp/postprocessor/__init__.py index e96a015e6..bfe9df733 100644 --- a/yt_dlp/postprocessor/__init__.py +++ b/yt_dlp/postprocessor/__init__.py @@ -30,7 +30,6 @@ ) from .modify_chapters import ModifyChaptersPP from .movefilesafterdownload import MoveFilesAfterDownloadPP -from .mutagenmetadata import MutagenMetadataPP from .sponskrub import SponSkrubPP from .sponsorblock import SponsorBlockPP from .xattrpp import XAttrMetadataPP diff --git a/yt_dlp/postprocessor/mutagenmetadata.py b/yt_dlp/postprocessor/mutagenmetadata.py deleted file mode 100644 index 7a2925ed8..000000000 --- a/yt_dlp/postprocessor/mutagenmetadata.py +++ /dev/null @@ -1,42 +0,0 @@ -from .common import PostProcessor -from ..dependencies import mutagen - -if mutagen: - from mutagen.easymp4 import EasyMP4 - from mutagen.flac import FLAC - from mutagen.mp3 import EasyMP3 - from mutagen.musepack import Musepack - from mutagen.oggopus import OggOpus - from mutagen.oggvorbis import OggVorbis - - -class MutagenMetadataPP(PostProcessor): - def __init__(self, downloader): - PostProcessor.__init__(self, downloader) - - @PostProcessor._restrict_to(images=False) - def run(self, information): - extension = information['ext'] - ret = [], information - if not mutagen: - if extension in ['mp3', 'm4a', 'ogg', 'opus', 'flac', '.mpc']: - self.report_warning('module mutagen was not found. Tags with multiple values (e.g. artist, album artist and genre) may be set incorrectly. Please install using `python -m pip install mutagen`') - return ret - tag_mapping = { - 'artist': 'artists', - 'albumartist': 'album_artists', - 'genre': 'genres', - 'composer': 'composers' - } - supported_formats = [EasyMP3, EasyMP4, OggVorbis, OggOpus, FLAC, Musepack] - file = mutagen.File(information['filepath'], supported_formats) - if not file: - return ret - if isinstance(file, EasyMP4): - file.RegisterTextKey('composer', '\251wrt') - for tag_key, info_key in tag_mapping.items(): - value = information.get(info_key) - if value: - file[tag_key] = value - file.save() - return ret