Perun: Fixed yt-dlp options and properly passing the api key to curl

This commit is contained in:
florian 2025-10-21 18:15:53 +02:00
parent c05dd69cb8
commit ab603c0d9a
2 changed files with 13 additions and 6 deletions

View File

@ -106,23 +106,30 @@ def send_notification_via_ssh(notification_title, notification_info):
logger.debug(f"Notification payload: {json_payload}")
notification_cmd = (
f"API_KEY=$(head -n1) && "
f"curl -s -X POST '{BACKEND_API_URL}' "
f"-H 'Content-Type: application/json' "
f"-H 'X-API-Key-Internal: $(head -n1)' "
f"-d @-"
f"-H \"X-API-Key-Internal: $API_KEY\" "
f"-d '{json_payload}'"
)
stdin, stdout, stderr = ssh.exec_command(notification_cmd)
stdin.write(f"{BACKEND_API_KEY}\n{json_payload}")
stdin.write(f"{BACKEND_API_KEY}\n")
stdin.flush()
stdin.channel.shutdown_write()
exit_status = stdout.channel.recv_exit_status()
response_output = stdout.read().decode()
exit_status = stdout.channel.recv_exit_status()
if exit_status == 0:
logger.info("Notification sent successfully")
logger.debug(f"Response: {response_output}")
else:
error_output = stderr.read().decode()
logger.warning(f"Notification command exited with {exit_status}: {error_output}")
logger.warning(f"Notification command exited with {exit_status}")
logger.warning(f"Error: {error_output}")
logger.warning(f"Response: {response_output}")
except Exception as e:
logger.error(f"Failed to send SSH notification: {e}", exc_info=True)
raise

View File

@ -77,7 +77,7 @@ def return_download_options(information:dict,track:str)->dict:
"addmetadata": True,
"postprocessors":[
{"api": "https://sponsor.ajay.app",
"categories":{"sponsor"},
"categories":["sponsor"],
"key": "SponsorBlock",
"when": "after_filter"
},
@ -86,7 +86,7 @@ def return_download_options(information:dict,track:str)->dict:
"key": "ModifyChapters",
"remove_chapters_patterns": [],
"remove_ranges": [],
"remove_sponsor_segments": {"sponsor"},
"remove_sponsor_segments": ["sponsor"],
"sponsorblock_chapter_title": "[SponsorBlock]: %(category_names)l"
},
{