Skip to content

Commit

Permalink
Merge branch 'chooseYourOwnAdventurePlayer' of https://github.com/cj1…
Browse files Browse the repository at this point in the history
…2312021/CommunityScripts into chooseYourOwnAdventurePlayer
  • Loading branch information
cj12312021 committed Sep 2, 2024
2 parents 2975b0b + f723260 commit 8dd9712
Show file tree
Hide file tree
Showing 59 changed files with 4,599 additions and 642 deletions.
21 changes: 12 additions & 9 deletions plugins/AITagger/ai_tagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@ async def __tag_images(images):
log.error(f"Error processing image: {result['error']}")
media_handler.add_error_images([id])
else:
actions = result['actions']
action_stashtag_ids = media_handler.get_tag_ids(actions)
action_stashtag_ids.append(media_handler.ai_tagged_tag_id)
media_handler.add_tags_to_image(id, action_stashtag_ids)
tags = media_handler.get_all_tags_from_server_result(result)
stashtag_ids = media_handler.get_tag_ids(tags)
stashtag_ids.append(media_handler.ai_tagged_tag_id)
media_handler.add_tags_to_image(id, stashtag_ids)

log.info(f"Tagged {len(imageIds)} images")
media_handler.remove_tagme_tags_from_images(imageIds)
Expand All @@ -166,16 +166,19 @@ async def __tag_images(images):
except asyncio.TimeoutError as a:
log.error(f"Timeout processing images: {a}")
except Exception as e:
log.error(f"Failed to process images: {e}")
log.error(f"Failed to process images: {e}Stack trace: {traceback.format_exc()}")
media_handler.add_error_images(imageIds)
media_handler.remove_tagme_tags_from_images(imageIds)
finally:
increment_progress()
for temp_file in temp_files:
if os.path.isdir(temp_file):
shutil.rmtree(temp_file)
else:
os.remove(temp_file)
try:
if os.path.isdir(temp_file):
shutil.rmtree(temp_file)
else:
os.remove(temp_file)
except Exception as e:
log.debug(f"Failed to remove temp file {temp_file}: {e}")

# ----------------- Scene Processing -----------------

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.6
version: 1.7
url: https://github.com/stashapp/CommunityScripts/tree/main/plugins/AITagger
exec:
- python
Expand Down
4 changes: 2 additions & 2 deletions plugins/AITagger/ai_video_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ def __mutate_server_result_tags(cls, server_result, model_name, frame_interval):
tags = {}
for result in server_result:
frame_index = result["frame_index"]
actions = result["actions"]
for action in actions:
alltags = media_handler.get_all_tags_from_server_result(result)
for action in alltags:
tag_name, confidence = action
if tag_name not in tags:
tags[tag_name] = TagData(ai_model_name=model_name, time_frames=[TagTimeFrame(start=frame_index, end=None, confidence=confidence)])
Expand Down
9 changes: 9 additions & 0 deletions plugins/AITagger/media_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ def initialize(connection):

# ----------------- Tag Methods -----------------


tag_categories = ["actions", "bodyparts"]

def get_all_tags_from_server_result(result):
alltags = []
for category in tag_categories:
alltags.extend(result.get(category, []))
return alltags

def get_tag_ids(tag_names):
return [get_tag_id(tag_name) for tag_name in tag_names]

Expand Down
20 changes: 20 additions & 0 deletions plugins/AITagger/tag_mappings.csv
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,23 @@ Undressing,Undressing_AI,15,6,20s,0.5
Vaginal Penetration,Vaginal Penetration_AI,15,6,20s,0.5
Vaginal Fucking,Vaginal Fucking_AI,15,6,20s,0.5
Vibrating,Vibrating_AI,10,6,20s,0.5
Ass,Ass_AI,-1,6,20s,0.5
Asshole,Asshole_AI,-1,6,20s,0.5
Anal Gape,Anal Gape_AI,10,6,20s,0.5
Balls,Balls_AI,-1,6,20s,0.5
Boobs,Boobs_AI,-1,6,20s,0.5
Cum,Cum_AI,10,6,20s,0.5
Dick,Dick_AI,-1,6,20s,0.5
Face,Face_AI,-1,6,20s,0.5
Feet,Feet_AI,-1,6,20s,0.5
Fingers,Fingers_AI,-1,6,20s,0.5
Belly Button,Belly Button_AI,-1,6,20s,0.5
Nipples,Nipples_AI,-1,6,20s,0.5
Thighs,Thighs_AI,-1,6,20s,0.5
Lower Legs,Lower Legs_AI,-1,6,20s,0.5
Tongue,Tongue_AI,10,6,20s,0.5
Pussy,Pussy_AI,-1,6,20s,0.5
Pussy Gape,Pussy Gape_AI,10,6,20s,0.5
Spit,Spit_AI,10,6,20s,0.5
Oiled,Oiled_AI,10,6,20s,0.5
Wet (Water),Wet (Water)_AI,10,6,20s,0.5
27 changes: 1 addition & 26 deletions plugins/AdulttimeInteractiveDL/AdulttimeInteractiveDL.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,10 @@
import requests, os, shutil
import re, sys, json
import datetime as dt
import pathlib
import time
from inspect import getmembers, isfunction

