Signed-off-by: mbrucedogs <mbrucedogs@gmail.com>
This commit is contained in:
parent
cf8f4e2be9
commit
eb56c6c581
@ -289,23 +289,45 @@ class KaraokeDownloader:
|
|||||||
# Progress print statement
|
# Progress print statement
|
||||||
print(f"\U0001F4E5 Downloading {downloaded_count + 1} of {total_to_download} songlist songs...")
|
print(f"\U0001F4E5 Downloading {downloaded_count + 1} of {total_to_download} songlist songs...")
|
||||||
# Download this song from this channel
|
# Download this song from this channel
|
||||||
output_path = self.downloads_dir / channel_name / f"{artist} - {title} (Karaoke Version).mp4"
|
# Create a shorter, safer filename
|
||||||
|
safe_title = title.replace("(From ", "").replace(")", "").replace(" - ", " ").replace(":", "").replace("'", "").replace('"', "")
|
||||||
|
safe_artist = artist.replace("'", "").replace('"', "")
|
||||||
|
filename = f"{safe_artist} - {safe_title}.mp4"
|
||||||
|
# Limit filename length to avoid Windows path issues
|
||||||
|
if len(filename) > 100:
|
||||||
|
filename = f"{safe_artist[:30]} - {safe_title[:60]}.mp4"
|
||||||
|
|
||||||
|
output_path = self.downloads_dir / channel_name / filename
|
||||||
output_path.parent.mkdir(parents=True, exist_ok=True)
|
output_path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
print(f"⬇️ Downloading: {artist} - {title} -> {output_path}")
|
print(f"⬇️ Downloading: {artist} - {title} -> {output_path}")
|
||||||
video_url = f"https://www.youtube.com/watch?v={video['id']}"
|
video_url = f"https://www.youtube.com/watch?v={video['id']}"
|
||||||
dlp_cmd = [
|
dlp_cmd = [
|
||||||
str(self.yt_dlp_path),
|
str(self.yt_dlp_path),
|
||||||
|
"--no-check-certificates",
|
||||||
|
"--ignore-errors",
|
||||||
|
"--no-warnings",
|
||||||
"-o", str(output_path),
|
"-o", str(output_path),
|
||||||
"-f", self.config["download_settings"]["format"],
|
"-f", "best", # TEMP: Simplified format for debugging
|
||||||
video_url
|
video_url
|
||||||
]
|
]
|
||||||
|
print(f"🔧 Running command: {' '.join(dlp_cmd)}")
|
||||||
try:
|
try:
|
||||||
subprocess.run(dlp_cmd, check=True)
|
result = subprocess.run(dlp_cmd, capture_output=True, text=True, check=True)
|
||||||
|
print(f"✅ yt-dlp completed successfully")
|
||||||
|
print(f"📄 yt-dlp stdout: {result.stdout}")
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
print(f"❌ yt-dlp failed: {e}")
|
print(f"❌ yt-dlp failed with exit code {e.returncode}")
|
||||||
|
print(f"❌ yt-dlp stderr: {e.stderr}")
|
||||||
continue
|
continue
|
||||||
if not output_path.exists() or output_path.stat().st_size == 0:
|
if not output_path.exists():
|
||||||
print(f"❌ Download failed or file is empty: {output_path}")
|
print(f"❌ Download failed: file does not exist: {output_path}")
|
||||||
|
# Check if yt-dlp saved it somewhere else
|
||||||
|
possible_files = list(output_path.parent.glob("*.mp4"))
|
||||||
|
if possible_files:
|
||||||
|
print(f"🔍 Found these files in the directory: {[f.name for f in possible_files]}")
|
||||||
|
continue
|
||||||
|
if output_path.stat().st_size == 0:
|
||||||
|
print(f"❌ Download failed: file is empty (0 bytes): {output_path}")
|
||||||
continue
|
continue
|
||||||
# TEMP: Skipping MP4 validation for debugging
|
# TEMP: Skipping MP4 validation for debugging
|
||||||
# if not self._is_valid_mp4(output_path):
|
# if not self._is_valid_mp4(output_path):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user