Fix search and add JS runtime.
This commit is contained in:
@@ -436,11 +436,15 @@ async def process_radio_track(video_link, video_id, title):
|
|||||||
|
|
||||||
dl_cmd = [
|
dl_cmd = [
|
||||||
"yt-dlp",
|
"yt-dlp",
|
||||||
"--cache-dir", "/usr/src/app/.cache",
|
"--cache-dir",
|
||||||
|
"/usr/src/app/.cache",
|
||||||
"--extract-audio",
|
"--extract-audio",
|
||||||
"--embed-metadata",
|
"--embed-metadata",
|
||||||
"--embed-thumbnail",
|
"--embed-thumbnail",
|
||||||
"--convert-thumbnails", "jpg",
|
"--convert-thumbnails",
|
||||||
|
"jpg",
|
||||||
|
"--js-runtimes",
|
||||||
|
"quickjs",
|
||||||
"--output",
|
"--output",
|
||||||
f"{base_filepath}.%(ext)s",
|
f"{base_filepath}.%(ext)s",
|
||||||
video_link,
|
video_link,
|
||||||
@@ -508,19 +512,20 @@ async def process_radio_track(video_link, video_id, title):
|
|||||||
stderr=asyncio.subprocess.DEVNULL,
|
stderr=asyncio.subprocess.DEVNULL,
|
||||||
)
|
)
|
||||||
search_out, _ = await search_proc.communicate()
|
search_out, _ = await search_proc.communicate()
|
||||||
|
|
||||||
search_data = json.loads(search_out.decode())
|
search_data = json.loads(search_out.decode())
|
||||||
if (
|
# Normalize the data list whether it's wrapped in "rows" or is a raw array
|
||||||
isinstance(search_data, dict)
|
file_list = (
|
||||||
and "rows" in search_data
|
search_data.get("rows", [])
|
||||||
and len(search_data["rows"]) > 0
|
if isinstance(search_data, dict)
|
||||||
):
|
else (search_data if isinstance(search_data, list) else [])
|
||||||
unique_id = unique_id or search_data["rows"][0].get("unique_id")
|
)
|
||||||
azura_path = azura_path or search_data["rows"][0].get("path")
|
for item in file_list:
|
||||||
elif isinstance(search_data, list) and len(search_data) > 0:
|
item_path = item.get("path", "")
|
||||||
unique_id = unique_id or search_data[0].get("unique_id")
|
# Match the specific filename we just uploaded
|
||||||
azura_path = azura_path or search_data[0].get("path")
|
if item_path == filename or item_path.endswith(f"/{filename}"):
|
||||||
|
unique_id = unique_id or item.get("unique_id")
|
||||||
|
azura_path = azura_path or item.get("path")
|
||||||
|
break
|
||||||
except json.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
print(f"❌ Failed to parse AzuraCast upload response")
|
print(f"❌ Failed to parse AzuraCast upload response")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user