Perun: Fixed yt-dlp options and properly passing the api key to curl
This commit is contained in:
parent
c05dd69cb8
commit
ab603c0d9a
@ -106,23 +106,30 @@ def send_notification_via_ssh(notification_title, notification_info):
|
|||||||
logger.debug(f"Notification payload: {json_payload}")
|
logger.debug(f"Notification payload: {json_payload}")
|
||||||
|
|
||||||
notification_cmd = (
|
notification_cmd = (
|
||||||
|
f"API_KEY=$(head -n1) && "
|
||||||
f"curl -s -X POST '{BACKEND_API_URL}' "
|
f"curl -s -X POST '{BACKEND_API_URL}' "
|
||||||
f"-H 'Content-Type: application/json' "
|
f"-H 'Content-Type: application/json' "
|
||||||
f"-H 'X-API-Key-Internal: $(head -n1)' "
|
f"-H \"X-API-Key-Internal: $API_KEY\" "
|
||||||
f"-d @-"
|
f"-d '{json_payload}'"
|
||||||
)
|
)
|
||||||
|
|
||||||
stdin, stdout, stderr = ssh.exec_command(notification_cmd)
|
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.flush()
|
||||||
stdin.channel.shutdown_write()
|
stdin.channel.shutdown_write()
|
||||||
|
|
||||||
|
exit_status = stdout.channel.recv_exit_status()
|
||||||
|
response_output = stdout.read().decode()
|
||||||
|
|
||||||
exit_status = stdout.channel.recv_exit_status()
|
exit_status = stdout.channel.recv_exit_status()
|
||||||
if exit_status == 0:
|
if exit_status == 0:
|
||||||
logger.info("Notification sent successfully")
|
logger.info("Notification sent successfully")
|
||||||
|
logger.debug(f"Response: {response_output}")
|
||||||
else:
|
else:
|
||||||
error_output = stderr.read().decode()
|
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:
|
except Exception as e:
|
||||||
logger.error(f"Failed to send SSH notification: {e}", exc_info=True)
|
logger.error(f"Failed to send SSH notification: {e}", exc_info=True)
|
||||||
raise
|
raise
|
||||||
@ -77,7 +77,7 @@ def return_download_options(information:dict,track:str)->dict:
|
|||||||
"addmetadata": True,
|
"addmetadata": True,
|
||||||
"postprocessors":[
|
"postprocessors":[
|
||||||
{"api": "https://sponsor.ajay.app",
|
{"api": "https://sponsor.ajay.app",
|
||||||
"categories":{"sponsor"},
|
"categories":["sponsor"],
|
||||||
"key": "SponsorBlock",
|
"key": "SponsorBlock",
|
||||||
"when": "after_filter"
|
"when": "after_filter"
|
||||||
},
|
},
|
||||||
@ -86,7 +86,7 @@ def return_download_options(information:dict,track:str)->dict:
|
|||||||
"key": "ModifyChapters",
|
"key": "ModifyChapters",
|
||||||
"remove_chapters_patterns": [],
|
"remove_chapters_patterns": [],
|
||||||
"remove_ranges": [],
|
"remove_ranges": [],
|
||||||
"remove_sponsor_segments": {"sponsor"},
|
"remove_sponsor_segments": ["sponsor"],
|
||||||
"sponsorblock_chapter_title": "[SponsorBlock]: %(category_names)l"
|
"sponsorblock_chapter_title": "[SponsorBlock]: %(category_names)l"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user