[AI Tagger] Add path mutation (and by extension docker) support (#353)

* add path mutation (and by extension docker) support

* update version
This commit is contained in:
skier233
2024-07-04 04:02:30 -04:00
committed by GitHub
parent a52ba76c6b
commit 263f6fd41f
3 changed files with 17 additions and 2 deletions

View File

@@ -129,6 +129,13 @@ async def tag_scenes():
async def __tag_images(images):
async with semaphore:
imagePaths, imageIds, temp_files = media_handler.get_image_paths_and_ids(images)
mutated_image_paths = []
for path in imagePaths:
mutated_path = path
for key, value in config.path_mutation.items():
mutated_path = mutated_path.replace(key, value)
mutated_image_paths.append(mutated_path)
imagePaths = mutated_image_paths
try:
server_result = await ai_server.process_images_async(imagePaths)
if server_result is None:
@@ -175,6 +182,10 @@ 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)

View File

@@ -1,6 +1,6 @@
name: AI Tagger
description: Tag videos and Images with Locally hosted AI using Skier's Patreon AI models
version: 1.3
version: 1.4
url: https://github.com/stashapp/CommunityScripts/tree/main/plugins/AITagger
exec:
- python

View File

@@ -13,4 +13,8 @@ ai_base_tag_name = "AI"
tagme_tag_name = "AI_TagMe"
updateme_tag_name = "AI_UpdateMe"
aitagged_tag_name = "AI_Tagged"
aierrored_tag_name = "AI_Errored"
aierrored_tag_name = "AI_Errored"
# Example for mutating paths
# path_mutation = {"E:": "F:", "G:": "D:"}
path_mutation = {}