Add YouTube ID detection and metadata lookup via yt-dlp
- Extract 11-char YouTube video IDs from audio filenames - Fetch title, uploader, chapters via yt-dlp (--dump-json) - Use chapters as tracklist when no .txt tracklist is available - Store yt_title / yt_uploader in AlbumHints for LLM prompt context - Fall back to YouTube video title as track title for single-file albums Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
888464b4d0
commit
b6abfae16c
3 changed files with 115 additions and 0 deletions
10
metadata_resolver.py
Normal file → Executable file
10
metadata_resolver.py
Normal file → Executable file
|
|
@ -213,6 +213,8 @@ def _build_resolve_prompt(hints: AlbumHints, partial: Dict) -> str:
|
|||
f"Hinweis Künstler/Titel (aus Verzeichnis, kann vertauscht oder falsch sein): "
|
||||
f"{hints.dir_artist or '?'} / {hints.dir_album or partial.get('album', '?')}\n"
|
||||
f"Jahr: {hints.dir_year or partial.get('year', 'unbekannt')}\n"
|
||||
+ (f"YouTube-Videotitel: {hints.yt_title}\n" if hints.yt_title else "")
|
||||
+ (f"YouTube-Uploader/Kanal: {hints.yt_uploader}\n" if hints.yt_uploader else "")
|
||||
+ (f"Tracklist-Kopf (Label/Jahr/Albumtitel):\n{tracklist_header}\n\n" if tracklist_header else "")
|
||||
+ f"Tracks:\n{tracks_summary}\n\n"
|
||||
'Antworte NUR mit einem JSON-Objekt (null wenn unbekannt):\n'
|
||||
|
|
@ -354,9 +356,17 @@ def resolve(
|
|||
genre = genre or t.existing_tags.get("genre")
|
||||
label = label or t.existing_tags.get("label") or t.existing_tags.get("organization")
|
||||
|
||||
# YouTube-Metadaten als zusätzliche Hinweise (Uploader → Künstler, Titel → Album/Track)
|
||||
if hints.yt_uploader and not artist:
|
||||
artist = hints.yt_uploader
|
||||
if hints.yt_title and not album:
|
||||
album = hints.yt_title
|
||||
|
||||
if artist or album:
|
||||
confidence += 0.05
|
||||
sources.append("local-hints")
|
||||
if hints.yt_title or hints.yt_uploader:
|
||||
sources.append("youtube")
|
||||
|
||||
# AcoustID fingerprinting
|
||||
fp_mbids: Dict[str, List[str]] = {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue