From 0ae8fd3fae8723843ef3b8b9c294d022b9d0b60d Mon Sep 17 00:00:00 2001 From: skier233 <39396856+skier233@users.noreply.github.com> Date: Thu, 11 Jul 2024 18:00:35 -0400 Subject: [PATCH] [AI Tagger] Fix docker json bug (#359) * add path mutation (and by extension docker) support * update version * fix mutating path bug with json file path * bump version * improve error message clarity for when no scenes are found --- plugins/AITagger/ai_tagger.py | 10 +++------- plugins/AITagger/ai_tagger.yml | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/plugins/AITagger/ai_tagger.py b/plugins/AITagger/ai_tagger.py index e8d966ba..0b097c48 100644 --- a/plugins/AITagger/ai_tagger.py +++ b/plugins/AITagger/ai_tagger.py @@ -111,7 +111,7 @@ async def tag_images(): tasks = [__tag_images(batch) for batch in image_batches] await asyncio.gather(*tasks) else: - log.info("No images to tag") + log.info("No images to tag. Have you tagged any images with the AI_TagMe tag to get processed?") async def tag_scenes(): @@ -122,7 +122,7 @@ async def tag_scenes(): tasks = [__tag_scene(scene) for scene in scenes] await asyncio.gather(*tasks) else: - log.info("No scenes to tag") + log.info("No scenes to tag. Have you tagged any scenes with the AI_TagMe tag to get processed?") # ----------------- Image Processing ----------------- @@ -182,10 +182,6 @@ async def __tag_images(images): async def __tag_scene(scene): async with semaphore: scenePath = scene['files'][0]['path'] - mutated_path = scenePath - for key, value in config.path_mutation.items(): - mutated_path = mutated_path.replace(key, value) - scenePath = mutated_path sceneId = scene['id'] log.debug("files result:" + str(scene['files'][0])) phash = scene['files'][0].get('fingerprint', None) @@ -244,7 +240,7 @@ async def __tag_scene(scene): vr_video = media_handler.is_vr_scene(scene.get('tags')) if vr_video: log.info(f"Processing VR video {scenePath}") - server_result = await ai_server.process_video_async(scenePath, vr_video) + server_result = await ai_server.process_video_async(mutated_path, vr_video) if server_result is None: log.error("Server returned no results") media_handler.add_error_scene(sceneId) diff --git a/plugins/AITagger/ai_tagger.yml b/plugins/AITagger/ai_tagger.yml index 84bc850c..d2c37e71 100644 --- a/plugins/AITagger/ai_tagger.yml +++ b/plugins/AITagger/ai_tagger.yml @@ -1,6 +1,6 @@ name: AI Tagger description: Tag videos and Images with Locally hosted AI using Skier's Patreon AI models -version: 1.4 +version: 1.5 url: https://github.com/stashapp/CommunityScripts/tree/main/plugins/AITagger exec: - python