603 lines
14 KiB
JSON
603 lines
14 KiB
JSON
{
|
|
"id": "t2BEdqrbF474ul3B",
|
|
"name": "Audiobook Tracker Cross-Reference",
|
|
"nodes": [
|
|
{
|
|
"parameters": {
|
|
"inputSource": "passthrough"
|
|
},
|
|
"id": "workflow-trigger",
|
|
"name": "Execute Workflow Trigger",
|
|
"type": "n8n-nodes-base.executeWorkflowTrigger",
|
|
"typeVersion": 1.1,
|
|
"position": [
|
|
112,
|
|
280
|
|
]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"operation": "getAll",
|
|
"tableId": "nyaa_audiobooks",
|
|
"returnAll": true,
|
|
"filterType": "none"
|
|
},
|
|
"id": "get-db-torrents",
|
|
"name": "Get DB Torrents for Filtering",
|
|
"type": "n8n-nodes-base.supabase",
|
|
"typeVersion": 1,
|
|
"position": [
|
|
560,
|
|
208
|
|
],
|
|
"executeOnce": true,
|
|
"credentials": {
|
|
"supabaseApi": {
|
|
"id": "lWyf2ikOGHTTwnSU",
|
|
"name": "Supabase account"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"url": "https://www.myanonamouse.net/tor/js/loadSearchJSONbasic.php",
|
|
"authentication": "genericCredentialType",
|
|
"genericAuthType": "httpHeaderAuth",
|
|
"sendQuery": true,
|
|
"queryParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "tor[text]",
|
|
"value": "={{ $json.search_title }}"
|
|
},
|
|
{
|
|
"name": "tor[srchIn][title]",
|
|
"value": "true"
|
|
},
|
|
{
|
|
"name": "tor[searchType]",
|
|
"value": "all"
|
|
},
|
|
{
|
|
"name": "tor[main_cat][]",
|
|
"value": "13"
|
|
},
|
|
{
|
|
"name": "tor[sortType]",
|
|
"value": "default"
|
|
},
|
|
{
|
|
"name": "tor[startNumber]",
|
|
"value": "0"
|
|
},
|
|
{
|
|
"name": "perpage",
|
|
"value": "10"
|
|
}
|
|
]
|
|
},
|
|
"sendHeaders": true,
|
|
"headerParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "Content-Type",
|
|
"value": "application/json; charset=utf-8"
|
|
}
|
|
]
|
|
},
|
|
"options": {
|
|
"response": {
|
|
"response": {
|
|
"neverError": true
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"id": "search-mam-title",
|
|
"name": "Search MAM by Title",
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.2,
|
|
"position": [
|
|
1456,
|
|
352
|
|
],
|
|
"credentials": {
|
|
"httpHeaderAuth": {
|
|
"id": "sxQYMPEq6GLbc9Av",
|
|
"name": "n8n_auth_cookie"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"conditions": {
|
|
"conditions": [
|
|
{
|
|
"leftValue": "={{ $json.mam_found_by_title }}",
|
|
"rightValue": true,
|
|
"operator": {
|
|
"type": "boolean",
|
|
"operation": "equals"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"options": {}
|
|
},
|
|
"id": "title-match-if",
|
|
"name": "Title Match Found?",
|
|
"type": "n8n-nodes-base.if",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
2576,
|
|
280
|
|
]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"url": "https://www.myanonamouse.net/tor/js/loadSearchJSONbasic.php",
|
|
"authentication": "genericCredentialType",
|
|
"genericAuthType": "httpHeaderAuth",
|
|
"sendQuery": true,
|
|
"queryParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "tor[text]",
|
|
"value": "={{ $json.search_term }}"
|
|
},
|
|
{
|
|
"name": "tor[srchIn][author]",
|
|
"value": "true"
|
|
},
|
|
{
|
|
"name": "tor[srchIn][narrator]",
|
|
"value": "true"
|
|
},
|
|
{
|
|
"name": "tor[searchType]",
|
|
"value": "all"
|
|
},
|
|
{
|
|
"name": "tor[main_cat][]",
|
|
"value": "13"
|
|
},
|
|
{
|
|
"name": "tor[sortType]",
|
|
"value": "default"
|
|
},
|
|
{
|
|
"name": "tor[startNumber]",
|
|
"value": "0"
|
|
},
|
|
{
|
|
"name": "perpage",
|
|
"value": "10"
|
|
}
|
|
]
|
|
},
|
|
"sendHeaders": true,
|
|
"headerParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "Content-Type",
|
|
"value": "application/json; charset=utf-8"
|
|
}
|
|
]
|
|
},
|
|
"options": {
|
|
"response": {
|
|
"response": {
|
|
"neverError": true
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"id": "search-mam-author",
|
|
"name": "Search MAM by Author/Narrator",
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.2,
|
|
"position": [
|
|
3024,
|
|
352
|
|
],
|
|
"credentials": {
|
|
"httpHeaderAuth": {
|
|
"id": "sxQYMPEq6GLbc9Av",
|
|
"name": "n8n_auth_cookie"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"mergeByFields": {
|
|
"values": [
|
|
{
|
|
"field1": "info_hash",
|
|
"field2": "info_hash"
|
|
}
|
|
]
|
|
},
|
|
"options": {}
|
|
},
|
|
"id": "compare-datasets",
|
|
"name": "Filter Unchecked Torrents",
|
|
"type": "n8n-nodes-base.compareDatasets",
|
|
"typeVersion": 1,
|
|
"position": [
|
|
784,
|
|
248
|
|
]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"includeOtherFields": true,
|
|
"options": {}
|
|
},
|
|
"id": "extract-base-title-set",
|
|
"name": "Extract Base Title",
|
|
"type": "n8n-nodes-base.set",
|
|
"typeVersion": 3.4,
|
|
"position": [
|
|
336,
|
|
280
|
|
]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"includeOtherFields": true,
|
|
"options": {}
|
|
},
|
|
"id": "extract-author-set",
|
|
"name": "Extract Author/Narrator",
|
|
"type": "n8n-nodes-base.set",
|
|
"typeVersion": 3.4,
|
|
"position": [
|
|
2800,
|
|
352
|
|
]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"options": {}
|
|
},
|
|
"id": "parse-mam-author-set",
|
|
"name": "Parse MAM Author Results",
|
|
"type": "n8n-nodes-base.set",
|
|
"typeVersion": 3.4,
|
|
"position": [
|
|
3248,
|
|
352
|
|
]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"mode": "combine",
|
|
"combineBy": "combineByPosition",
|
|
"options": {}
|
|
},
|
|
"id": "merge-title-enrich",
|
|
"name": "Merge Title Enrich",
|
|
"type": "n8n-nodes-base.merge",
|
|
"typeVersion": 3.2,
|
|
"position": [
|
|
2128,
|
|
280
|
|
]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"functionCode": "const data = Array.isArray($json.data) ? $json.data : [];\nconst volNum = $json.volume_start ?? null;\nconst norm = (s) => (s || '').toLowerCase().replace(/[^a-z0-9]+/g, ' ').trim();\nconst seriesRoot = norm($json.search_title);\nfunction matchesVol(title, vol) {\n const t = (title || '').toLowerCase();\n const v = String(vol);\n const re = new RegExp(`(\\\\bvol(?:ume)?\\\\.?\\\\s*0*${v}\\\\b|\\\\bv0*${v}\\\\b|\\\\bbook\\\\s*0*${v}\\\\b)`,'i');\n return re.test(t);\n}\nlet best = null;\nif (volNum != null) {\n best = data.find(r => matchesVol(r.title, volNum));\n}\nif (!best) {\n const m4bSeries = data.filter(r => ((r.filetype || '').toLowerCase().includes('m4b')) && norm(r.title).includes(seriesRoot));\n best = m4bSeries[0] || data.find(r => (r.filetype || '').toLowerCase().includes('m4b')) || data[0] || null;\n}\nreturn {\n mam_torrent_id: best ? best.id : null,\n mam_found_by_title: !!best,\n mam_checked_at: $now.toISO(),\n};"
|
|
},
|
|
"id": "68c5d252-c28f-4a96-974b-fde708933d9f",
|
|
"name": "Pick Best MAM Match",
|
|
"type": "n8n-nodes-base.functionItem",
|
|
"typeVersion": 1,
|
|
"position": [
|
|
1680,
|
|
352
|
|
]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"mode": "append",
|
|
"numberInputs": 2
|
|
},
|
|
"id": "92d01c6d-165b-483a-8738-715006a31647",
|
|
"name": "Combine A-only + Different",
|
|
"type": "n8n-nodes-base.merge",
|
|
"typeVersion": 3.2,
|
|
"position": [
|
|
1008,
|
|
280
|
|
]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"jsCode": "const items = $input.all();\nconst total = items.length;\nconst timestamp = $now.toISO();\nreturn items.map(item => ({\n json: {\n ...item.json,\n debug_stage: \"combine-output\",\n debug_count: total,\n debug_timestamp: timestamp,\n }\n}));"
|
|
},
|
|
"id": "debug-combine-output",
|
|
"name": "Debug Combine Output",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
1232,
|
|
280
|
|
]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"jsCode": "const items = $input.all();\nconst total = items.length;\nconst timestamp = $now.toISO();\nreturn items.map(item => ({\n json: {\n ...item.json,\n debug_stage: \"pick-match\",\n debug_count: total,\n debug_timestamp: timestamp,\n }\n}));"
|
|
},
|
|
"id": "debug-pick-match",
|
|
"name": "Debug Pick Match",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
1904,
|
|
352
|
|
]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"jsCode": "const items = $input.all();\nconst total = items.length;\nconst timestamp = $now.toISO();\nreturn items.map(item => ({\n json: {\n ...item.json,\n debug_stage: \"merge-output\",\n debug_count: total,\n debug_timestamp: timestamp,\n }\n}));"
|
|
},
|
|
"id": "debug-merge-output",
|
|
"name": "Debug Merge Output",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
2352,
|
|
280
|
|
]
|
|
},
|
|
{
|
|
"id": "merge-results-merge",
|
|
"name": "Merge Results",
|
|
"type": "n8n-nodes-base.merge",
|
|
"typeVersion": 3.2,
|
|
"position": [
|
|
3472,
|
|
280
|
|
],
|
|
"parameters": {
|
|
"mode": "append",
|
|
"numberInputs": 2
|
|
}
|
|
},
|
|
{
|
|
"id": "clean-merge-results",
|
|
"name": "Clean Merge Results",
|
|
"type": "n8n-nodes-base.set",
|
|
"typeVersion": 3.4,
|
|
"position": [
|
|
3720,
|
|
280
|
|
],
|
|
"parameters": {
|
|
"includeOtherFields": true,
|
|
"include": "except",
|
|
"excludeFields": "debug_stage,debug_count,debug_timestamp,mam_found_by_title,search_term,search_title,volume_range"
|
|
}
|
|
}
|
|
],
|
|
"connections": {
|
|
"Title Match Found?": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Merge Results",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"node": "Extract Author/Narrator",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Get DB Torrents for Filtering": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Filter Unchecked Torrents",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Execute Workflow Trigger": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Extract Base Title",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Extract Base Title": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Get DB Torrents for Filtering",
|
|
"type": "main",
|
|
"index": 0
|
|
},
|
|
{
|
|
"node": "Filter Unchecked Torrents",
|
|
"type": "main",
|
|
"index": 1
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Extract Author/Narrator": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Search MAM by Author/Narrator",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Search MAM by Author/Narrator": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Parse MAM Author Results",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Merge Title Enrich": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Debug Merge Output",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Search MAM by Title": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Pick Best MAM Match",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Pick Best MAM Match": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Debug Pick Match",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Filter Unchecked Torrents": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Combine A-only + Different",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
],
|
|
[],
|
|
[
|
|
{
|
|
"node": "Combine A-only + Different",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Combine A-only + Different": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Debug Combine Output",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Debug Combine Output": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Search MAM by Title",
|
|
"type": "main",
|
|
"index": 0
|
|
},
|
|
{
|
|
"node": "Merge Title Enrich",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Debug Merge Output": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Title Match Found?",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Debug Pick Match": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Merge Title Enrich",
|
|
"type": "main",
|
|
"index": 1
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Parse MAM Author Results": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Merge Results",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Merge Results": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Clean Merge Results",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
}
|
|
},
|
|
"settings": {
|
|
"saveExecutionProgress": true,
|
|
"saveManualExecutions": true,
|
|
"saveDataErrorExecution": "all",
|
|
"saveDataSuccessExecution": "all",
|
|
"executionOrder": "v1"
|
|
},
|
|
"triggerCount": 0,
|
|
"versionId": "7080e712-9bf6-4a42-ba94-924e41f4aab8",
|
|
"owner": {
|
|
"type": "personal",
|
|
"projectId": "FeLO36wNUAcn61Wj",
|
|
"projectName": "Ben W <admin@ben.io>",
|
|
"personalEmail": "admin@ben.io"
|
|
},
|
|
"parentFolderId": "kUg4HIPXraph3M0E",
|
|
"isArchived": false
|
|
} |