From 7b62d737535a638cab122522948f4eb98d0de811 Mon Sep 17 00:00:00 2001 From: SBCrumb Date: Fri, 24 Oct 2025 16:35:11 -0400 Subject: [PATCH] feat: update maintarr payload --- MAINTAINARR_WEBHOOK.md | 21 ++++++++++++++++----- api/routes.py | 16 +++++++++++++++- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/MAINTAINARR_WEBHOOK.md b/MAINTAINARR_WEBHOOK.md index 039df40..0adb287 100644 --- a/MAINTAINARR_WEBHOOK.md +++ b/MAINTAINARR_WEBHOOK.md @@ -38,12 +38,14 @@ Copy and paste this JSON template into the "Json Payload" field: { "notification_type": "{{notification_type}}", "subject": "{{subject}}", - "message": "{{message}} - IMDb: {{extra}}", + "message": "{{message}}", "extra": "{{extra}}" } ``` -**Important**: Make sure to include the IMDb ID in either the `{{message}}` or `{{extra}}` fields for NFOGuard to identify the media. The webhook handler will extract the IMDb ID from these fields. +**Important Note**: Maintainarr's template variables may not include IMDb IDs directly. The webhook will attempt to extract IMDb IDs from the notification content, but this may require manual configuration or rule setup in Maintainarr to include IMDb IDs in the notification text. + +**Alternative Approach**: If Maintainarr doesn't provide IMDb IDs in notifications, you may need to use NFOGuard's manual cleanup tools or configure Maintainarr rules to include IMDb information in the message content. #### Event Types Select these notification types: @@ -148,18 +150,27 @@ INFO: Maintainarr cleanup: Media Removed - Movie 'Example Movie' (tt1234567). Re ### Common Issues -1. **Media Not Found**: +1. **No IMDb ID Found**: + - Maintainarr template variables may not include IMDb IDs + - Check if the notification message contains IMDb information + - You may need to manually include IMDb IDs in Maintainarr rule configurations + +2. **Media Not Found**: - Check if the media exists in NFOGuard's database - Verify the IMDb ID matches between Maintainarr and NFOGuard -2. **Connection Issues**: +3. **Connection Issues**: - Ensure NFOGuard core container is accessible on port 8080 - Check firewall settings and network connectivity -3. **Authentication Errors**: +4. **Authentication Errors**: - No authentication is required for the webhook endpoint - Ensure you're using the core container port, not web interface port +5. **Test Notifications**: + - Test notifications (like the one you just sent) will be acknowledged but not processed + - Real media removal events will trigger the cleanup process + ### Testing the Webhook You can test the webhook manually using curl: diff --git a/api/routes.py b/api/routes.py index 2da3adf..a1f8876 100644 --- a/api/routes.py +++ b/api/routes.py @@ -341,8 +341,22 @@ async def maintainarr_webhook(request: Request, background_tasks: BackgroundTask print(f"INFO: Received Maintainarr webhook: {webhook.notification_type}") print(f"DEBUG: Full Maintainarr webhook payload: {payload}") - # Only process media removal notifications + # Handle test notifications differently for debugging notification_type = webhook.notification_type or "" + if notification_type == "TEST_NOTIFICATION": + return { + "status": "test_received", + "message": "Test notification received successfully", + "available_fields": { + "notification_type": webhook.notification_type, + "subject": webhook.subject, + "message": webhook.message, + "extra": webhook.extra + }, + "debug": "This is a test notification. Real media removal events will be processed when they occur." + } + + # Only process media removal notifications if "removed" not in notification_type.lower() and "delete" not in notification_type.lower(): return {"status": "ignored", "reason": f"Notification type '{notification_type}' not processed"}