Signed-off-by: mbrucedogs <mbrucedogs@gmail.com>

This commit is contained in:
mbrucedogs 2025-07-25 14:24:02 -05:00
parent a1bb719c8e
commit 4f3c5bee08
2 changed files with 141 additions and 2 deletions

View File

@ -16238,5 +16238,117 @@
"channel": "@SingKingKaraoke", "channel": "@SingKingKaraoke",
"marked_at": "2025-07-25T13:57:05.588503", "marked_at": "2025-07-25T13:57:05.588503",
"reason": "already_on_server" "reason": "already_on_server"
},
"big energy_latto": {
"artist": "Big Energy",
"title": "Latto",
"video_title": "Big Energy - Latto",
"channel": "@karafun",
"marked_at": "2025-07-25T14:23:02.055235",
"reason": "already_on_server"
},
"get the party started_pink": {
"artist": "Get the Party Started",
"title": "Pink",
"video_title": "Get the Party Started - Pink",
"channel": "@karafun",
"marked_at": "2025-07-25T14:23:02.164355",
"reason": "already_on_server"
},
"hey brother_avicii": {
"artist": "Hey Brother",
"title": "Avicii",
"video_title": "Hey Brother - Avicii",
"channel": "@karafun",
"marked_at": "2025-07-25T14:23:02.465075",
"reason": "already_on_server"
},
"your love_the outfield": {
"artist": "Your Love",
"title": "The Outfield",
"video_title": "Your Love - The Outfield",
"channel": "@karafun",
"marked_at": "2025-07-25T14:23:02.508765",
"reason": "already_on_server"
},
"no one_alicia keys": {
"artist": "No One",
"title": "Alicia Keys",
"video_title": "No One - Alicia Keys",
"channel": "@karafun",
"marked_at": "2025-07-25T14:23:02.565600",
"reason": "already_on_server"
},
"hello_lionel richie": {
"artist": "Hello",
"title": "Lionel Richie",
"video_title": "Hello - Lionel Richie",
"channel": "@karafun",
"marked_at": "2025-07-25T14:23:02.840401",
"reason": "already_on_server"
},
"myles smith_stargazing": {
"artist": "Myles Smith",
"title": "Stargazing",
"video_title": "Myles Smith - Stargazing (Karaoke Version)",
"channel": "@StingrayKaraoke",
"marked_at": "2025-07-25T14:23:03.087040",
"reason": "already_on_server"
},
"r.e.m._losing my religion": {
"artist": "R.E.M.",
"title": "Losing My Religion",
"video_title": "R.E.M. - Losing My Religion (Karaoke Version)",
"channel": "@StingrayKaraoke",
"marked_at": "2025-07-25T14:23:03.125326",
"reason": "already_on_server"
},
"bad bunny_dtmf": {
"artist": "Bad Bunny",
"title": "DtMF",
"video_title": "Bad Bunny - DtMF (Karaoke Version)",
"channel": "@StingrayKaraoke",
"marked_at": "2025-07-25T14:23:03.159612",
"reason": "already_on_server"
},
"lady gaga_judas": {
"artist": "Lady Gaga",
"title": "Judas",
"video_title": "Lady Gaga - Judas (Karaoke Version)",
"channel": "@StingrayKaraoke",
"marked_at": "2025-07-25T14:23:03.185817",
"reason": "already_on_server"
},
"lisa_money": {
"artist": "Lisa",
"title": "Money",
"video_title": "Lisa - Money (Karaoke Version)",
"channel": "@StingrayKaraoke",
"marked_at": "2025-07-25T14:23:03.217038",
"reason": "already_on_server"
},
"alex warren_ordinary": {
"artist": "Alex Warren",
"title": "Ordinary",
"video_title": "Alex Warren - Ordinary (Karaoke Version)",
"channel": "@StingrayKaraoke",
"marked_at": "2025-07-25T14:23:03.249818",
"reason": "already_on_server"
},
"nickelback_how you remind me": {
"artist": "Nickelback",
"title": "How You Remind Me",
"video_title": "Nickelback - How You Remind Me (Karaoke Version)",
"channel": "@StingrayKaraoke",
"marked_at": "2025-07-25T14:23:03.289515",
"reason": "already_on_server"
},
"lady gaga_poker face": {
"artist": "Lady Gaga",
"title": "Poker Face",
"video_title": "Lady Gaga - Poker Face (Karaoke Version)",
"channel": "@StingrayKaraoke",
"marked_at": "2025-07-25T14:23:03.327860",
"reason": "already_on_server"
} }
} }

View File

@ -68,7 +68,7 @@ class DownloadPipeline:
output_path = self.downloads_dir / channel_name / filename output_path = self.downloads_dir / channel_name / filename
# Step 2: Download video # Step 2: Download video
if not self._download_video(video_id, output_path, artist, title): if not self._download_video(video_id, output_path, artist, title, channel_name):
return False return False
# Step 3: Verify download # Step 3: Verify download
@ -92,10 +92,15 @@ class DownloadPipeline:
except Exception as e: except Exception as e:
print(f"❌ Pipeline failed for {artist} - {title}: {e}") print(f"❌ Pipeline failed for {artist} - {title}: {e}")
# Mark song as failed in tracking
if self.tracker:
self.tracker.mark_song_failed(
artist, title, video_id, channel_name, f"Pipeline failed: {e}"
)
return False return False
def _download_video( def _download_video(
self, video_id: str, output_path: Path, artist: str, title: str self, video_id: str, output_path: Path, artist: str, title: str, channel_name: str
) -> bool: ) -> bool:
"""Step 1: Download the video using yt-dlp.""" """Step 1: Download the video using yt-dlp."""
output_path.parent.mkdir(parents=True, exist_ok=True) output_path.parent.mkdir(parents=True, exist_ok=True)
@ -130,6 +135,11 @@ class DownloadPipeline:
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
error = handle_yt_dlp_error(e, artist, title, video_id) error = handle_yt_dlp_error(e, artist, title, video_id)
log_error(error) log_error(error)
# Mark song as failed in tracking
if self.tracker:
self.tracker.mark_song_failed(
artist, title, video_id, channel_name, error.message
)
return False return False
def _verify_download( def _verify_download(
@ -162,8 +172,20 @@ class DownloadPipeline:
break break
else: else:
print(f"❌ No matching file found for: {artist} - {title}") print(f"❌ No matching file found for: {artist} - {title}")
# Mark song as failed in tracking
if self.tracker:
error_msg = f"Download failed: file does not exist and no matching file found"
self.tracker.mark_song_failed(
artist, title, video_id, channel_name, error_msg
)
return False return False
else: else:
# Mark song as failed in tracking
if self.tracker:
error_msg = f"Download failed: file does not exist"
self.tracker.mark_song_failed(
artist, title, video_id, channel_name, error_msg
)
return False return False
# Validate file # Validate file
@ -177,6 +199,11 @@ class DownloadPipeline:
channel_name, channel_name,
) )
log_error(error) log_error(error)
# Mark song as failed in tracking
if self.tracker:
self.tracker.mark_song_failed(
artist, title, video_id, channel_name, error.message
)
return False return False
print(f"✅ Download verified: {output_path}") print(f"✅ Download verified: {output_path}")