Upload pipeline: staging, MD5 auto-match, IQDB, three-column board
Backend: - TempUpload model: staged files (pending / visual_match / completed / error) with resolution, e621 payload, custom metadata and IQDB data - Files land in a temp folder and only move into the watched library folder once resolved; duplicates resolve immediately without a copy - Endpoints: stage (multipart), list, retrieve, temp file, IQDB save, resolve (link to post or custom metadata), discard/dismiss - cleanup_temp_uploads command for old staged files - Replaces the old direct-to-library upload endpoint Frontend: - Upload page is now a three-column board (Pending & Unmatched / Visual Similarity Detected / Auto-uploaded & Indexed) - After upload: MD5s are batch-checked against e621 and matches auto-complete with full post metadata; remaining files run through IQDB and move to the similarity column when candidates exist - Metadata modal with IQDB candidates, post-ID linking and custom tags/rating/notes; discard and dismiss actions - e621 client gains fetchPostsByMd5 and iqdbSearch helpers Roadmap updated with the completed upload items.
This commit is contained in:
@@ -226,6 +226,26 @@ def trim_e621_post(post):
|
||||
}
|
||||
|
||||
|
||||
def sanitize_iqdb_results(results):
|
||||
"""Keep a compact, size-bounded copy of IQDB candidates."""
|
||||
cleaned = []
|
||||
for result in results[:10]:
|
||||
if not isinstance(result, dict):
|
||||
continue
|
||||
score = result.get("score")
|
||||
post_id = result.get("post_id")
|
||||
entry = {
|
||||
"post_id": post_id if isinstance(post_id, int) else None,
|
||||
"score": float(score) if isinstance(score, (int, float)) else None,
|
||||
"preview_url": str(result.get("preview_url") or "")[:500] or None,
|
||||
"rating": str(result.get("rating") or "")[:1] or None,
|
||||
"md5": str(result.get("md5") or "")[:32] or None,
|
||||
}
|
||||
if entry["post_id"] or entry["preview_url"]:
|
||||
cleaned.append(entry)
|
||||
return cleaned
|
||||
|
||||
|
||||
def generate_video_thumbnail(md5, path):
|
||||
"""Extract a JPEG thumbnail from a video, cached under MEDIA_ROOT/thumbs."""
|
||||
if not shutil.which("ffmpeg"):
|
||||
|
||||
Reference in New Issue
Block a user