Skip to content

Commit

Permalink
[AI Tagger] Fix docker json bug (#359)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
skier233 authored Jul 11, 2024
1 parent 2e5f0f3 commit 0ae8fd3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 3 additions & 7 deletions plugins/AITagger/ai_tagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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 -----------------

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion plugins/AITagger/ai_tagger.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 0ae8fd3

Please sign in to comment.