Signed-off-by: mbrucedogs <mbrucedogs@gmail.com>
This commit is contained in:
parent
c78be7a7ad
commit
7090fad1fd
72012
data/channel_cache.json
72012
data/channel_cache.json
File diff suppressed because it is too large
Load Diff
@ -2,3 +2,5 @@ https://www.youtube.com/@SingKingKaraoke/videos
|
||||
https://www.youtube.com/@KaraokeOnVEVO/videos
|
||||
https://www.youtube.com/@StingrayKaraoke/videos
|
||||
https://www.youtube.com/@sing2karaoke/videos
|
||||
https://www.youtube.com/@ZoomKaraokeOfficial/videos
|
||||
https://www.youtube.com/@VocalStarKaraoke/videos
|
||||
1835
data/songList.json
1835
data/songList.json
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,7 @@ import os
|
||||
import sys
|
||||
|
||||
from pathlib import Path
|
||||
import json
|
||||
|
||||
from karaoke_downloader.downloader import KaraokeDownloader
|
||||
|
||||
@ -343,7 +344,71 @@ Examples:
|
||||
|
||||
print("🔍 Generating unmatched songs report...")
|
||||
|
||||
# Load songlist
|
||||
# Load songlist based on focus mode
|
||||
if args.songlist_focus:
|
||||
# Load focused playlists
|
||||
songlist_file = Path("data/songList.json")
|
||||
if not songlist_file.exists():
|
||||
print("⚠️ Songlist file not found: data/songList.json")
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
with open(songlist_file, "r", encoding="utf-8") as f:
|
||||
raw_data = json.load(f)
|
||||
|
||||
# Filter playlists by title
|
||||
focused_playlists = []
|
||||
print(f"🔍 Looking for playlists: {args.songlist_focus}")
|
||||
print(f"🔍 Available playlists in songList.json:")
|
||||
for i, playlist in enumerate(raw_data[:5]): # Show first 5 playlists
|
||||
print(f" {i+1}. '{playlist.get('title', 'NO TITLE')}'")
|
||||
if len(raw_data) > 5:
|
||||
print(f" ... and {len(raw_data) - 5} more playlists")
|
||||
|
||||
for playlist in raw_data:
|
||||
playlist_title = playlist.get("title", "")
|
||||
if playlist_title in args.songlist_focus:
|
||||
focused_playlists.append(playlist)
|
||||
print(f"✅ Found matching playlist: '{playlist_title}'")
|
||||
|
||||
if not focused_playlists:
|
||||
print(
|
||||
f"⚠️ No playlists found matching the specified titles: {', '.join(args.songlist_focus)}"
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
# Flatten the focused playlists into songs
|
||||
focused_songs = []
|
||||
seen = set()
|
||||
for playlist in focused_playlists:
|
||||
if "songs" in playlist:
|
||||
for song in playlist["songs"]:
|
||||
if "artist" in song and "title" in song:
|
||||
artist = song["artist"].strip()
|
||||
title = song["title"].strip()
|
||||
key = f"{artist.lower()}_{title.lower()}"
|
||||
if key in seen:
|
||||
continue
|
||||
seen.add(key)
|
||||
focused_songs.append(
|
||||
{
|
||||
"artist": artist,
|
||||
"title": title,
|
||||
"position": song.get("position", 0),
|
||||
}
|
||||
)
|
||||
|
||||
songlist = focused_songs
|
||||
print(
|
||||
f"\n🎯 Songlist focus mode: {len(focused_songs)} songs from {len(focused_playlists)} playlists selected"
|
||||
)
|
||||
print(f"🎯 Focused playlists: {', '.join(args.songlist_focus)}")
|
||||
|
||||
except (json.JSONDecodeError, FileNotFoundError) as e:
|
||||
print(f"⚠️ Could not load songlist for filtering: {e}")
|
||||
sys.exit(1)
|
||||
else:
|
||||
# Load all songs from songlist
|
||||
songlist = load_songlist()
|
||||
if not songlist:
|
||||
print("❌ No songlist found. Please ensure data/songList.json exists.")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user