forked from Github/Axter-Stash
Update StashPluginHelper.py
This commit is contained in:
@@ -41,6 +41,7 @@ class StashPluginHelper(StashInterface):
|
|||||||
FRAGMENT_SERVER = None
|
FRAGMENT_SERVER = None
|
||||||
STASHPATHSCONFIG = None
|
STASHPATHSCONFIG = None
|
||||||
STASH_PATHS = []
|
STASH_PATHS = []
|
||||||
|
API_KEY = None
|
||||||
|
|
||||||
# printTo argument
|
# printTo argument
|
||||||
LOG_TO_FILE = 1
|
LOG_TO_FILE = 1
|
||||||
@@ -95,6 +96,7 @@ class StashPluginHelper(StashInterface):
|
|||||||
config = None, # From pluginName_config.py or pluginName_setting.py
|
config = None, # From pluginName_config.py or pluginName_setting.py
|
||||||
fragmentServer = None,
|
fragmentServer = None,
|
||||||
stash_url = None, # Stash URL (endpoint URL) Example: http://localhost:9999
|
stash_url = None, # Stash URL (endpoint URL) Example: http://localhost:9999
|
||||||
|
apiKey = None, # API Key only needed when username and password set while running script via command line
|
||||||
DebugTraceFieldName = "zzdebugTracing",
|
DebugTraceFieldName = "zzdebugTracing",
|
||||||
DryRunFieldName = "zzdryRun",
|
DryRunFieldName = "zzdryRun",
|
||||||
setStashLoggerAsPluginLogger = False):
|
setStashLoggerAsPluginLogger = False):
|
||||||
@@ -122,7 +124,6 @@ class StashPluginHelper(StashInterface):
|
|||||||
self.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(pathlib.Path(self.MAIN_SCRIPT_NAME).resolve().parent), 'PluginDir': pathlib.Path(self.MAIN_SCRIPT_NAME).resolve().parent}
|
self.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(pathlib.Path(self.MAIN_SCRIPT_NAME).resolve().parent), 'PluginDir': pathlib.Path(self.MAIN_SCRIPT_NAME).resolve().parent}
|
||||||
|
|
||||||
if debugTracing: self.DEBUG_TRACING = debugTracing
|
if debugTracing: self.DEBUG_TRACING = debugTracing
|
||||||
apiKey = ""
|
|
||||||
if config:
|
if config:
|
||||||
self.pluginConfig = config
|
self.pluginConfig = config
|
||||||
if 'apiKey' in self.pluginConfig and self.pluginConfig['apiKey'] != "":
|
if 'apiKey' in self.pluginConfig and self.pluginConfig['apiKey'] != "":
|
||||||
@@ -132,6 +133,9 @@ class StashPluginHelper(StashInterface):
|
|||||||
if DryRunFieldName in self.pluginConfig:
|
if DryRunFieldName in self.pluginConfig:
|
||||||
self.DRY_RUN = self.pluginConfig[DryRunFieldName]
|
self.DRY_RUN = self.pluginConfig[DryRunFieldName]
|
||||||
|
|
||||||
|
if apiKey and apiKey != "":
|
||||||
|
self.FRAGMENT_SERVER['ApiKey'] = apiKey
|
||||||
|
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
RUNNING_IN_COMMAND_LINE_MODE = True
|
RUNNING_IN_COMMAND_LINE_MODE = True
|
||||||
if not debugTracing or not stash_url:
|
if not debugTracing or not stash_url:
|
||||||
@@ -181,6 +185,8 @@ class StashPluginHelper(StashInterface):
|
|||||||
self.DEBUG_TRACING = self.pluginSettings[DebugTraceFieldName]
|
self.DEBUG_TRACING = self.pluginSettings[DebugTraceFieldName]
|
||||||
if DryRunFieldName in self.pluginSettings:
|
if DryRunFieldName in self.pluginSettings:
|
||||||
self.DRY_RUN = self.pluginSettings[DryRunFieldName]
|
self.DRY_RUN = self.pluginSettings[DryRunFieldName]
|
||||||
|
if 'apiKey' in self.STASH_CONFIGURATION:
|
||||||
|
self.API_KEY = self.STASH_CONFIGURATION['apiKey']
|
||||||
if self.DEBUG_TRACING: self.LOG_LEVEL = logging.DEBUG
|
if self.DEBUG_TRACING: self.LOG_LEVEL = logging.DEBUG
|
||||||
|
|
||||||
logging.basicConfig(level=self.LOG_LEVEL, format=logFormat, datefmt=dateFmt, handlers=[RFH])
|
logging.basicConfig(level=self.LOG_LEVEL, format=logFormat, datefmt=dateFmt, handlers=[RFH])
|
||||||
|
|||||||
Reference in New Issue
Block a user