{
  "name": "Media",
  "nodes": [
    {
      "parameters": {
        "url": "http://192.168.199.99:26000/movie",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "name",
              "value": "={{ $json.query.name }}"
            },
            {
              "name": "year",
              "value": "={{ $json.query.year }}"
            }
          ]
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "application/json"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        40,
        -320
      ],
      "id": "160ddb71-41cb-4646-afb1-2929f255fd49",
      "name": "IMDB_ID",
      "notesInFlow": false,
      "onError": "continueErrorOutput"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://radarr.cn/api/v3/movie",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpQueryAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "application/json"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n    \"title\": \"add_movie\",\n    \"qualityProfileId\": {{ $json.quality }},\n    \"tmdbId\": {{ $json.id }},\n    \"rootFolderPath\": \"/video/Movies\",\n    \"addOptions\": {\n        \"ignoreEpisodesWithFiles\": true,\n        \"ignoreEpisodesWithoutFiles\": true,\n        \"monitor\": \"movieOnly\",\n        \"searchForMovie\": false,\n        \"addMethod\": \"manual\"\n    }\n}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        560,
        -360
      ],
      "id": "d0c2e821-5268-4e7f-9879-e94ef6f77bba",
      "name": "Radarr_API",
      "notesInFlow": false,
      "credentials": {
        "httpQueryAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "path": "douban",
        "responseMode": "responseNode",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        -380,
        -220
      ],
      "id": "4fcf3a31-3dd3-4fe7-a996-84f6049ae524",
      "name": "Webhook"
    },
    {
      "parameters": {
        "respondWith": "text",
        "responseBody": "={{ $('IMDB_ID').item.json.title }} {{ $('IMDB_ID').item.json.year }}\uff08{{ $('IMDB_ID').item.json.id }}\uff09\u6dfb\u52a0\u6210\u529f\uff01",
        "options": {}
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        800,
        -360
      ],
      "id": "fab7a3da-d138-45f7-8400-e86c765ec86a",
      "name": "Succeeded",
      "alwaysOutputData": false
    },
    {
      "parameters": {
        "respondWith": "text",
        "responseBody": "\u8c46\u74e3\u8bf7\u6c42\u53c2\u6570\uff08name,year\uff09\u4e0d\u6b63\u786e\uff0c\u8bf7\u6c42\u5931\u8d25\uff01",
        "options": {}
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        40,
        -100
      ],
      "id": "5ea0f6ca-f74b-4e3b-9678-6dd877f4d00c",
      "name": "douban_Failed",
      "alwaysOutputData": false
    },
    {
      "parameters": {
        "respondWith": "text",
        "responseBody": "=IMDB\u67e5\u8be2\u5931\u8d25\uff01\uff08{{ $json.title }}{{ $json.error.message }}\uff09",
        "options": {}
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        540,
        -100
      ],
      "id": "b3e72ac8-77b2-4cc6-b383-97315e30a0b8",
      "name": "IMDB_Failed",
      "alwaysOutputData": false
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "89bc39a6-b3cc-49c3-b961-db0c75c5478a",
              "leftValue": "={{ $json.id }}",
              "rightValue": "",
              "operator": {
                "type": "number",
                "operation": "exists",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        280,
        -340
      ],
      "id": "ca63eeed-6101-4dd6-8bee-ae1a91057525",
      "name": "IMDB_IF"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "b2a1ce7c-f51f-49d1-9d75-2e871edfc120",
              "leftValue": "={{ $json.query.name }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              }
            },
            {
              "id": "d48120c9-b5ce-4f98-916f-152f66dbf13e",
              "leftValue": "={{ $json.query.year }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -160,
        -220
      ],
      "id": "99ccca96-a6c9-417c-9fb7-a484e7696ae1",
      "name": "DOUBAN_IF",
      "notesInFlow": false,
      "alwaysOutputData": false
    },
    {
      "parameters": {
        "content": "## \u5904\u7406\u6d41\u7a0b\n- \u8f6e\u8be2\u8c46\u74e3\u201c\u60f3\u770b\u201d\uff0c\u8fd4\u56dename\uff08\u5fc3\u4e4b\u5168\u8680 / Total Eclipse / \u5168\u8680\u72c2\u7231(\u53f0) / Eclipse totale\uff09\uff0cyear\n- Webhook\u63a5\u6536\uff0cIMDB_ID\u5904\u7406name\u5206\u5272\uff0c\u5224\u65ad\u8fd4\u56detitle\u662f\u5426\u5728name\u4e2d\uff0c\u8fd4\u56deID\n- Radarr\u6dfb\u52a0\n## \u8bf4\u660e \n- \u8c46\u74e3\u5b9a\u65f6\u67e5\u8be2\u201c\u60f3\u770b\u201d\u5217\u8868\u90e8\u7f72\u5728Openwrt\n- IMDB_ID\u67e5\u8be2\u90e8\u7f72\u5728fnOS,imdb-api.service\u670d\u52a1",
        "height": 220,
        "width": 640
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -640,
        -640
      ],
      "id": "ca8a474a-6c02-46a1-92c0-945522447137",
      "name": "Sticky Note"
    }
  ],
  "connections": {
    "IMDB_ID": {
      "main": [
        [
          {
            "node": "IMDB_IF",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "IMDB_Failed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "DOUBAN_IF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Radarr_API": {
      "main": [
        [
          {
            "node": "Succeeded",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IMDB_IF": {
      "main": [
        [
          {
            "node": "Radarr_API",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "IMDB_Failed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "DOUBAN_IF": {
      "main": [
        [
          {
            "node": "IMDB_ID",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "douban_Failed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "43afc3cd-89a3-4046-a7aa-a74ef6ccb87d",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "8zsOu2dmwzeQyDkD",
  "tags": []
}