Moved rarely used fields to config file

This commit is contained in:
David Maisonave
2024-07-29 03:19:46 -04:00
parent 80d4b6db16
commit 755c5b1d7f
6 changed files with 40 additions and 32 deletions

View File

@@ -20,6 +20,7 @@ from watchdog.observers import Observer # This is also needed for event attribut
import watchdog # pip install watchdog # https://pythonhosted.org/watchdog/
from threading import Lock, Condition
from multiprocessing import shared_memory
from changefilemonitor_config import config # Import settings from changefilemonitor_config.py
# **********************************************************************
# Constant global variables --------------------------------------------
@@ -91,7 +92,7 @@ if gettingCalledAsStashPlugin and StdInRead:
FRAGMENT_SERVER = json_input["server_connection"]
else:
runningInPluginMode = False
FRAGMENT_SERVER = {'Scheme': 'http', 'Host': '0.0.0.0', 'Port': 9999, 'SessionCookie': {'Name': 'session', 'Value': '', 'Path': '', 'Domain': '', 'Expires': '0001-01-01T00:00:00Z', 'RawExpires': '', 'MaxAge': 0, 'Secure': False, 'HttpOnly': False, 'SameSite': 0, 'Raw': '', 'Unparsed': None}, 'Dir': os.path.dirname(Path(__file__).resolve().parent), 'PluginDir': Path(__file__).resolve().parent}
FRAGMENT_SERVER = {'Scheme': config['endpoint_Scheme'], 'Host': config['endpoint_Host'], 'Port': config['endpoint_Port'], 'SessionCookie': {'Name': 'session', 'Value': '', 'Path': '', 'Domain': '', 'Expires': '0001-01-01T00:00:00Z', 'RawExpires': '', 'MaxAge': 0, 'Secure': False, 'HttpOnly': False, 'SameSite': 0, 'Raw': '', 'Unparsed': None}, 'Dir': os.path.dirname(Path(__file__).resolve().parent), 'PluginDir': Path(__file__).resolve().parent}
print("Running in non-plugin mode!", file=sys.stderr)
stash = StashInterface(FRAGMENT_SERVER)
@@ -102,7 +103,6 @@ stashPaths = []
settings = {
"recursiveDisabled": False,
"runCleanAfterDelete": False,
"runGenerateContent": False,
"scanModified": False,
"zzdebugTracing": False,
"zzdryRun": False,
@@ -115,7 +115,7 @@ debugTracing = settings["zzdebugTracing"]
RECURSIVE = settings["recursiveDisabled"] == False
SCAN_MODIFIED = settings["scanModified"]
RUN_CLEAN_AFTER_DELETE = settings["runCleanAfterDelete"]
RUN_GENERATE_CONTENT = settings["runGenerateContent"]
RUN_GENERATE_CONTENT = config['runGenerateContent']
for item in STASHPATHSCONFIG:
stashPaths.append(item["path"])

View File

@@ -11,10 +11,6 @@ settings:
displayName: Run Clean
description: Enable to run metadata clean task after file deletion.
type: BOOLEAN
runGenerateContent:
displayName: Run Generate Content
description: Enable to run metadata_generate (Generate Content) after metadata scan.
type: BOOLEAN
scanModified:
displayName: Scan Modifications
description: Enable to monitor changes in file system for modification flag. This option is NOT needed for Windows, because on Windows changes are triggered via CREATE, DELETE, and MOVE flags. Other OS may differ.

View File

@@ -0,0 +1,12 @@
# Description: This is a Stash plugin which updates Stash if any changes occurs in the Stash library paths.
# By David Maisonave (aka Axter) Jul-2024 (https://www.axter.com/)
# Get the latest developers version from following link: https://github.com/David-Maisonave/Axter-Stash/tree/main/plugins/ChangeFileMonitor
config = {
# Enable to run metadata_generate (Generate Content) after metadata scan.
"runGenerateContent": False,
# The following fields are ONLY used when running ChangeFileMonitor in script mode
"endpoint_Scheme" : "http", # Define endpoint to use when contacting the Stash server
"endpoint_Host" : "0.0.0.0", # Define endpoint to use when contacting the Stash server
"endpoint_Port" : 9999, # Define endpoint to use when contacting the Stash server
}