diff --git a/n8n/FileBot_Main.json b/n8n/FileBot_Main.json deleted file mode 100644 index 06d77f2..0000000 --- a/n8n/FileBot_Main.json +++ /dev/null @@ -1,977 +0,0 @@ -{ - "name": "FileBot", - "nodes": [ - { - "parameters": { - "httpMethod": "POST", - "path": "b7c3b93a-1a93-47ad-afdf-ea54a131c064", - "options": {} - }, - "type": "n8n-nodes-base.webhook", - "typeVersion": 2.1, - "position": [ - -752, - -320 - ], - "id": "f5b64bb7-8ba5-4c0b-bba0-45961748afd3", - "name": "Webhook", - "webhookId": "b7c3b93a-1a93-47ad-afdf-ea54a131c064" - }, - { - "parameters": { - "content": "## FileBot Binding\n[Link](https://www.filebot.net/naming.html#bindings)", - "height": 80, - "width": 208 - }, - "type": "n8n-nodes-base.stickyNote", - "typeVersion": 1, - "position": [ - -784, - -512 - ], - "id": "feb198cd-4c0c-43f0-9458-e7a2445a057e", - "name": "Sticky Note" - }, - { - "parameters": { - "schema": { - "__rl": true, - "value": "n8n", - "mode": "list", - "cachedResultName": "n8n" - }, - "table": { - "__rl": true, - "value": "movie_files", - "mode": "list", - "cachedResultName": "movie_files" - }, - "columns": { - "mappingMode": "defineBelow", - "value": { - "movie_rating": "={{ $json.body.movie_rating }}", - "file_name_original": "={{ $json.body.FileNameOriginal }}", - "file_name_new": "={{ $json.body.FileNameNew }}", - "movie_votes": "={{ $json.body.movie_votes }}", - "video_compression_format": "={{ $json.body.video_compression_format }}", - "container_format": "={{ $json.body.container_format }}", - "audio_codec": "={{ $json.body.audio_codec }}", - "video_codec_library": "={{ $json.body.video_codec_library }}", - "standard_video_format": "={{ $json.body.standard_video_format }}", - "fourk_resolution": "={{ $json.body.fourk_resolution }}", - "exact_video_format": "={{ $json.body.exact_video_format }}", - "audio_bitrate": "={{ $json.body.audio_bitrate }}", - "video_bitrate": "={{ $json.body.video_bitrate }}", - "overall_bitrate": "={{ $json.body.overall_bitrate }}", - "dolby_vision": "={{ $json.body.dolby_vision }}", - "high_dynamic_range": "={{ $json.body.high_dynamic_range }}", - "video_bitdepth": "={{ $json.body.video_bitdepth }}", - "video_height": "={{ $json.body.video_height }}", - "video_width": "={{ $json.body.video_width }}", - "video_resolution": "={{ $json.body.video_resolution }}", - "audio_channel_layout": "={{ $json.body.audio_channel_layout }}", - "audio_channel_count": "={{ $json.body.audio_channel_count }}", - "audio_channel_format": "={{ $json.body.audio_channel_format }}", - "audio_codec_profile": "={{ $json.body.audio_codec_profile }}", - "themoviedb_id": "={{ $json.body.themoviedb_id }}", - "imdb_id": "={{ $json.body.imdb_id }}", - "thetvdb_id": "={{ $json.body.thetvdb_id }}", - "object_type": "={{ $json.body.object_type }}" - }, - "matchingColumns": [ - "id" - ], - "schema": [ - { - "id": "id", - "displayName": "id", - "required": false, - "defaultMatch": true, - "display": true, - "type": "number", - "canBeUsedToMatch": true, - "removed": true - }, - { - "id": "file_name_original", - "displayName": "file_name_original", - "required": true, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "file_name_new", - "displayName": "file_name_new", - "required": true, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "movie_rating", - "displayName": "movie_rating", - "required": false, - "defaultMatch": false, - "display": true, - "type": "number", - "canBeUsedToMatch": true - }, - { - "id": "movie_votes", - "displayName": "movie_votes", - "required": false, - "defaultMatch": false, - "display": true, - "type": "number", - "canBeUsedToMatch": true - }, - { - "id": "video_compression_format", - "displayName": "video_compression_format", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "video_codec_library", - "displayName": "video_codec_library", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "audio_codec", - "displayName": "audio_codec", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "container_format", - "displayName": "container_format", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "standard_video_format", - "displayName": "standard_video_format", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "exact_video_format", - "displayName": "exact_video_format", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "fourk_resolution", - "displayName": "fourk_resolution", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "audio_codec_profile", - "displayName": "audio_codec_profile", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "audio_channel_format", - "displayName": "audio_channel_format", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "audio_channel_count", - "displayName": "audio_channel_count", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "audio_channel_layout", - "displayName": "audio_channel_layout", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "video_resolution", - "displayName": "video_resolution", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "video_width", - "displayName": "video_width", - "required": false, - "defaultMatch": false, - "display": true, - "type": "number", - "canBeUsedToMatch": true - }, - { - "id": "video_height", - "displayName": "video_height", - "required": false, - "defaultMatch": false, - "display": true, - "type": "number", - "canBeUsedToMatch": true - }, - { - "id": "video_bitdepth", - "displayName": "video_bitdepth", - "required": false, - "defaultMatch": false, - "display": true, - "type": "number", - "canBeUsedToMatch": true - }, - { - "id": "high_dynamic_range", - "displayName": "high_dynamic_range", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "dolby_vision", - "displayName": "dolby_vision", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "overall_bitrate", - "displayName": "overall_bitrate", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "video_bitrate", - "displayName": "video_bitrate", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "audio_bitrate", - "displayName": "audio_bitrate", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true - }, - { - "id": "created_at", - "displayName": "created_at", - "required": false, - "defaultMatch": false, - "display": true, - "type": "dateTime", - "canBeUsedToMatch": true, - "removed": true - }, - { - "id": "seen_at", - "displayName": "seen_at", - "required": false, - "defaultMatch": false, - "display": true, - "type": "dateTime", - "canBeUsedToMatch": true, - "removed": true - }, - { - "id": "themoviedb_id", - "displayName": "themoviedb_id", - "required": false, - "defaultMatch": false, - "display": true, - "type": "number", - "canBeUsedToMatch": true, - "removed": false - }, - { - "id": "thetvdb_id", - "displayName": "thetvdb_id", - "required": false, - "defaultMatch": false, - "display": true, - "type": "number", - "canBeUsedToMatch": true, - "removed": false - }, - { - "id": "imdb_id", - "displayName": "imdb_id", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true, - "removed": false - }, - { - "id": "cover_url", - "displayName": "cover_url", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true, - "removed": true - }, - { - "id": "object_type", - "displayName": "object_type", - "required": false, - "defaultMatch": false, - "display": true, - "type": "string", - "canBeUsedToMatch": true, - "removed": false - } - ], - "attemptToConvertTypes": false, - "convertFieldsToString": false - }, - "options": {} - }, - "type": "n8n-nodes-base.postgres", - "typeVersion": 2.6, - "position": [ - -496, - -320 - ], - "id": "3fc2a5b5-e4fd-4a01-bbf2-cfc24d94299b", - "name": "Insert rows in a table" - }, - { - "parameters": { - "operation": "select", - "schema": { - "__rl": true, - "value": "n8n", - "mode": "list", - "cachedResultName": "n8n" - }, - "table": { - "__rl": true, - "value": "movie_files", - "mode": "list", - "cachedResultName": "movie_files" - }, - "returnAll": true, - "where": { - "values": [ - { - "column": "cover_url", - "condition": "IS NULL" - }, - { - "column": "thetvdb_id", - "condition": "IS NOT NULL" - } - ] - }, - "options": {} - }, - "type": "n8n-nodes-base.postgres", - "typeVersion": 2.6, - "position": [ - -560, - -96 - ], - "id": "4a1dd71e-43ea-4eb2-8f12-cfc60263296c", - "name": "Select rows from a table" - }, - { - "parameters": { - "batchSize": 10, - "options": {} - }, - "type": "n8n-nodes-base.splitInBatches", - "typeVersion": 3, - "position": [ - -352, - -96 - ], - "id": "7c36ddb0-c817-451b-adff-6b496c2673d2", - "name": "Loop Over Items" - }, - { - "parameters": { - "rule": { - "interval": [ - { - "field": "minutes", - "minutesInterval": 2 - } - ] - } - }, - "type": "n8n-nodes-base.scheduleTrigger", - "typeVersion": 1.3, - "position": [ - -752, - -96 - ], - "id": "881a69cb-1bab-4dd4-8fb1-b0864f9563e7", - "name": "Schedule Trigger" - }, - { - "parameters": { - "rules": { - "values": [ - { - "conditions": { - "options": { - "caseSensitive": true, - "leftValue": "", - "typeValidation": "strict", - "version": 3 - }, - "conditions": [ - { - "leftValue": "={{ $json.object_type }}", - "rightValue": "Movie", - "operator": { - "type": "string", - "operation": "equals" - }, - "id": "ac38a6e6-583b-4f75-a86c-85b611cbdccc" - } - ], - "combinator": "and" - } - }, - { - "conditions": { - "options": { - "caseSensitive": true, - "leftValue": "", - "typeValidation": "strict", - "version": 3 - }, - "conditions": [ - { - "id": "696a3cdb-33d8-4a87-947a-79df6b932b4f", - "leftValue": "={{ $json.object_type }}", - "rightValue": "Episode", - "operator": { - "type": "string", - "operation": "equals", - "name": "filter.operator.equals" - } - } - ], - "combinator": "and" - } - }, - { - "conditions": { - "options": { - "caseSensitive": true, - "leftValue": "", - "typeValidation": "strict", - "version": 3 - }, - "conditions": [ - { - "id": "6df9991d-5be9-46b4-beb5-cfbed6931e85", - "leftValue": "={{ $json.object_type }}", - "rightValue": "", - "operator": { - "type": "string", - "operation": "empty", - "singleValue": true - } - } - ], - "combinator": "and" - } - } - ] - }, - "options": {} - }, - "type": "n8n-nodes-base.switch", - "typeVersion": 3.4, - "position": [ - -32, - -96 - ], - "id": "c7b75fce-baa0-4de6-9077-c6dc8423bccb", - "name": "Switch" - }, - { - "parameters": { - "url": "=https://api.tvmaze.com/lookup/shows?thetvdb={{ $('Select rows from a table').item.json.thetvdb_id }}", - "options": {} - }, - "type": "n8n-nodes-base.httpRequest", - "typeVersion": 4.4, - "position": [ - 464, - -80 - ], - "id": "7345fb54-37f4-41c3-8c71-c54d906efc9a", - "name": "HTTP Request tvmaze" - }, - { - "parameters": { - "url": "=https://www.omdbapi.com/?i={{ $json.imdb_id }}&apikey=dfd46af2", - "options": {} - }, - "type": "n8n-nodes-base.httpRequest", - "typeVersion": 4.4, - "position": [ - 464, - -224 - ], - "id": "bcb95aa0-2eb4-4b4c-933d-4391b68efc4c", - "name": "HTTP Request omdbapi" - }, - { - "parameters": { - "assignments": { - "assignments": [ - { - "id": "3516a7d0-ae39-4fc3-be1f-e984f9d3e8d6", - "name": "image.poster", - "value": "={{ $json.Poster }}", - "type": "string" - } - ] - }, - "options": {} - }, - "type": "n8n-nodes-base.set", - "typeVersion": 3.4, - "position": [ - 672, - -224 - ], - "id": "f459dd59-6261-446b-9b2b-382a9bed43af", - "name": "Edit Fields" - }, - { - "parameters": { - "assignments": { - "assignments": [ - { - "id": "28227e53-46c1-48a1-ad16-d197aa7398bf", - "name": "image.poster", - "value": "={{ $json.image.medium }}", - "type": "string" - } - ] - }, - "options": {} - }, - "type": "n8n-nodes-base.set", - "typeVersion": 3.4, - "position": [ - 672, - -80 - ], - "id": "5292cef8-4a4d-4e71-b1b9-6a9f240df994", - "name": "Edit Fields1" - }, - { - "parameters": {}, - "type": "n8n-nodes-base.manualTrigger", - "typeVersion": 1, - "position": [ - -752, - 64 - ], - "id": "efdd8a4b-2768-481b-9df6-2db0adae92d5", - "name": "When clicking 'Execute workflow'" - }, - { - "parameters": { - "conditions": { - "options": { - "caseSensitive": true, - "leftValue": "", - "typeValidation": "strict", - "version": 3 - }, - "conditions": [ - { - "id": "7cbb1b8f-2cad-438f-948c-6664b86c8a87", - "leftValue": "={{ $('Select rows from a table').item.json.thetvdb_id }}", - "rightValue": 0, - "operator": { - "type": "number", - "operation": "gt" - } - } - ], - "combinator": "and" - }, - "options": {} - }, - "type": "n8n-nodes-base.if", - "typeVersion": 2.3, - "position": [ - 240, - -80 - ], - "id": "ce9b2259-3743-4e7d-b29f-839ac3115070", - "name": "If" - }, - { - "parameters": { - "operation": "executeQuery", - "query": "-- SCHEMA: n8n\n\nCREATE SCHEMA IF NOT EXISTS n8n AUTHORIZATION n8n_filebot;\nGRANT ALL ON SCHEMA n8n TO n8n_filebot WITH GRANT OPTION;\n\nCREATE TABLE IF NOT EXISTS n8n.movie_files\n(\n id bigint NOT NULL DEFAULT nextval('n8n.movie_files_id_seq'::regclass),\n file_name_original text NOT NULL,\n file_name_new text NOT NULL,\n movie_rating numeric(3,1),\n movie_votes integer,\n video_compression_format text,\n video_codec_library text,\n audio_codec text,\n container_format text,\n standard_video_format text,\n exact_video_format text,\n fourk_resolution text,\n audio_codec_profile text,\n audio_channel_format text,\n audio_channel_count text,\n audio_channel_layout text,\n video_resolution text,\n video_width integer,\n video_height integer,\n video_bitdepth integer,\n high_dynamic_range text,\n dolby_vision text,\n overall_bitrate text,\n video_bitrate text,\n audio_bitrate text,\n created_at timestamp with time zone DEFAULT now(),\n seen_at timestamp with time zone,\n themoviedb_id integer,\n thetvdb_id integer,\n imdb_id text,\n cover_url text,\n object_type text,\n cover_image bytea,\n cover_mime_type text,\n CONSTRAINT movie_files_pkey PRIMARY KEY (id)\n)\nTABLESPACE pg_default;", - "options": {} - }, - "type": "n8n-nodes-base.postgres", - "typeVersion": 2.6, - "position": [ - -496, - -512 - ], - "id": "ed4d623a-5783-4baf-a7ea-747d65b66aac", - "name": "SQL query CREATE", - "disabled": true - }, - { - "parameters": { - "url": "={{ $json['image']['poster'] }}", - "responseFormat": "file", - "options": {} - }, - "type": "n8n-nodes-base.httpRequest", - "typeVersion": 4.4, - "continueOnFail": true, - "position": [ - 880, - -224 - ], - "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567801", - "name": "Download Cover (Movie)" - }, - { - "parameters": { - "jsCode": "const item = $input.first();\nlet coverBase64 = null;\nlet coverMimeType = null;\n\nif (item.binary && item.binary.data) {\n coverMimeType = item.binary.data.mimeType || 'image/jpeg';\n const buffer = await this.helpers.getBinaryDataBuffer(0, 'data');\n coverBase64 = buffer.toString('base64');\n}\n\nreturn [{\n json: {\n cover_url: $('Edit Fields').item.json['image']['poster'] || null,\n cover_base64: coverBase64,\n cover_mime_type: coverMimeType,\n record_id: $('Loop Over Items').item.json.id,\n }\n}];" - }, - "type": "n8n-nodes-base.code", - "typeVersion": 2, - "position": [ - 1088, - -224 - ], - "id": "b2c3d4e5-f6a7-8901-bcde-f12345678902", - "name": "Prepare Cover Data (Movie)" - }, - { - "parameters": { - "url": "={{ $json['image']['poster'] }}", - "responseFormat": "file", - "options": {} - }, - "type": "n8n-nodes-base.httpRequest", - "typeVersion": 4.4, - "continueOnFail": true, - "position": [ - 880, - -80 - ], - "id": "c3d4e5f6-a7b8-9012-cdef-012345678903", - "name": "Download Cover (Episode)" - }, - { - "parameters": { - "jsCode": "const item = $input.first();\nlet coverBase64 = null;\nlet coverMimeType = null;\n\nif (item.binary && item.binary.data) {\n coverMimeType = item.binary.data.mimeType || 'image/jpeg';\n const buffer = await this.helpers.getBinaryDataBuffer(0, 'data');\n coverBase64 = buffer.toString('base64');\n}\n\nreturn [{\n json: {\n cover_url: $('Edit Fields1').item.json['image']['poster'] || null,\n cover_base64: coverBase64,\n cover_mime_type: coverMimeType,\n record_id: $('Loop Over Items').item.json.id,\n }\n}];" - }, - "type": "n8n-nodes-base.code", - "typeVersion": 2, - "position": [ - 1088, - -80 - ], - "id": "d4e5f6a7-b8c9-0123-defa-123456789004", - "name": "Prepare Cover Data (Episode)" - }, - { - "parameters": { - "operation": "executeQuery", - "query": "UPDATE n8n.movie_files\nSET\n cover_url = $1,\n cover_image = CASE WHEN $2::text IS NOT NULL THEN decode($2, 'base64') ELSE NULL END,\n cover_mime_type = $3\nWHERE id = $4", - "options": { - "queryReplacement": "={{ [$json.cover_url, $json.cover_base64, $json.cover_mime_type, $json.record_id] }}" - } - }, - "type": "n8n-nodes-base.postgres", - "typeVersion": 2.6, - "position": [ - 1296, - -152 - ], - "id": "e5f6a7b8-c9d0-1234-efab-234567890105", - "name": "Speichere Cover in DB" - } - ], - "pinData": {}, - "connections": { - "Webhook": { - "main": [ - [ - { - "node": "Insert rows in a table", - "type": "main", - "index": 0 - } - ] - ] - }, - "Insert rows in a table": { - "main": [ - [] - ] - }, - "Select rows from a table": { - "main": [ - [ - { - "node": "Loop Over Items", - "type": "main", - "index": 0 - } - ] - ] - }, - "Loop Over Items": { - "main": [ - [], - [ - { - "node": "Switch", - "type": "main", - "index": 0 - } - ] - ] - }, - "Speichere Cover in DB": { - "main": [ - [ - { - "node": "Loop Over Items", - "type": "main", - "index": 0 - } - ] - ] - }, - "Schedule Trigger": { - "main": [ - [ - { - "node": "Select rows from a table", - "type": "main", - "index": 0 - } - ] - ] - }, - "Switch": { - "main": [ - [ - { - "node": "HTTP Request omdbapi", - "type": "main", - "index": 0 - } - ], - [ - { - "node": "If", - "type": "main", - "index": 0 - } - ] - ] - }, - "HTTP Request tvmaze": { - "main": [ - [ - { - "node": "Edit Fields1", - "type": "main", - "index": 0 - } - ] - ] - }, - "HTTP Request omdbapi": { - "main": [ - [ - { - "node": "Edit Fields", - "type": "main", - "index": 0 - } - ] - ] - }, - "Edit Fields": { - "main": [ - [ - { - "node": "Download Cover (Movie)", - "type": "main", - "index": 0 - } - ] - ] - }, - "Edit Fields1": { - "main": [ - [ - { - "node": "Download Cover (Episode)", - "type": "main", - "index": 0 - } - ] - ] - }, - "Download Cover (Movie)": { - "main": [ - [ - { - "node": "Prepare Cover Data (Movie)", - "type": "main", - "index": 0 - } - ] - ] - }, - "Prepare Cover Data (Movie)": { - "main": [ - [ - { - "node": "Speichere Cover in DB", - "type": "main", - "index": 0 - } - ] - ] - }, - "Download Cover (Episode)": { - "main": [ - [ - { - "node": "Prepare Cover Data (Episode)", - "type": "main", - "index": 0 - } - ] - ] - }, - "Prepare Cover Data (Episode)": { - "main": [ - [ - { - "node": "Speichere Cover in DB", - "type": "main", - "index": 0 - } - ] - ] - }, - "When clicking 'Execute workflow'": { - "main": [ - [ - { - "node": "Select rows from a table", - "type": "main", - "index": 0 - } - ] - ] - }, - "If": { - "main": [ - [ - { - "node": "HTTP Request tvmaze", - "type": "main", - "index": 0 - } - ], - [ - { - "node": "HTTP Request omdbapi", - "type": "main", - "index": 0 - } - ] - ] - } - }, - "active": true, - "settings": { - "executionOrder": "v1", - "binaryMode": "separate", - "timeSavedMode": "fixed", - "errorWorkflow": "ZNiaoGjMqDVGoOZY", - "callerPolicy": "workflowsFromSameOwner", - "availableInMCP": false - }, - "meta": { - "templateCredsSetupCompleted": true, - "instanceId": "47bbd8360afe40aa749b16dd6fb21c252c1eda50abb8518eb5f288a976f3c55f" - }, - "tags": [] -} \ No newline at end of file