Skip to content

Commit dc0b6c6

Browse files
authored
remove indirect pythontoolsintealler from adulttimeinteractive (#398)
Co-authored-by: feederbox826 <[email protected]>
1 parent fcd86af commit dc0b6c6

File tree

4 files changed

+12
-44
lines changed

4 files changed

+12
-44
lines changed

plugins/AdulttimeInteractiveDL/AdulttimeInteractiveDL.py

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,10 @@
11
import requests, os, shutil
22
import re, sys, json
33
import datetime as dt
4-
import pathlib
54
import time
6-
from inspect import getmembers, isfunction
7-
8-
CurRunDir = pathlib.Path(__file__).parent.resolve()
9-
vENVDir = f"{CurRunDir}/../PythonToolsInstaller/venv/lib/python3.11/site-packages"
10-
11-
try:
12-
if os.path.isdir(vENVDir):
13-
print(f"VENV Dir {vENVDir} used", file=sys.stderr)
14-
sys.path.insert(0, vENVDir)
15-
else:
16-
print(f"VENV Dir {vENVDir} not used", file=sys.stderr)
17-
18-
except Exception as e:
19-
# Ignore
20-
print("Caught exception")
215

226
try:
237
import stashapi.log as log
24-
from stashapi.tools import human_bytes, human_bits
25-
from stashapi.stash_types import PhashDistance
268
from stashapi.stashapp import StashInterface
279

2810
except ModuleNotFoundError:
@@ -85,13 +67,10 @@ def main():
8567
if MODE == "disable":
8668
return True
8769
else:
88-
FRAGMENT_HOOK_TYPE = FRAGMENT["args"]["hookContext"]["type"]
89-
FRAGMENT_SCENE_ID = FRAGMENT["args"]["hookContext"]["id"]
9070
try:
9171
get_download() # ToDo use single Scene
9272
except Exception as err:
9373
log.LogError(f"main function error: {err}")
94-
traceback.print_exc()
9574

9675
log.exit("Plugin exited normally.")
9776

@@ -135,10 +114,7 @@ def get_download():
135114

136115
i = 0
137116
for i, scene in enumerate(scenes):
138-
title = re.sub(r"\[PDT: .+?\]\s+", "", scene["title"])
139-
url = scene["url"]
140117
urls = scene["urls"]
141-
142118
for u in urls:
143119
# if re.search(r"members\.adulttime\.com", u):
144120
if re.search(r"\.adulttime\.com", u):
@@ -176,7 +152,7 @@ def get_download():
176152
else:
177153
log.debug(f"No Interactive for this ID")
178154

179-
except KeyError as error:
155+
except KeyError:
180156
log.error(
181157
"File '%s' can not be read, invailed format" % fpw
182158
)
@@ -193,7 +169,6 @@ def get_download():
193169

194170

195171
def map_file_with_funscript(sceneinfo, funscriptfile):
196-
197172
scenefiles = sceneinfo["files"]
198173
for u in scenefiles:
199174
filepath = os.path.dirname(os.path.abspath(u["path"]))

plugins/AdulttimeInteractiveDL/AdulttimeInteractiveDL.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: "Adulttime Interactive Downloader"
22
description: Download Interactive Files for Adulttime Scenes
3-
version: 0.1.1
3+
version: 0.1.2
44
url: https://github.com/tooliload/StashAppCommunityScripts/tree/main/plugins/AdulttimeInteractiveDL
55
exec:
66
- python

plugins/PythonToolsInstaller/PythonToolsInstaller.py

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import requests, os, shutil
2-
import re, sys, json, time, sysconfig
3-
from inspect import getmembers, isfunction
1+
import shutil
2+
import sys, json, sysconfig
43
from venv import create
5-
from os.path import join, expanduser, abspath
4+
from os.path import abspath
65
import subprocess
76
import shutil
87

@@ -32,18 +31,12 @@ def run(input, output):
3231
PLUGIN_DIR = input["server_connection"]["PluginDir"]
3332
modeArg = input['args']["mode"]
3433

35-
try:
36-
if modeArg == "" or modeArg == "add":
37-
return
38-
39-
elif modeArg == "process_py_stashapi_tools":
40-
get_download_py_stashapp_tools(PLUGIN_DIR)
41-
42-
except Exception as e:
43-
raise
44-
output["error"] = str(e)
34+
if modeArg == "" or modeArg == "add":
4535
return
4636

37+
elif modeArg == "process_py_stashapi_tools":
38+
get_download_py_stashapp_tools(PLUGIN_DIR)
39+
4740
output["output"] = "ok"
4841

4942
def get_download_py_stashapp_tools(PLUGIN_DIR):
@@ -56,9 +49,9 @@ def get_download_py_stashapp_tools(PLUGIN_DIR):
5649
# where requirements.txt is in same dir as this script
5750
subprocess.run([f"{used_dir}/venv/bin/pip", "install", "-r", abspath(f"{used_dir}/packages/stashtools.txt")],stdout=None)
5851

59-
# venv/lib/python3.12/site-packages/stashapp_tools-
52+
# venv/lib/python3.11/site-packages/stashapp_tools-
6053

61-
src = f"{used_dir}/venv/lib/python3.11/site-packages"
54+
src = f"{used_dir}/venv/lib/python3.12/site-packages"
6255
destination = shutil.copytree(src, org_packagedir,ignore_func,None,shutil.copy2,False,True)
6356
fp = open(f'{used_dir}/copydo.txt', 'w+')
6457
fp.write("%s\n" % print(destination))

plugins/PythonToolsInstaller/PythonToolsInstaller.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: "Python Tools Installer"
22
description: Download stashapp-tools for DockerEnv
3-
version: 0.1.
3+
version: 0.1.2
44
url: https://github.com/tooliload/StashAppCommunityScripts/tree/main/plugins/PythonToolsInstaller
55
exec:
66
- python

0 commit comments

Comments
 (0)