diff --git a/app/library/task_handlers/generic.py b/app/library/task_handlers/generic.py index 78740fe9..6cde2b53 100644 --- a/app/library/task_handlers/generic.py +++ b/app/library/task_handlers/generic.py @@ -4,7 +4,6 @@ from __future__ import annotations import asyncio import fnmatch -import hashlib import json import logging import re @@ -685,6 +684,12 @@ class GenericTaskHandler(BaseHandler): task_items: list[TaskItem] = [] + def _generic_id(url): + import os + import urllib + + return urllib.parse.unquote(os.path.splitext(url.rstrip("/").split("/")[-1])[0]) + for entry in raw_items: if not isinstance(entry, dict): continue @@ -698,7 +703,8 @@ class GenericTaskHandler(BaseHandler): LOG.warning( f"[{definition.name}]: '{task.name}': Could not compute archive ID for video '{url}' in feed. generating one." ) - archive_id = f"generic {hashlib.sha256(url.encode()).hexdigest()[:16]}" + + archive_id = f"generic {_generic_id(url)}" metadata: dict[str, str] = { k: v for k, v in entry.items() if k not in {"link", "url", "title", "published", "archive_id"} diff --git a/app/library/ytdlp.py b/app/library/ytdlp.py index 0e4caaf4..d0a49dd8 100644 --- a/app/library/ytdlp.py +++ b/app/library/ytdlp.py @@ -89,6 +89,14 @@ class YTDLP(yt_dlp.YoutubeDL): self.write_debug(f"Adding to archive: {archive_id}") self.archive.add(archive_id) + old_archive_ids = info_dict.get("_old_archive_ids", []) + if old_archive_ids and isinstance(old_archive_ids, list) and len(old_archive_ids) > 0: + for old_id in old_archive_ids: + if old_id == archive_id or not old_id.startswith("generic "): + continue + + self.write_debug(f"Adding to archive (old id): {old_id}") + self.archive.add(old_id) def ytdlp_options() -> list[dict[str, Any]]: diff --git a/ui/app/components/TaskInspect.vue b/ui/app/components/TaskInspect.vue index 78752dad..ae2f6e27 100644 --- a/ui/app/components/TaskInspect.vue +++ b/ui/app/components/TaskInspect.vue @@ -9,16 +9,30 @@ code {

Inspect Task Handler

- -
+ +
+

{{ urlError }}

+

+ Enter the URL of the resource you want to inspect. +

- -
+ +
+
+

+ Select a preset to apply its settings during inspection. In real scenario, the preset will be based on what is + selected when creating the task. +

- -
- + +
+ +
+

+ In real scenario, the system auto-detects the appropriate handler based on the URL. This field is for testing + purposes only. +

@@ -49,7 +78,7 @@ code {
- @@ -57,18 +86,21 @@ code {
-
- - - - Inspecting... -
+ +

+ + + Inspecting.. please wait. + +

+
-
- Error: {{ response.error }}
- {{ response.message }} -
+ +

{{ response.error }}

+

{{ response.message }}

+

Result:

{{ response }}