diff --git a/src/perun/ssh_helper.py b/src/perun/ssh_helper.py index be2a53c..e872202 100644 --- a/src/perun/ssh_helper.py +++ b/src/perun/ssh_helper.py @@ -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 \ No newline at end of file diff --git a/src/perun/youtube_handler.py b/src/perun/youtube_handler.py index 3591c28..8035559 100644 --- a/src/perun/youtube_handler.py +++ b/src/perun/youtube_handler.py @@ -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" }, {