{
  "id": "014f2F9hjeY0Ixps",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "n8n Placeholdarr for Plex",
  "tags": [],
  "nodes": [
    {
      "id": "816067dc-1c5c-42e4-a6f6-06cdd6a92365",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        848,
        -224
      ],
      "parameters": {
        "options": {
          "responseCode": 200,
          "responseHeaders": {
            "entries": [
              {
                "name": "Content-Type",
                "value": " application/json"
              }
            ]
          }
        },
        "respondWith": "json",
        "responseBody": "={{ $('Format JustWatch results').all().map(item => item.json) }}"
      },
      "executeOnce": true,
      "typeVersion": 1.4
    },
    {
      "id": "625beae8-71a6-4b52-8cb6-022ee08ef7fd",
      "name": "Format JustWatch results",
      "type": "n8n-nodes-base.code",
      "position": [
        -128,
        -144
      ],
      "parameters": {
        "jsCode": "const edges = items[0].json.data.popularTitles.edges;\n\nreturn edges.map(edge => {\n  const node = edge.node;\n\n  return {\n    json: {\n      ...($('Webhook Arrs custom list JustWatch').first().json.params.objectType === \"MOVIE\" && {\n        id: Number(node.content.externalIds.tmdbId)\n      }),\n      imdbId: node.content.externalIds.imdbId\n    }\n  };\n});"
      },
      "executeOnce": false,
      "typeVersion": 2
    },
    {
      "id": "22af297a-8b1b-436c-aed6-4ebac97b93cb",
      "name": "Call JustWatch API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -592,
        128
      ],
      "parameters": {
        "url": "https://apis.justwatch.com/graphql",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n    \"operationName\": \"GetPopularTitles\",\n    \"variables\": {\n        \"first\": {{ $json.params.limit }},\n        \"popularTitlesSortBy\": \"POPULAR\",\n        \"sortRandomSeed\": 0,\n        \"offset\": null,\n        \"creditsRole\": \"DIRECTOR\",\n        \"after\": \"\",\n        \"popularTitlesFilter\": {\n            \"ageCertifications\": [],\n            \"excludeGenres\": [],\n            \"excludeProductionCountries\": [],\n            \"objectTypes\": [\n                \"{{ $json.params.objectType }}\"\n            ],\n            \"productionCountries\": [],\n            \"subgenres\": [],\n            \"genres\": [],\n            \"packages\": [\n                \"{{ $json.params.filter }}\"\n            ],\n            \"excludeIrrelevantTitles\": false,\n            \"presentationTypes\": [],\n            \"monetizationTypes\": [],\n            \"searchQuery\": \"\"\n        },\n        \"watchNowFilter\": {\n            \"packages\": [\n                \"{{ $json.params.filter }}\"\n            ],\n            \"monetizationTypes\": []\n        },\n        \"language\": \"en\",\n        \"country\": \"NL\"\n    },\n    \"query\": \"query GetPopularTitles($backdropProfile: BackdropProfile, $country: Country!, $first: Int! = 70, $format: ImageFormat, $language: Language!, $after: String, $popularTitlesFilter: TitleFilter, $popularTitlesSortBy: PopularTitlesSorting! = POPULAR, $profile: PosterProfile, $sortRandomSeed: Int! = 0, $watchNowFilter: WatchNowOfferFilter!, $offset: Int = 0, $creditsRole: CreditRole! = DIRECTOR) {\\n  popularTitles(\\n    country: $country\\n    filter: $popularTitlesFilter\\n    first: $first\\n    sortBy: $popularTitlesSortBy\\n    sortRandomSeed: $sortRandomSeed\\n    offset: $offset\\n    after: $after\\n  ) {\\n    __typename\\n    edges {\\n      cursor\\n      node {\\n        ...PopularTitleGraphql\\n        __typename\\n      }\\n      __typename\\n    }\\n    pageInfo {\\n      startCursor\\n      endCursor\\n      hasPreviousPage\\n      hasNextPage\\n      __typename\\n    }\\n    totalCount\\n  }\\n}\\n\\nfragment PopularTitleGraphql on MovieOrShow {\\n  __typename\\n  id\\n  objectId\\n  objectType\\n  content(country: $country, language: $language) {\\n      externalIds {\\n        tmdbId\\n    imdbId\\n      }\\n   title\\n    fullPath\\n    originalReleaseYear\\n    shortDescription\\n    interactions {\\n      likelistAdditions\\n      dislikelistAdditions\\n      __typename\\n    }\\n    scoring {\\n      imdbVotes\\n      imdbScore\\n      tmdbPopularity\\n      tmdbScore\\n      tomatoMeter\\n      certifiedFresh\\n      jwRating\\n      __typename\\n    }\\n    interactions {\\n      votesNumber\\n      __typename\\n    }\\n    dailymotionClips: clips(providers: [DAILYMOTION]) {\\n      sourceUrl\\n      externalId\\n      provider\\n      streamUrl\\n      __typename\\n    }\\n    posterUrl(profile: $profile, format: $format)\\n    ... on MovieOrShowOrSeasonContent {\\n      backdrops(profile: $backdropProfile, format: $format) {\\n        backdropUrl\\n        __typename\\n      }\\n      __typename\\n    }\\n    isReleased\\n    credits(role: $creditsRole) {\\n      name\\n      personId\\n      __typename\\n    }\\n    runtime\\n    genres {\\n      translation(language: $language)\\n      shortName\\n      __typename\\n    }\\n    __typename\\n  }\\n  likelistEntry {\\n    createdAt\\n    __typename\\n  }\\n  dislikelistEntry {\\n    createdAt\\n    __typename\\n  }\\n  watchlistEntryV2 {\\n    createdAt\\n    __typename\\n  }\\n  customlistEntries {\\n    createdAt\\n    __typename\\n  }\\n  freeOffersCount: offerCount(\\n    country: $country\\n    platform: WEB\\n    filter: {monetizationTypes: [FREE, ADS]}\\n  )\\n  watchNowOffer(country: $country, platform: WEB, filter: $watchNowFilter) {\\n    ...WatchNowOffer\\n    __typename\\n  }\\n  ... on Movie {\\n    seenlistEntry {\\n      createdAt\\n      __typename\\n    }\\n    __typename\\n  }\\n  ... on Show {\\n    tvShowTrackingEntry {\\n      createdAt\\n      __typename\\n    }\\n    seenState(country: $country) {\\n      seenEpisodeCount\\n      progress\\n      __typename\\n    }\\n    __typename\\n  }\\n}\\n\\nfragment WatchNowOffer on Offer {\\n  __typename\\n  id\\n  standardWebURL\\n  preAffiliatedStandardWebURL\\n  streamUrl\\n  package {\\n    id\\n    icon\\n    packageId\\n    clearName\\n    shortName\\n    technicalName\\n    iconWide(profile: S160)\\n    hasRectangularIcon(country: $country, platform: WEB)\\n    __typename\\n  }\\n  retailPrice(language: $language)\\n  retailPriceValue\\n  lastChangeRetailPriceValue\\n  currency\\n  presentationType\\n  monetizationType\\n  availableTo\\n  dateCreated\\n  newElementCount\\n}\\n\"\n}",
        "sendBody": true,
        "specifyBody": "json"
      },
      "executeOnce": true,
      "typeVersion": 4.2
    },
    {
      "id": "8039e353-f1d3-4a73-89b0-4c5d30c85670",
      "name": "Remove unmonitored tag",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        272,
        912
      ],
      "parameters": {
        "url": "=http://192.168.1.237:7878/api/v3/movie/editor",
        "method": "PUT",
        "options": {},
        "jsonBody": "={\n          \"movieIds\": [{{ $json.body.movie.id }}],\n          \"tags\": [8],\n          \"applyTags\": \"remove\"\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "notesInFlow": false,
      "retryOnFail": false,
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "e42ca5e0-2faa-4b32-b936-c75b1f05431b",
      "name": "If tag unmonitored exists",
      "type": "n8n-nodes-base.if",
      "position": [
        -32,
        928
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "2dc69335-707d-49bc-9619-cfc96f136229",
              "operator": {
                "type": "array",
                "operation": "contains",
                "rightType": "any"
              },
              "leftValue": "={{ $json.body.movie.tags }}",
              "rightValue": "dummy-unprocessed"
            },
            {
              "id": "03106293-e896-4d87-ac98-45acbd7b863b",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f87cdfc2-30fc-47df-8b0e-57e49512f516",
      "name": "If Radarr",
      "type": "n8n-nodes-base.if",
      "position": [
        -384,
        1008
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "5f57e6ef-c3fa-4127-bca7-6c490a05edb9",
              "operator": {
                "type": "object",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.body.movie }}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "26bdba3f-9d3c-41b8-8298-63d4963928da",
      "name": "If tag unmonitored exists Sonarr",
      "type": "n8n-nodes-base.if",
      "position": [
        -32,
        1104
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "2dc69335-707d-49bc-9619-cfc96f136229",
              "operator": {
                "type": "array",
                "operation": "contains",
                "rightType": "any"
              },
              "leftValue": "={{ $json.body.series.tags }}",
              "rightValue": "dummy-unprocessed"
            },
            {
              "id": "03106293-e896-4d87-ac98-45acbd7b863b",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "22a88278-8dfc-4f37-87f8-c3af8f8cbef8",
      "name": "Remove unmonitored tag Sonarr",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        256,
        1104
      ],
      "parameters": {
        "url": "=http://192.168.1.237:8989/api/v3/series/editor",
        "method": "PUT",
        "options": {},
        "jsonBody": "={\n          \"seriesIds\": [{{ $json.body.series.id }}],\n          \"tags\": [5],\n          \"applyTags\": \"remove\"\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "notesInFlow": false,
      "retryOnFail": false,
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "5e98925d-ba4d-4820-86d7-ed2f93f79f36",
      "name": "Webhook Arrs Dummy file update",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1056,
        1216
      ],
      "parameters": {
        "path": "bd5102ad-9dc5-4415-b779-89d002c6e448",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2
    },
    {
      "id": "77b1f379-da9a-42c2-83fb-5a87b2e101bb",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        448,
        592
      ],
      "parameters": {
        "height": 96,
        "content": "To-do: \nControleren of er geen dummy files meer zijn dan pas tag verwijderen."
      },
      "typeVersion": 1
    },
    {
      "id": "e71ea25f-7684-475f-bb4f-b4e7c62d2902",
      "name": "Switch eventType",
      "type": "n8n-nodes-base.switch",
      "position": [
        -800,
        1184
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Download",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "7752997b-3746-4386-88a1-68c305b40aee",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.body.eventType }}",
                    "rightValue": "Download"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "MovieAdded",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "1ab6c3fc-c6d6-4940-882c-cc839b48f25f",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.body.eventType }}",
                    "rightValue": "MovieAdded"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "SeriesAdd",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "4c985af1-84a0-47c7-8a55-8889cc08b333",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.body.eventType }}",
                    "rightValue": "SeriesAdd"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {
          "fallbackOutput": "none"
        }
      },
      "typeVersion": 3.2
    },
    {
      "id": "26b16a0c-15fc-458c-860d-11c69ae08d2b",
      "name": "Create dummy file for movie1",
      "type": "n8n-nodes-base.ssh",
      "position": [
        -224,
        1344
      ],
      "parameters": {
        "command": "=mkdir -p \"{{ $('Radarr movie').item.json.path }}\"\n\nffmpeg -ss 0 -i \"/mnt/user/Media/Plex/Placeholdarr/dummy-file.mp4\" \\\n  -t {{ Math.min($('Radarr movie').item.json.runtime * 60, 14400) }} -c copy \"{{ $('Radarr movie').item.json.path }}/dummy.mp4\"\n\nchmod -R 777 \"{{ $('Radarr movie').item.json.path }}\"\nchown -R nobody:users \"{{ $('Radarr movie').item.json.path }}\""
      },
      "credentials": {
        "sshPassword": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6d1e2297-fbdd-4d25-ae9b-b3dbefb3d6ca",
      "name": "Refresh movie1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        16,
        1344
      ],
      "parameters": {
        "url": "=http://192.168.1.237:7878/api/v3/command",
        "method": "POST",
        "options": {},
        "jsonBody": "={\"name\":\"RefreshMovie\",\"movieIds\":[{{ $('Radarr movie').item.json.id }}]}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "notesInFlow": false,
      "retryOnFail": false,
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "7854e9a9-5f77-4bf0-8f33-e3314572ac3a",
      "name": "Refresh series1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        272,
        1616
      ],
      "parameters": {
        "url": "=http://192.168.1.237:8989/api/v3/command",
        "method": "POST",
        "options": {},
        "jsonBody": "={\"name\":\"RefreshSeries\",\"seriesId\":{{ $('Sonarr series').item.json.id }}}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "notesInFlow": false,
      "retryOnFail": false,
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "47b6a9ef-06dc-4168-ad70-62da2fef0696",
      "name": "Refresh Plex",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        224,
        1344
      ],
      "parameters": {
        "url": "=http://192.168.1.237:32400/library/sections/7/refresh?path={{\n  encodeURIComponent(\n   $('Radarr movie').item.json.path\n)\n}}",
        "method": "POST",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "executeOnce": false,
      "typeVersion": 4.2
    },
    {
      "id": "d84732c8-09b7-4a9b-bf00-9449ec4c523b",
      "name": "Refresh Plex Series",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        560,
        1616
      ],
      "parameters": {
        "url": "=http://192.168.1.237:32400/library/sections/8/refresh?path={{\n  encodeURIComponent(\n  $('Sonarr series').item.json.path\n  )\n}}",
        "method": "POST",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "executeOnce": false,
      "typeVersion": 4.2
    },
    {
      "id": "bb3647c8-0586-4c3e-975a-120dda6f7b89",
      "name": "Sonarr runtime s01e01",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -208,
        1616
      ],
      "parameters": {
        "url": "=http://192.168.1.237:8989/api/v3/episode",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "seriesId",
              "value": "={{ $('Sonarr series').first().json.id }}"
            },
            {
              "name": "seasonNumber",
              "value": "1"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "notesInFlow": false,
      "retryOnFail": false,
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "33e771ed-2b6a-4046-9ffe-dd71df1577a7",
      "name": "Create dummy file for series with runtime",
      "type": "n8n-nodes-base.ssh",
      "position": [
        16,
        1616
      ],
      "parameters": {
        "command": "=mkdir -p \"{{ $('Webhook Arrs Dummy file update').item.json.body.series.path }}/Season 1\"\n\nffmpeg -ss 0 -i \"/mnt/user/Media/Plex/Placeholdarr/dummy-file.mp4\" \\\n  -t {{ Math.min($('Sonarr runtime s01e01').first().json.runtime * 60, 14400) }} -c copy \"{{ $('Webhook Arrs Dummy file update').item.json.body.series.path }}/Season 1/Dummy s01e01.mp4\"\n\nchmod -R 777 \"{{ $('Webhook Arrs Dummy file update').item.json.body.series.path }}\"\nchown -R nobody:users \"{{ $('Webhook Arrs Dummy file update').item.json.body.series.path }}\""
      },
      "credentials": {
        "sshPassword": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 1
    },
    {
      "id": "d743cb61-8351-4854-b668-b023432f19b6",
      "name": "Radarr movie",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -400,
        1344
      ],
      "parameters": {
        "url": "=http://192.168.1.237:7878/api/v3/movie/{{ $('Webhook Arrs Dummy file update').item.json.body.movie.id }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "notesInFlow": false,
      "retryOnFail": false,
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "1d5a3a61-c2af-4b1f-8d02-c32078368f21",
      "name": "Sonarr series",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -416,
        1616
      ],
      "parameters": {
        "url": "=http://192.168.1.237:8989/api/v3/series/{{ $('Webhook Arrs Dummy file update').item.json.body.series.id }}",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "seriesId",
              "value": "={{ $('Webhook Arrs Dummy file update').item.json.body.series.id }}"
            },
            {
              "name": "seasonNumber",
              "value": "1"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "notesInFlow": false,
      "retryOnFail": false,
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "eeda8469-cb18-458a-a12a-1bc21639aca7",
      "name": "Create dummy file",
      "type": "n8n-nodes-base.ssh",
      "position": [
        -848,
        1648
      ],
      "parameters": {
        "command": "=docker run --rm \\\n  --device /dev/dri \\\n  -v /mnt/user/Media/Plex:/mnt/user/Media/Plex \\\n  akashisn/ffmpeg:7.0.2 \\\n  -hwaccel qsv -f lavfi -i color=black:s=640x480:d=14400:r=1 \\\n  -loop 1 -t 120 -i /mnt/user/Media/Plex/Placeholdarr/dummy-download.png \\\n  -filter_complex \"[1:v]scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2:black[img];[0:v][img]overlay=enable='lte(t,120)'\" \\\n  -c:v h264_qsv -b:v 300k -pix_fmt yuv420p \\\n  \"/mnt/user/Media/Plex/Placeholdarr/dummy-file.mp4\""
      },
      "credentials": {
        "sshPassword": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "77e79179-fe4b-4c00-95db-59a25f399dfb",
      "name": "Search movie",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -112,
        2112
      ],
      "parameters": {
        "url": "=http://192.168.1.237:7878/api/v3/command",
        "method": "POST",
        "options": {},
        "jsonBody": "={\"name\":\"MoviesSearch\",\"movieIds\":[{{ $('Get Radarr information from tmdbId').item.json.id }}]}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "notesInFlow": false,
      "retryOnFail": false,
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "1454fdb3-6d54-402e-8595-83e9d00fe3e1",
      "name": "Respond 200",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        96,
        2112
      ],
      "parameters": {
        "options": {
          "responseCode": 200
        },
        "respondWith": "noData"
      },
      "typeVersion": 1.4
    },
    {
      "id": "ff692460-8be9-4f64-99e4-e233a6a7e1c2",
      "name": "Monitor movie",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -368,
        2112
      ],
      "parameters": {
        "url": "=http://192.168.1.237:7878/api/v3/movie/editor",
        "method": "PUT",
        "options": {},
        "jsonBody": "={\"monitored\": true, \"movieIds\":[{{ $('Get Radarr information from tmdbId').item.json.id }}]}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "notesInFlow": false,
      "retryOnFail": false,
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "46fcd496-4c0a-474c-ba8c-a8d694bc15a8",
      "name": "Respond ",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        320,
        2432
      ],
      "parameters": {
        "options": {
          "responseCode": 200
        },
        "respondWith": "noData"
      },
      "executeOnce": true,
      "typeVersion": 1.4
    },
    {
      "id": "2a1590b8-5e59-4835-8de4-5dca41c7da40",
      "name": "Monitor series",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -400,
        2336
      ],
      "parameters": {
        "url": "=http://192.168.1.237:8989/api/v3/series/{{ $json.id }}",
        "method": "PUT",
        "options": {},
        "jsonBody": "={{ Object.assign({}, $json, { \"monitored\": true }) }}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "notesInFlow": false,
      "retryOnFail": false,
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "96b3c1d1-c6e4-4915-bd9b-ad2bb940494b",
      "name": "Monitor all seasons",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -192,
        2336
      ],
      "parameters": {
        "url": "=http://192.168.1.237:8989/api/v3/seasonPass",
        "method": "POST",
        "options": {},
        "jsonBody": "={\"series\":[{\"id\":{{ $json.id }}}],\"monitoringOptions\":{\"monitor\":\"all\", \"monitorNewItems\": \"all\"}}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "notesInFlow": false,
      "retryOnFail": false,
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "6993d242-0e3d-4252-9f04-f6b80ecb02a1",
      "name": "If movie4",
      "type": "n8n-nodes-base.if",
      "position": [
        -880,
        2224
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "4ae3bfa3-1f34-4423-96d6-97e3ec90fb9b",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.body.media.type }}",
              "rightValue": "movie"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "53f09ea8-0ba4-4866-8705-b36add60e6c9",
      "name": "Get Radarr information from tmdbId",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -624,
        2112
      ],
      "parameters": {
        "url": "=http://192.168.1.237:7878/api/v3/movie?tmdbId={{ $json.body.media.ids.tmdb }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "notesInFlow": false,
      "retryOnFail": false,
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "e8da3276-5493-4605-a382-f4228d95cc8f",
      "name": "Get Sonarr information from tvdbId",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -640,
        2336
      ],
      "parameters": {
        "url": "=http://192.168.1.237:8989/api/v3/series?tvdbId={{ $json.body.media.ids.tvdb }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "notesInFlow": false,
      "retryOnFail": false,
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "53ecfd80-a81c-4976-ae4a-1ce6ba506bcc",
      "name": "Webhook Tautulli",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1120,
        2224
      ],
      "parameters": {
        "path": "9cc04992-377c-40fc-a0a9-810c08438224",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "0749d0c5-74c7-47d7-bfef-75aeaa088ebb",
      "name": "Check if collection is not empty",
      "type": "n8n-nodes-base.if",
      "position": [
        1056,
        -48
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "a8db1849-58af-4664-90a1-33c9db27458e",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $('Webhook Arrs custom list JustWatch').item.json.params.collectionId }}",
              "rightValue": ""
            }
          ]
        }
      },
      "executeOnce": true,
      "typeVersion": 2.2
    },
    {
      "id": "1c1ae591-c96e-41ba-968f-745ccefb1465",
      "name": "If objectType is movie",
      "type": "n8n-nodes-base.if",
      "position": [
        96,
        -64
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "be18535d-6e4b-42b1-a32a-a43cdd96ffac",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $('Webhook Arrs custom list JustWatch').item.json.params.objectType }}",
              "rightValue": "MOVIE"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "fd6fe507-a8b5-4d18-8617-8b106ecbcaa3",
      "name": "Respond to Webhook1",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        848,
        112
      ],
      "parameters": {
        "options": {
          "responseCode": 200,
          "responseHeaders": {
            "entries": [
              {
                "name": "Content-Type",
                "value": " application/json"
              }
            ]
          }
        },
        "respondWith": "json",
        "responseBody": "={{ $('Format JustWatch results add tvdbId').all().map(item => item.json) }}"
      },
      "executeOnce": true,
      "typeVersion": 1.4
    },
    {
      "id": "ff7cf84f-cf82-43f3-ba6c-5e753d401c2e",
      "name": "Format JustWatch results add tvdbId",
      "type": "n8n-nodes-base.code",
      "position": [
        512,
        144
      ],
      "parameters": {
        "jsCode": "return items.map(item => {\n  return {\n    json: {\n      tvdbId: String(item.json.tvdbId)\n    }\n  };\n});"
      },
      "typeVersion": 2
    },
    {
      "id": "18551931-2df8-44a2-9875-e49521d608ca",
      "name": "Sonarr serie lookup1",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        304,
        32
      ],
      "parameters": {
        "url": "=http://192.168.1.237:8989/api/v3/series/lookup?term={{ $json.imdbId }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "notesInFlow": false,
      "retryOnFail": false,
      "typeVersion": 4.2,
      "alwaysOutputData": true
    },
    {
      "id": "cae3b989-28b5-4c8a-96e6-474d73554621",
      "name": "Webhook Arrs custom list JustWatch",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -912,
        128
      ],
      "parameters": {
        "path": ":filter/:limit/:objectType/:collectionId",
        "options": {},
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "1217b066-2dab-47ae-bd05-e291b3d1d45f",
      "name": "Webhook Arrs custom list Trakt",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -912,
        384
      ],
      "parameters": {
        "path": ":username/:list/:limit/:objectType/:collectionId",
        "options": {},
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "264a1dfb-2bd8-4686-9b70-643aa452cf40",
      "name": "Call Trakt API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -656,
        384
      ],
      "parameters": {
        "url": "=https://api.trakt.tv/users/{{ $json.params.username }}/lists/{{ $json.params.list }}/items/movies",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 4.2
    },
    {
      "id": "7c648a25-cb1c-411b-8f80-7cf1ae35c7de",
      "name": "Format JustWatch results1",
      "type": "n8n-nodes-base.code",
      "position": [
        -432,
        384
      ],
      "parameters": {
        "jsCode": "const limit = $('Webhook Arrs custom list Trakt').first().json.params.limit || 100;\n\nreturn items.slice(0, limit).map(({ json }) => {\n  const movie = json.movie;\n\n  return {\n    json: {\n      id: Number(movie.ids.tmdb),\n      imdbId: movie.ids.imdb\n    }\n  };\n});\n"
      },
      "executeOnce": false,
      "typeVersion": 2
    },
    {
      "id": "b9178b4b-f165-4021-bac5-54a34d990013",
      "name": "Respond to Webhook2",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -128,
        432
      ],
      "parameters": {
        "options": {
          "responseCode": 200,
          "responseHeaders": {
            "entries": [
              {
                "name": "Content-Type",
                "value": "application/json"
              }
            ]
          }
        },
        "respondWith": "json",
        "responseBody": "={{ $('Format JustWatch results1').all().map(item => item.json) }}"
      },
      "executeOnce": true,
      "typeVersion": 1.4
    },
    {
      "id": "3a965e43-7abc-4ee3-af8f-7e1ab20d42f8",
      "name": "Get all items in collection1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2928,
        320
      ],
      "parameters": {
        "url": "=http://192.168.1.237:32400/library/collections/{{ $json.MediaContainer.Metadata[0].ratingKey }}/children",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 4.2
    },
    {
      "id": "03062dc7-10b6-4193-b75c-4042b9ecdb5f",
      "name": "Check if collection contains items1",
      "type": "n8n-nodes-base.if",
      "position": [
        3120,
        560
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "a54234bd-6c15-41b2-8c09-d6a35efce840",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ $('Get all items in collection1').item.json.MediaContainer.size }}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "3d411a66-a5ba-4cfe-8e61-203330f73473",
      "name": "Split Out Collection Items1",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        3296,
        272
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "MediaContainer.Metadata"
      },
      "typeVersion": 1
    },
    {
      "id": "a8d9bc15-4707-480f-ac20-5dcdde3bba97",
      "name": "Loop Over Items1",
      "type": "n8n-nodes-base.splitInBatches",
      "onError": "continueRegularOutput",
      "position": [
        3584,
        272
      ],
      "parameters": {
        "options": {}
      },
      "executeOnce": false,
      "typeVersion": 3
    },
    {
      "id": "160f4407-be37-464f-9c17-bc7013232aeb",
      "name": "Remove item from collection1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3840,
        288
      ],
      "parameters": {
        "url": "=http://192.168.1.237:32400/library/sections/{{ $('Get collection1').item.json.MediaContainer.librarySectionID }}/all?type=1&id={{ $json.ratingKey }}&includeExternalMedia=1&collection[].tag.tag-={{ encodeURIComponent($('Get collection1').item.json.MediaContainer.Metadata[0].title) }}",
        "method": "PUT",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "178927b9-459a-47b6-8f8e-cac49487870a",
      "name": "Get collection1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2496,
        384
      ],
      "parameters": {
        "url": "=http://192.168.1.237:32400/library/collections/{{ $json.collectionId }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "c00d0eed-6e07-4004-829d-2b9774a71087",
      "name": "Loop Over Items3",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        4272,
        576
      ],
      "parameters": {
        "options": {
          "reset": false
        }
      },
      "typeVersion": 3
    },
    {
      "id": "677ffe8c-2f71-4ce5-b011-9c5756e3abd7",
      "name": "Get GUID from imdbId",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4496,
        592
      ],
      "parameters": {
        "url": "=http://192.168.1.237:32400/library/metadata/{{ $('Set fields for collection').first().json.objectType == \"MOVIE\" ? 121583 : 117877 }}/matches?manual=1&title={{ $('Loop Over Items3').item.json.imdbId }}",
        "options": {},
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "d2ba9998-5b36-44a2-bd62-37ec6847ff94",
      "name": "Add item to collection2",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        5664,
        576
      ],
      "parameters": {
        "url": "=http://192.168.1.237:32400/library/collections/{{ $('Get collection1').first().json.MediaContainer.Metadata[0].ratingKey }}/items",
        "method": "PUT",
        "options": {
          "lowercaseHeaders": true
        },
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "uri",
              "value": "=server://14279b2fa6259250db471223f9a8fa2056e31c65/com.plexapp.plugins.library/library/metadata/{{ $json.MediaContainer.Metadata[0].ratingKey }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json, text/plain, */*"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2,
      "alwaysOutputData": true
    },
    {
      "id": "90e4e4db-335d-4402-8b55-f68f4b0481de",
      "name": "Add item to collection3",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        5184,
        464
      ],
      "parameters": {
        "url": "=http://192.168.1.237:32400/library/collections/{{ $('Get collection1').first().json.MediaContainer.Metadata[0].ratingKey }}/items",
        "method": "OPTIONS",
        "options": {
          "lowercaseHeaders": true
        },
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "uri",
              "value": "=server://14279b2fa6259250db471223f9a8fa2056e31c65/com.plexapp.plugins.library/library/metadata/{{ $json.MediaContainer.Metadata[0].ratingKey }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json, text/plain, */*"
            },
            {
              "name": "access-control-request-method",
              "value": "PUT"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2,
      "alwaysOutputData": true
    },
    {
      "id": "7aeda33a-58d7-4a62-991e-3654da9bc5b2",
      "name": "Get ratingKey from GUID1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4960,
        576
      ],
      "parameters": {
        "url": "=http://192.168.1.237:32400/library/all?guid={{ $json.MediaContainer.SearchResult[0].guid }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "ebbaf071-2bee-40a2-afe1-719acc9a8959",
      "name": "Move collection item2",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        6192,
        576
      ],
      "parameters": {
        "url": "=http://192.168.1.237:32400/library/collections/{{ $('Get collection1').first().json.MediaContainer.Metadata[0].ratingKey }}/items/{{ $json.MediaContainer.Metadata[0].ratingKey }}/move",
        "method": "PUT",
        "options": {
          "lowercaseHeaders": true
        },
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {}
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json, text/plain, */*"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2,
      "alwaysOutputData": true
    },
    {
      "id": "4206a64b-417f-4227-89a6-069b56022c22",
      "name": "If found Plex GUID1",
      "type": "n8n-nodes-base.if",
      "position": [
        4688,
        592
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "bd0f098a-9fee-46ad-8c82-8bf2d99583ad",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ $json.MediaContainer.size }}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "12ccd64d-4ea8-4d65-9778-f067866b2c12",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1504,
        -192
      ],
      "parameters": {
        "width": 528,
        "height": 944,
        "content": "## *Arrs Import List for Plex Collection\n### You can use either **Trakt.TV** lists or **JustWatch.com** lists to populate your Plex collections.  \n### Add a new import list inside your *Arrs application.\n### Once set up, choose one of the nodes in **n8n** to retrieve the flow URL (GUID).\n\n### JustWatch Webhook Format\n\n```http://127.0.0.1:5678/webhook/<Node_GUID>/<Provider_ID>/<Count>/<Type>/<Plex_Collection_ID>```\n\n\n- **Provider_ID**: Leave empty to include all, or use codes like `NFX` (Netflix), `ATP`, `DNP`, `PRV`, etc.\n- **Count**: Number of items to fetch.\n- **Type**: Use `MOVIE` or `SHOW`.\n- **Plex_Collection_ID**: The collection ID in Plex.\n\n---\n\n### Trakt.TV Webhook Format\n\n```http://192.168.1.237:5678/webhook/<Node_GUID>/<Trakt_Username>/<Trakt_List_Name>/<Count>/<Type>/<Plex_Collection_ID>```\n\n- **Trakt_Username**: Your Trakt.tv username.\n- **Trakt_List_Name**: The list name, e.g., `watchlist`, `favorites`, or a custom list.\n- **Count**: Number of items to fetch.\n- **Type**: Use `MOVIE` or `SHOW`.\n- **Plex_Collection_ID**: The collection ID in Plex.\n\n---\n\n### *Arrs Settings\n\nIn your *Arrs application (e.g., Radarr or Sonarr):\n\n- Add tags: `dummy`, `dummy-unprocessed`\n- **Disable** \"search on add\"\n- Set **monitor** to `none`\n"
      },
      "typeVersion": 1
    },
    {
      "id": "21f623a7-2cb7-47bf-ba01-71e511b05159",
      "name": "Merge1",
      "type": "n8n-nodes-base.merge",
      "position": [
        1440,
        368
      ],
      "parameters": {
        "mode": "chooseBranch",
        "useDataOfInput": 2
      },
      "typeVersion": 3.2
    },
    {
      "id": "6580c82a-1c1c-468d-9c6d-c57698ea4c8e",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        3984,
        576
      ],
      "parameters": {
        "jsCode": "//const items = $('When Executed by Another Workflow create Plex collection').first().json.data\n\n//return items.map(item => ({ json: item }));\n\nconst items = $('Set fields for collection').first().json.data;\n\nreturn items.reverse().map(item => ({ json: item }));\n"
      },
      "typeVersion": 2
    },
    {
      "id": "3b563589-1a7e-4b45-9901-4e2a3d243b08",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        5440,
        576
      ],
      "parameters": {
        "mode": "chooseBranch",
        "useDataOfInput": 2
      },
      "typeVersion": 3.2
    },
    {
      "id": "cec8d612-b961-4139-aa4d-7e22ff3e6fde",
      "name": "Merge2",
      "type": "n8n-nodes-base.merge",
      "position": [
        5888,
        576
      ],
      "parameters": {
        "mode": "chooseBranch",
        "useDataOfInput": 2
      },
      "typeVersion": 3.2
    },
    {
      "id": "9c5987df-1c2e-4c72-84a8-0d35714700b1",
      "name": "Create dummy file for movie",
      "type": "n8n-nodes-base.ssh",
      "position": [
        -832,
        1664
      ],
      "parameters": {
        "command": "=mkdir -p \"{{ $('Radarr movie').item.json.path }}\"\n\n//docker run --rm \\\n//  -v /mnt/user/Media/Plex:/mnt/user/Media/Plex \\\n//  akashisn/ffmpeg:7.0.2 \\\n//  -ss 0 -i \"/mnt/user/Media/Plex/Placeholdarr/dummy-file.mp4\" \\\n//  -t {{ Math.min($('Radarr movie').item.json.runtime * 60, 14400) }} -c //copy \"{{ $('Radarr movie').item.json.path }}/dummy.mp4\"\n\n\nffmpeg -ss 0 -i \"/mnt/user/Media/Plex/Placeholdarr/dummy-file.mp4\" \\\n  -t {{ Math.min($('Radarr movie').item.json.runtime * 60, 14400) }} -c copy \"{{ $('Radarr movie').item.json.path }}/dummy.mp4\"\n\nchmod -R 777 \"{{ $('Radarr movie').item.json.path }}\"\nchown -R nobody:users \"{{ $('Radarr movie').item.json.path }}\""
      },
      "credentials": {
        "sshPassword": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "d0df6640-6aaa-413b-8873-49bf532f93ce",
      "name": "Get Overseerr users",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        640,
        2208
      ],
      "parameters": {
        "url": "http://0.0.0.0:5055/api/v1/user",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "take",
              "value": "1000"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "969c7ef1-03d2-4507-8a23-2202e7d04d96",
      "name": "Filter Overseerr user",
      "type": "n8n-nodes-base.code",
      "position": [
        848,
        2208
      ],
      "parameters": {
        "jsCode": "const searchEmail = $('Webhook Tautulli').first().json.body.user_email;\nconst users = $json[\"results\"] || [];\nconst match = users.find(u => u.email.toLowerCase() === searchEmail.toLowerCase());\nif (match) {\n  return [{ json: match }];\n} else {\n  return [];\n}\n"
      },
      "typeVersion": 2
    },
    {
      "id": "d3a3fdf7-60e4-4caf-b141-aae32159c8c6",
      "name": "Check if Overseerr user is found",
      "type": "n8n-nodes-base.if",
      "position": [
        1088,
        2208
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "5a828786-9372-421f-97c8-16dda5fc3a02",
              "operator": {
                "type": "number",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.id }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "81f50586-3ac4-44b6-814d-10c5b057140d",
      "name": "Make Overseerr request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2032,
        2176
      ],
      "parameters": {
        "url": "http://0.0.0.0:5055/api/v1/request",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"mediaType\": \"{{ $('Webhook Tautulli').item.json.body.media.type === 'movie' ? 'movie' : 'tv' }}\",\n  \"mediaId\": {{ $('Webhook Tautulli').item.json.body.media.ids.tmdb }},\n  \"tvdbId\": {{ $('Webhook Tautulli').item.json.body.media.ids.tvdb }},\n  \"seasons\": [\n  ],\n  \"userId\": {{ $('Filter Overseerr user').item.json.id }}\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "e31c803c-65d1-4d1e-859e-12421c56b125",
      "name": "Get last 20 Overseerr requests from user",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1344,
        2192
      ],
      "parameters": {
        "url": "http://0.0.0.0:5055/api/v1/request",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "requestedBy",
              "value": "={{ $json.id }}"
            },
            {
              "name": "take",
              "value": "20"
            },
            {
              "name": "sort",
              "value": "added"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "c8c13788-8731-4a40-a806-844a14794030",
      "name": "Check if request already exists",
      "type": "n8n-nodes-base.code",
      "position": [
        1552,
        2192
      ],
      "parameters": {
        "jsCode": "const targetTmdbId = $('Webhook Tautulli').first().json.body.media.ids.tmdb;\nconst targetTvdbId = $('Webhook Tautulli').first().json.body.media.ids.tvdb;\n\nconst requests = $json.results || [];\n\nconst match = requests.find(r => {\n  const media = r.media || {};\n\n  const tmdb = media.tmdbId;\n  const tvdb = media.tvdbId;\n\n  // Altijd als string vergelijken om typeverschillen te voorkomen\n  const tmdbHit = tmdb != null && String(tmdb) === String(targetTmdbId);\n  const tvdbHit = tvdb != null && String(tvdb) === String(targetTvdbId);\n\n  return tmdbHit || tvdbHit;\n});\n\nif (match) {\n  return [{ json: match }];\n}\n\nreturn [];"
      },
      "typeVersion": 2,
      "alwaysOutputData": true
    },
    {
      "id": "6853798e-5cc7-4d80-bc38-bb964e84f119",
      "name": "Check if no existing request for media exist for Overseerr user",
      "type": "n8n-nodes-base.if",
      "position": [
        1760,
        2192
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "4cc89c3b-5e22-441a-8784-fc1980d11f41",
              "operator": {
                "type": "object",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "db815a78-9775-475c-a118-6ce8340509e3",
      "name": "Terminate Tautulli sessions for dummy",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1552,
        992
      ],
      "parameters": {
        "url": "http://0.0.0.0:8181/api/v2",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpQueryAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "cmd",
              "value": "terminate_session"
            },
            {
              "name": "session_key",
              "value": "={{ $json.session_key }}"
            },
            {
              "name": "message",
              "value": "De film of serie is beschikbaar om te kijken."
            }
          ]
        }
      },
      "credentials": {
        "httpQueryAuth": {
          "name": "<your credential>"
        },
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "54f60bf2-07f1-4293-a310-9b5109f10b6f",
      "name": "Get all active sessions for file",
      "type": "n8n-nodes-base.code",
      "position": [
        1312,
        1008
      ],
      "parameters": {
        "jsCode": "const targetFile = $('Webhook Arrs Dummy file update').first().json.body.deletedFiles[0].path;\n\n// Haal de JSON op van de vorige stap\nconst data = items[0].json; // in n8n is dit meestal de response al als object\n\n// Als jouw HTTP Request node een string geeft, gebruik dan:\n// const data = JSON.parse(items[0].json);\n\n// Pak de sessies array\nconst sessions = data?.response?.data?.sessions || [];\nconsole.log(sessions)\n\n// Filter de sessies\nconst matching = sessions.filter(s => s.file === targetFile);\n\n// n8n wil dat je een array van items teruggeeft\nreturn matching.map(s => ({ json: s }));"
      },
      "typeVersion": 2
    },
    {
      "id": "c8cc229c-a522-4178-b59c-b819bb4308a5",
      "name": "Monitor all seasons1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1200,
        1264
      ],
      "parameters": {
        "url": "=http://192.168.1.237:8989/api/v3/seasonPass",
        "method": "POST",
        "options": {},
        "jsonBody": "={\"series\":[{\"id\":{{ $('Webhook Arrs Dummy file update').item.json.body.series.id }}}],\"monitoringOptions\":{\"monitor\":\"all\", \"monitorNewItems\": \"all\"}}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "notesInFlow": false,
      "retryOnFail": false,
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "e191443d-1b66-4934-a3e0-0fa6fe7b53d4",
      "name": "Remove all dummy files",
      "type": "n8n-nodes-base.ssh",
      "position": [
        576,
        1264
      ],
      "parameters": {
        "command": "=find \"{{ $('Webhook Arrs Dummy file update').item.json.body.series.path }}\" -maxdepth 2 -type f -iname 'Dummy*' -exec rm -f {} \\;"
      },
      "credentials": {
        "sshPassword": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 1
    },
    {
      "id": "a96a9b23-cdd4-400c-8ba8-c9991d1cd2bb",
      "name": "If deletedFiles exist",
      "type": "n8n-nodes-base.if",
      "position": [
        816,
        992
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d06bf1e8-bc79-475c-b2ea-030887d32225",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $('Webhook Arrs Dummy file update').first().json.body.deletedFiles?.length > 0 }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "7834dda0-3a91-47c0-9cb5-8fc688d90bba",
      "name": "Get active Tautulli sessions",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1088,
        1008
      ],
      "parameters": {
        "url": "http://0.0.0.0:8181/api/v2",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpQueryAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "cmd",
              "value": "get_activity"
            }
          ]
        }
      },
      "credentials": {
        "httpQueryAuth": {
          "name": "<your credential>"
        },
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "37d56569-7336-4dc8-8cea-78dc37d9e24e",
      "name": "Refresh series",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        960,
        1264
      ],
      "parameters": {
        "url": "=http://192.168.1.237:8989/api/v3/command",
        "method": "POST",
        "options": {},
        "jsonBody": "={\"name\":\"RefreshSeries\",\"seriesId\":{{ $('Get Sonarr information for series').item.json.id }}}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "notesInFlow": false,
      "retryOnFail": false,
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "3b9fcd01-1a10-4bc5-9ffa-12b7c27cc27c",
      "name": "Get Sonarr information for series",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        768,
        1264
      ],
      "parameters": {
        "url": "=http://192.168.1.237:8989/api/v3/series/{{ $('Webhook Arrs Dummy file update').item.json.body.series.id }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "notesInFlow": false,
      "retryOnFail": false,
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "606671e3-bab5-4b2d-aed8-2f10630449a4",
      "name": "Search series2",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1456,
        1488
      ],
      "parameters": {
        "url": "=http://192.168.1.237:8989/api/v3/command",
        "method": "POST",
        "options": {},
        "jsonBody": "={\"name\":\"SeriesSearch\",\"seriesId\":{{ $('Webhook Arrs Dummy file update').item.json.body.series.id }}}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "notesInFlow": false,
      "retryOnFail": false,
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "65351cd1-ff9a-4f7c-8ce1-e5ec0753beb1",
      "name": "Search series season",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1584,
        1600
      ],
      "parameters": {
        "url": "=http://192.168.1.237:8989/api/v3/command",
        "method": "POST",
        "options": {},
        "jsonBody": "={\"name\":\"SeriesSearch\",\"seriesId\":{{ $('Webhook Arrs Dummy file update').item.json.body.series.id }}}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "notesInFlow": false,
      "retryOnFail": false,
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "6de449f2-0240-47fd-998d-b695f66e2dfc",
      "name": "Code1",
      "type": "n8n-nodes-base.code",
      "position": [
        -336,
        2576
      ],
      "parameters": {
        "jsCode": "const data = $('Get Sonarr information from tvdbId').first().json\n\n// Pak alle seizoennummers\nconst seasonNumbers = data.seasons.map(season => season.seasonNumber);\n\n// Maak voor elk seizoen een apart item\nreturn seasonNumbers.map(num => {\n  return { json: { season: num } };\n});"
      },
      "typeVersion": 2
    },
    {
      "id": "bb42cbaf-6db3-4de6-990f-ac41ef0e0c04",
      "name": "Merge3",
      "type": "n8n-nodes-base.merge",
      "position": [
        0,
        2496
      ],
      "parameters": {
        "mode": "chooseBranch",
        "useDataOfInput": 2
      },
      "typeVersion": 3.2
    },
    {
      "id": "dbceee71-94b4-4bdf-8eec-bf064d983f34",
      "name": "Search season pack",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        176,
        2544
      ],
      "parameters": {
        "url": "=http://192.168.1.237:8989/api/v3/command",
        "method": "POST",
        "options": {},
        "jsonBody": "={\"name\":\"SeasonSearch\",\"seriesId\":{{ $('Get Sonarr information from tvdbId').item.json.id }},\"seasonNumber\":{{ $json.season }}}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "notesInFlow": false,
      "retryOnFail": false,
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "ad7dc89b-ebe1-4af3-a1e3-68ba31c0eebc",
      "name": "Search season pack1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1456,
        1264
      ],
      "parameters": {
        "url": "=http://192.168.1.237:8989/api/v3/command",
        "method": "POST",
        "options": {},
        "jsonBody": "={\"name\":\"SeasonSearch\",\"seriesId\":{{ $('Webhook Arrs Dummy file update').item.json.body.series.id }},\"seasonNumber\":1}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "notesInFlow": false,
      "retryOnFail": false,
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "1c83e819-0680-4619-b6d7-5678d038950c",
      "name": "Set fields for collection",
      "type": "n8n-nodes-base.set",
      "position": [
        1920,
        368
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "d9e74177-6b9b-4d03-acfe-93cc0eab8d53",
              "name": "collectionId",
              "type": "string",
              "value": "={{   (() => {     try {       return $('Webhook Arrs custom list JustWatch').first().json.params.collectionId;     } catch (e) {       return $('Webhook Arrs custom list Trakt').first().json.params.collectionId;     }   })() }}"
            },
            {
              "id": "39cb87cc-8bd9-4c8c-8197-2250a897522b",
              "name": "objectType",
              "type": "string",
              "value": "={{   (() => {     try {       return $('Webhook Arrs custom list JustWatch').first().json.params.objectType;     } catch (e) {       return $('Webhook Arrs custom list Trakt').first().json.params.objectType;     }   })() }}"
            },
            {
              "id": "b8f13781-f371-4501-9aaf-337b748a6ffc",
              "name": "data",
              "type": "array",
              "value": "={{ $items().map(i => i.json) }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "bac5380e-95fc-4e8a-8c01-be3014c53ed5",
      "name": "Wait 5 minutes before process collection in Plex",
      "type": "n8n-nodes-base.wait",
      "position": [
        2240,
        368
      ],
      "parameters": {
        "unit": "minutes"
      },
      "typeVersion": 1.1
    },
    {
      "id": "3af82c29-95b0-4a1e-948f-da0d7d3c4fd3",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1520,
        -1168
      ],
      "parameters": {
        "width": 784,
        "height": 736,
        "content": "## n8n Placeholdarr for Plex (BETA)\n\n### This flow creates **dummy files** for every item added in your *Arrs (Radarr/Sonarr) with the tag `unprocessed-dummy`.\n### It\u2019s useful for maintaining a large Plex library **without needing the actual movies or shows to be present on your Debrid provider**.\n\n### How It Works\n- When a dummy file is played, the corresponding item is automatically **monitored in *Arr** and added to the download queue.\n- This ensures that the content becomes available within **~3 minutes** for playback.\n- If the content finishes downloading **while the dummy is still being played**, **Tautulli** triggers a webhook that **stops the stream** and notifies the user.\n\n---\n\n### Requirements\n\n- Each n8n node must have the correct **URL** and **authorization headers** configured.\n- The **SSH host** (used to create dummy files) must have **FFmpeg** installed.\n- A **Trakt.TV API key** is required if you're using **Trakt collections**.\n\n---\n\n### Warning\n\n> \u26a0\ufe0f This flow is currently in **BETA** and under active development.  \n> It is **not recommended** for users without technical experience.  \n> Keep an eye on the GitHub repository for updates."
      },
      "typeVersion": 1
    },
    {
      "id": "ffee172c-f735-4d16-bceb-a6b05490e78f",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -64,
        1536
      ],
      "parameters": {
        "content": "If your SSH can't run FFMPEG just copy the dummy file to the dummy folder (To-do)"
      },
      "typeVersion": 1
    },
    {
      "id": "dbd35e8a-ad95-4f89-88f5-5f83d2fa9a94",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1664,
        1088
      ],
      "parameters": {
        "width": 528,
        "height": 400,
        "content": "## *Arrs Connect Webhook\n\nPaste the following URL into your *Arrs application under **Notification Triggers**:\n\n- On File Import  \n- On File Update  \n- On Movie Added  \n\nSet the **Tag** to `dummy-unprocessed` and choose the **POST** method.\n\n---\n\n### Purpose\n\nThis webhook triggers a flow that automatically creates a \"dummy\" file for any new item with the `dummy-unprocessed` tag."
      },
      "typeVersion": 1
    },
    {
      "id": "e44d1c92-0468-4975-b4cd-c768bd73b841",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1744,
        2032
      ],
      "parameters": {
        "width": 560,
        "height": 704,
        "content": "## Tautulli Webhook\n\nCreate a new **Notification Agent** in Tautulli and connect it to the following URL.\n\n- **Webhook Method**: `POST`  \n- **Trigger**: `Playback Start`  \n- **Condition**: Filename contains `dummy`\n\n---\n\n### Payload (Playback Start)\n\n```json\n{\n  \"event\": \"playback.start\",\n  \"user_email\": \"{user_email}\",\n  \"user_id\": \"{user_id}\",\n  \"media\": {\n    \"type\": \"{media_type}\",\n    \"title\": \"{title}\",\n    \"show_name\": \"{show_name}\",\n    \"episode_name\": \"{episode_name}\",\n    \"season_num\": \"{season_num}\",\n    \"episode_num\": \"{episode_num}\",\n    \"year\": \"{year}\",\n    \"ids\": {\n      \"plex\": \"{rating_key}\",\n      \"tmdb\": \"{themoviedb_id}\",\n      \"tvdb\": \"{thetvdb_id}\",\n      \"imdb\": \"{imdb_id}\"\n    },\n    \"file_info\": {\n      \"path\": \"{file}\"\n    }\n  }\n}\n"
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "00e0770c-72d4-4ca1-87c3-cd78a02d550d",
  "connections": {
    "Code": {
      "main": [
        [
          {
            "node": "Loop Over Items3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code1": {
      "main": [
        [
          {
            "node": "Merge3",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Code2": {
      "main": [
        [
          {
            "node": "Loop Over Items4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Add item to collection2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge1": {
      "main": [
        [
          {
            "node": "Set fields for collection",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge2": {
      "main": [
        [
          {
            "node": "Move collection item2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge3": {
      "main": [
        [
          {
            "node": "Search season pack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Respond ": {
      "main": [
        [
          {
            "node": "Get Overseerr users",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Radarr": {
      "main": [
        [
          {
            "node": "If tag unmonitored exists",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "If tag unmonitored exists Sonarr",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If movie4": {
      "main": [
        [
          {
            "node": "Get Radarr information from tmdbId",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Sonarr information from tvdbId",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Respond 200": {
      "main": [
        [
          {
            "node": "Get Overseerr users",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Radarr movie": {
      "main": [
        [
          {
            "node": "Create dummy file for movie1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search movie": {
      "main": [
        [
          {
            "node": "Respond 200",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Monitor movie": {
      "main": [
        [
          {
            "node": "Search movie",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sonarr series": {
      "main": [
        [
          {
            "node": "Sonarr runtime s01e01",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Call Trakt API": {
      "main": [
        [
          {
            "node": "Format JustWatch results1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Monitor series": {
      "main": [
        [
          {
            "node": "Monitor all seasons",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Refresh movie1": {
      "main": [
        [
          {
            "node": "Refresh Plex",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Refresh series": {
      "main": [
        [
          {
            "node": "Monitor all seasons1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get collection1": {
      "main": [
        [
          {
            "node": "Get all items in collection1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Refresh series1": {
      "main": [
        [
          {
            "node": "Refresh Plex Series",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items1": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Remove item from collection1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items3": {
      "main": [
        [],
        [
          {
            "node": "Get GUID from imdbId",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch eventType": {
      "main": [
        [
          {
            "node": "If Radarr",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Radarr movie",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Sonarr series",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook Tautulli": {
      "main": [
        [
          {
            "node": "If movie4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Call JustWatch API": {
      "main": [
        [
          {
            "node": "Format JustWatch results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Respond to Webhook": {
      "main": [
        [
          {
            "node": "Check if collection is not empty",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search season pack": {
      "main": [
        [
          {
            "node": "Respond ",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Overseerr users": {
      "main": [
        [
          {
            "node": "Filter Overseerr user",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If found Plex GUID1": {
      "main": [
        [
          {
            "node": "Get ratingKey from GUID1",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Monitor all seasons": {
      "main": [
        [
          {
            "node": "Merge3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Respond to Webhook1": {
      "main": [
        [
          {
            "node": "Check if collection is not empty",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Respond to Webhook2": {
      "main": [
        []
      ]
    },
    "Get GUID from imdbId": {
      "main": [
        [
          {
            "node": "If found Plex GUID1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Monitor all seasons1": {
      "main": [
        [
          {
            "node": "Search season pack1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sonarr serie lookup1": {
      "main": [
        [
          {
            "node": "Format JustWatch results add tvdbId",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Overseerr user": {
      "main": [
        [
          {
            "node": "Check if Overseerr user is found",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If deletedFiles exist": {
      "main": [
        [
          {
            "node": "Get active Tautulli sessions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Move collection item2": {
      "main": [
        [
          {
            "node": "Loop Over Items3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sonarr runtime s01e01": {
      "main": [
        [
          {
            "node": "Create dummy file for series with runtime",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If objectType is movie": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Sonarr serie lookup1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove all dummy files": {
      "main": [
        [
          {
            "node": "Get Sonarr information for series",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove unmonitored tag": {
      "main": [
        [
          {
            "node": "If deletedFiles exist",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add item to collection2": {
      "main": [
        [
          {
            "node": "Merge2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add item to collection3": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format JustWatch results": {
      "main": [
        [
          {
            "node": "If objectType is movie",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge1",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Get ratingKey from GUID1": {
      "main": [
        [
          {
            "node": "Add item to collection3",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          },
          {
            "node": "Merge2",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Format JustWatch results1": {
      "main": [
        [
          {
            "node": "Respond to Webhook2",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge1",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "If tag unmonitored exists": {
      "main": [
        [
          {
            "node": "Remove unmonitored tag",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "If deletedFiles exist",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set fields for collection": {
      "main": [
        [
          {
            "node": "Wait 5 minutes before process collection in Plex",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Collection Items1": {
      "main": [
        [
          {
            "node": "Loop Over Items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create dummy file for movie1": {
      "main": [
        [
          {
            "node": "Refresh movie1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get active Tautulli sessions": {
      "main": [
        [
          {
            "node": "Get all active sessions for file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get all items in collection1": {
      "main": [
        [
          {
            "node": "Check if collection contains items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove item from collection1": {
      "main": [
        [
          {
            "node": "Loop Over Items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove unmonitored tag Sonarr": {
      "main": [
        [
          {
            "node": "Remove all dummy files",
            "type": "main",
            "index": 0
          },
          {
            "node": "If deletedFiles exist",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook Arrs Dummy file update": {
      "main": [
        [
          {
            "node": "Switch eventType",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook Arrs custom list Trakt": {
      "main": [
        [
          {
            "node": "Call Trakt API",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if request already exists": {
      "main": [
        [
          {
            "node": "Check if no existing request for media exist for Overseerr user",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if Overseerr user is found": {
      "main": [
        [
          {
            "node": "Get last 20 Overseerr requests from user",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if collection is not empty": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get all active sessions for file": {
      "main": [
        [
          {
            "node": "Terminate Tautulli sessions for dummy",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If tag unmonitored exists Sonarr": {
      "main": [
        [
          {
            "node": "Remove unmonitored tag Sonarr",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "If deletedFiles exist",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Sonarr information for series": {
      "main": [
        [
          {
            "node": "Refresh series",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Radarr information from tmdbId": {
      "main": [
        [
          {
            "node": "Monitor movie",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Sonarr information from tvdbId": {
      "main": [
        [
          {
            "node": "Monitor series",
            "type": "main",
            "index": 0
          },
          {
            "node": "Code1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook Arrs custom list JustWatch": {
      "main": [
        [
          {
            "node": "Call JustWatch API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if collection contains items1": {
      "main": [
        [
          {
            "node": "Split Out Collection Items1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format JustWatch results add tvdbId": {
      "main": [
        [
          {
            "node": "Respond to Webhook1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge1",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Get last 20 Overseerr requests from user": {
      "main": [
        [
          {
            "node": "Check if request already exists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create dummy file for series with runtime": {
      "main": [
        [
          {
            "node": "Refresh series1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 5 minutes before process collection in Plex": {
      "main": [
        [
          {
            "node": "Get collection1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if no existing request for media exist for Overseerr user": {
      "main": [
        [
          {
            "node": "Make Overseerr request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}