Add plugin Adulttime Interactive Downloader (#240)

* Create requirements.txt

* Add files via upload

* Create empty

* Yarned Files

	modified:   plugins/AdulttimeInteractiveDL/AdulttimeInteractiveDL.py
	modified:   plugins/AdulttimeInteractiveDL/AdulttimeInteractiveDL.yml
	deleted:    plugins/AdulttimeInteractiveDL/cache/empty
	modified:   plugins/AdulttimeInteractiveDL/requirements.txt

* - Added Return on Error with stashapi
modified:   plugins/AdulttimeInteractiveDL/AdulttimeInteractiveDL.py

- Add new Plugin "PythonToolsInstaller" for Docker ENV, to create VENV with stashtools to use with other Plugins
new file:   plugins/PythonToolsInstaller/PythonToolsInstaller.py
new file:   plugins/PythonToolsInstaller/PythonToolsInstaller.yml
new file:   plugins/PythonToolsInstaller/packages/stashtools.txt

Files yarned.
This commit is contained in:
tooliload
2024-06-24 20:47:10 +02:00
committed by GitHub
parent b339766c8a
commit eb09dbd72b
6 changed files with 385 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
import requests, os, shutil
import re, sys, json, time, sysconfig
from inspect import getmembers, isfunction
from venv import create
from os.path import join, expanduser, abspath
import subprocess
import shutil
def main():
input = None
if len(sys.argv) < 2:
input = readJSONInput()
output = {}
run(input, output)
out = json.dumps(output)
print(out + "\n")
def readJSONInput():
input = sys.stdin.read()
return json.loads(input)
def run(input, output):
if input == "None" or input == "":
return
PLUGIN_DIR = input["server_connection"]["PluginDir"]
modeArg = input['args']["mode"]
try:
if modeArg == "" or modeArg == "add":
return
elif modeArg == "process_py_stashapi_tools":
get_download_py_stashapp_tools(PLUGIN_DIR)
except Exception as e:
raise
output["error"] = str(e)
return
output["output"] = "ok"
def get_download_py_stashapp_tools(PLUGIN_DIR):
org_packagedir = sysconfig.get_paths()["purelib"] # /usr/lib/python3.11/site-packages/usr/lib/python3.11/site-packages
used_dir = f"{PLUGIN_DIR}"
create(f"{used_dir}/venv/", with_pip=True)
# where requirements.txt is in same dir as this script
subprocess.run([f"{used_dir}/venv/bin/pip", "install", "-r", abspath(f"{used_dir}/packages/stashtools.txt")],stdout=None)
# venv/lib/python3.11/site-packages/stashapp_tools-
src = f"{used_dir}/venv/lib/python3.11/site-packages"
destination = shutil.copytree(src, org_packagedir,ignore_func,None,shutil.copy2,False,True)
fp = open(f'{used_dir}/copydo.txt', 'w+')
fp.write("%s\n" % print(destination))
def ignore_func(src, names):
return ['env'] if 'env' in names else []
main()

View File

@@ -0,0 +1,13 @@
name: "Python Tools Installer"
description: Download stashapp-tools for DockerEnv
version: 0.1.
url: https://github.com/tooliload/StashAppCommunityScripts/tree/main/plugins/PythonToolsInstaller
exec:
- python
- "{pluginDir}/PythonToolsInstaller.py"
interface: raw
tasks:
- name: "Install"
description: Install Python Module stashapi-tools
defaultArgs:
mode: process_py_stashapi_tools

View File

@@ -0,0 +1 @@
stashapp-tools