clean up supabase, MAM automation continues.

This commit is contained in:
2026-01-08 15:15:02 +00:00
parent 17cbee3ab9
commit c0a38e8c8d
9 changed files with 974 additions and 384 deletions

View File

@@ -40,7 +40,7 @@
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"tor\": {\n \"text\": \"{{ $json.series_name }} m4b\",\n \"srchIn\": [\n \"title\",\n \"author\",\n \"filenames\",\n \"fileTypes\"\n ],\n \"main_cat\": [\n \"13\"\n ],\n \"searchType\": \"all\",\n \"sortType\": \"seedersDesc\"\n }\n}",
"jsonBody": "={\n \"dlLink\": \"1\",\n \"tor\": {\n \"text\": \" {{ $json.series_name }} m4b\",\n \"srchIn\": [\n \"title\",\n \"author\",\n \"filenames\",\n \"fileTypes\"\n ],\n \"main_cat\": [\n \"13\"\n ],\n \"searchType\": \"all\",\n \"sortType\": \"seedersDesc\"\n }\n}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
@@ -91,7 +91,8 @@
0
],
"id": "aef43627-3228-42ab-a2fe-9f4b50d1a855",
"name": "Basic LLM Chain"
"name": "Basic LLM Chain",
"onError": "continueErrorOutput"
},
{
"parameters": {
@@ -113,12 +114,15 @@
"parameters": {
"model": {
"__rl": true,
"value": "gemini_cli/gemini-2.5-flash-lite",
"value": "gemini_cli/gemini-2.5-flash",
"mode": "list",
"cachedResultName": "gemini_cli/gemini-2.5-flash-lite"
"cachedResultName": "gemini_cli/gemini-2.5-flash"
},
"responsesApiEnabled": false,
"options": {}
"options": {
"responseFormat": "json_object",
"maxRetries": 2
}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.3,
@@ -141,6 +145,19 @@
"fieldToAggregate": [
{
"fieldToAggregate": "data.title"
},
{
"fieldToAggregate": "=data.dl",
"renameField": true
},
{
"fieldToAggregate": "data.id"
},
{
"fieldToAggregate": "data.series_info"
},
{
"fieldToAggregate": "data.author_info"
}
]
},
@@ -228,6 +245,64 @@
"name": "n8n-media"
}
}
},
{
"parameters": {
"mode": "combine",
"combineBy": "combineByPosition",
"options": {}
},
"type": "n8n-nodes-base.merge",
"typeVersion": 3.2,
"position": [
1328,
0
],
"id": "d8c36a24-7337-453f-b403-f5c631025096",
"name": "Merge"
},
{
"parameters": {
"workflowId": {
"__rl": true,
"value": "kRZyX9H2uDHHncpE",
"mode": "list",
"cachedResultUrl": "/workflow/kRZyX9H2uDHHncpE",
"cachedResultName": "MAM Transmission Manager"
},
"workflowInputs": {
"mappingMode": "defineBelow",
"value": {},
"matchingColumns": [],
"schema": [],
"attemptToConvertTypes": false,
"convertFieldsToString": true
},
"mode": "each",
"options": {}
},
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1.3,
"position": [
1728,
0
],
"id": "b6ec81b3-4f62-494e-9437-1a31c82a0299",
"name": "Call 'MAM Transmission Manager'"
},
{
"parameters": {
"language": "pythonNative",
"pythonCode": "# Output list\nresults = []\n\n# Access the input item\ninput_item = _items[0]['json']\n\n# Extract Lists\nmissing_books = input_item.get('data', [])\navailable_titles = input_item.get('title', [])\navailable_ids = input_item.get('id', [])\navailable_series_info = input_item.get('series_info', [])\navailable_author_info = input_item.get('author_info', [])\navailable_catnames = input_item.get('catname', []) # New: For category detection\navailable_tags = input_item.get('tags', []) # New: For category detection\n\n# 1. Match missing titles to their IDs & Metadata\nfor book_title in missing_books:\n # Normalize the target title\n target_clean = str(book_title).strip()\n \n # Find index\n found_index = -1\n for i, title in enumerate(available_titles):\n if str(title).strip() == target_clean:\n found_index = i\n break\n \n if found_index != -1:\n # Get raw data\n book_id = available_ids[found_index]\n series_raw = available_series_info[found_index]\n author_raw = available_author_info[found_index]\n catname_raw = available_catnames[found_index] if i < len(available_catnames) else \"\"\n tags_raw = available_tags[found_index] if i < len(available_tags) else \"\"\n \n # --- PARSING LOGIC ---\n \n # Parse Series\n meta_series = \"Unknown\"\n meta_book_num = \"0\"\n \n if isinstance(series_raw, str):\n import json\n try:\n series_raw = json.loads(series_raw)\n except:\n pass\n\n if isinstance(series_raw, dict):\n keys = list(series_raw.keys())\n if keys:\n data = series_raw[keys[0]]\n if isinstance(data, list) and len(data) >= 2:\n meta_series = str(data[0]).replace('&#039;', \"'\")\n meta_book_num = str(data[1])\n\n # Parse Author\n meta_author = \"Unknown\"\n \n if isinstance(author_raw, str):\n import json\n try:\n author_raw = json.loads(author_raw)\n except:\n pass\n\n if isinstance(author_raw, dict):\n keys = list(author_raw.keys())\n if keys:\n meta_author = str(author_raw[keys[0]])\n\n # --- CATEGORY DETECTION ---\n # Check if \"Light Novel\" or \"Anime\" appears in category name or tags\n is_anime = \"Light Novel\" in str(catname_raw) or \"anime\" in str(tags_raw).lower()\n category = 'anime' if is_anime else 'general'\n\n # Construct download link\n full_url = f\"https://www.myanonamouse.net/tor/download.php?tid={book_id}\"\n \n results.append({\n \"json\": {\n # Metadata\n \"meta_title\": target_clean,\n \"meta_series\": meta_series,\n \"meta_book_number\": meta_book_num,\n \"meta_author\": meta_author,\n \"mam_id\": book_id,\n \"category\": category, # <--- Sending this to the DB now\n \n # Download Info\n \"dl_link\": full_url,\n \"torrent_hash\": \"PENDING\"\n }\n })\n\nreturn results"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1520,
0
],
"id": "c7496e8c-e307-4659-bdd0-530cd5feeef3",
"name": "Create Download Links"
}
],
"connections": {
@@ -305,6 +380,11 @@
"node": "Select Book Titles",
"type": "main",
"index": 0
},
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
@@ -332,6 +412,40 @@
]
},
"Basic LLM Chain": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
],
[]
]
},
"Merge": {
"main": [
[
{
"node": "Create Download Links",
"type": "main",
"index": 0
}
]
]
},
"Create Download Links": {
"main": [
[
{
"node": "Call 'MAM Transmission Manager'",
"type": "main",
"index": 0
}
]
]
},
"Call 'MAM Transmission Manager'": {
"main": [
[]
]
@@ -341,8 +455,8 @@
"executionOrder": "v1",
"availableInMCP": false
},
"triggerCount": 0,
"versionId": "b179028c-8bde-4e62-8183-1464046a348b",
"triggerCount": 1,
"versionId": "8a3af598-bd9e-48e1-a025-cb2059cfebbd",
"owner": {
"type": "personal",
"projectId": "FeLO36wNUAcn61Wj",