CurRunDir = pathlib.Path(__file__).parent.resolve()
vENVDir = f"{CurRunDir}/../PythonToolsInstaller/venv/lib/python3.11/site-packages"

try:
if os.path.isdir(vENVDir):
print(f"VENV Dir {vENVDir} used", file=sys.stderr)
sys.path.insert(0, vENVDir)
else:
print(f"VENV Dir {vENVDir} not used", file=sys.stderr)

except Exception as e:
# Ignore
print("Caught exception")

try:
import stashapi.log as log
from stashapi.tools import human_bytes, human_bits
from stashapi.stash_types import PhashDistance
from stashapi.stashapp import StashInterface

except ModuleNotFoundError:
Expand Down Expand Up @@ -85,13 +67,10 @@ def main():
if MODE == "disable":
return True
else:
FRAGMENT_HOOK_TYPE = FRAGMENT["args"]["hookContext"]["type"]
FRAGMENT_SCENE_ID = FRAGMENT["args"]["hookContext"]["id"]
try:
get_download() # ToDo use single Scene
except Exception as err:
log.LogError(f"main function error: {err}")
traceback.print_exc()

log.exit("Plugin exited normally.")

Expand Down Expand Up @@ -135,10 +114,7 @@ def get_download():

i = 0
for i, scene in enumerate(scenes):
title = re.sub(r"\[PDT: .+?\]\s+", "", scene["title"])
url = scene["url"]
urls = scene["urls"]

for u in urls:
# if re.search(r"members\.adulttime\.com", u):
if re.search(r"\.adulttime\.com", u):
Expand Down Expand Up @@ -176,7 +152,7 @@ def get_download():
else:
log.debug(f"No Interactive for this ID")

except KeyError as error:
except KeyError:
log.error(
"File '%s' can not be read, invailed format" % fpw
)
Expand All @@ -193,7 +169,6 @@ def get_download():


def map_file_with_funscript(sceneinfo, funscriptfile):

scenefiles = sceneinfo["files"]
for u in scenefiles:
filepath = os.path.dirname(os.path.abspath(u["path"]))
Expand Down
2 changes: 1 addition & 1 deletion plugins/AdulttimeInteractiveDL/AdulttimeInteractiveDL.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: "Adulttime Interactive Downloader"
description: Download Interactive Files for Adulttime Scenes
version: 0.1.1
version: 0.1.2
url: https://github.com/tooliload/StashAppCommunityScripts/tree/main/plugins/AdulttimeInteractiveDL
exec:
- python
Expand Down
2 changes: 0 additions & 2 deletions plugins/DateParser/date_parser.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import sys, json
from pathlib import Path

import stashapi.log as log
from stashapi.stashapp import StashInterface
import re
from dateparser import parse
from datetime import datetime


def main():
Expand Down
14 changes: 1 addition & 13 deletions plugins/DateParser/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,2 @@
certifi>=2022.9.24
charset-normalizer>=2.1.1
dateparser>=1.1.3
idna>=3.4
python-dateutil>=2.8.2
pytz>=2022.6
pytz-deprecation-shim>=0.1.0.post0
regex>=2022.3.2
requests>=2.28.1
six>=1.16.0
stashapp-tools>=0.2.17
tzdata>=2022.6
tzlocal>=4.2
urllib3>=1.26.12
stashapp-tools>=0.2.17
Loading

0 comments on commit 8dd9712

Please sign in to comment.