mirror of
https://github.com/alexta69/metube.git
synced 2026-09-21 21:45:04 +00:00
Merge PR #1031: conservative music metadata enrichment for audio downloads
Adds MusicMetadataPreProcessor (app/music_metadata.py), a pre_process postprocessor that enriches the info dict using only extractor-owned fields: track-number/total resolution, album-title fallback, and square-thumbnail preference. Track numbers and album flow into files through yt-dlp's existing FFmpegMetadata embedding, so no per-format tag-writing code and no new dependency. The earlier mutagen writer and its download-failing PostProcessingError path were dropped per review. Co-authored-by: jahruz67 <jahruz67@users.noreply.github.com>
This commit is contained in:
@@ -23,6 +23,7 @@ from yt_dlp.postprocessor.common import PostProcessor
|
||||
from yt_dlp.utils import STR_FORMAT_RE_TMPL, STR_FORMAT_TYPES
|
||||
import bg_tasks
|
||||
from dl_formats import get_format, get_opts, AUDIO_FORMATS, merge_ytdl_option_layers
|
||||
from music_metadata import MusicMetadataPreProcessor
|
||||
from datetime import datetime
|
||||
from state_store import AtomicJsonStore, from_json_compatible, read_legacy_shelf, to_json_compatible
|
||||
from subscriptions import _entry_id
|
||||
@@ -625,6 +626,13 @@ class Download:
|
||||
)
|
||||
if getattr(self.info, 'download_type', '') == 'audio':
|
||||
ydl.add_post_processor(_AlbumArtistPostProcessor(ydl), when='pre_process')
|
||||
ydl.add_post_processor(
|
||||
MusicMetadataPreProcessor(
|
||||
ydl,
|
||||
source_entry=getattr(self.info, 'entry', None),
|
||||
),
|
||||
when='pre_process',
|
||||
)
|
||||
return ydl
|
||||
|
||||
def _download(self):
|
||||
|
||||
Reference in New Issue
Block a user