refrag code for RenameFile plugin

This commit is contained in:
David Maisonave
2024-08-27 19:24:28 -04:00
parent 7063168536
commit aba11888ce
15 changed files with 848 additions and 430 deletions

View File

@@ -0,0 +1 @@
Hello, world#2 from batch script! arg =

View File

@@ -0,0 +1 @@
Hello, world from batch script! arg = "--name David"

View File

@@ -299,7 +299,7 @@ class StashPluginHelper(StashInterface):
if printTo == 0: printTo = self.log_to_err_set
lineNo = inspect.currentframe().f_back.f_lineno
self.Log(logMsg, printTo, logging.ERROR, lineNo, toAscii=toAscii)
def Status(self, printTo = 0, logLevel = logging.INFO, lineNo = -1):
if printTo == 0: printTo = self.log_to_norm
if lineNo == -1:
@@ -351,7 +351,65 @@ class StashPluginHelper(StashInterface):
DestData = self.find_scene(DestData)
return self._mergeMetadata.merge(SrcData, DestData)
# Extends class StashInterface with functions which are not yet in the class
def Progress(self, currentIndex, maxCount):
progress = (currentIndex / maxCount) if currentIndex < maxCount else (maxCount / currentIndex)
self.log.progress(progress)
def run_plugin(self, plugin_id, task_mode=None, args:dict={}, asyn=False):
"""Runs a plugin operation.
The operation is run immediately and does not use the job queue.
Args:
plugin_id (ID): plugin_id
task_name (str, optional): Plugin task to perform
args (dict, optional): Arguments to pass to plugin. Plugin access via JSON_INPUT['args']
Returns:
A map of the result.
"""
query = """mutation RunPluginOperation($plugin_id: ID!, $args: Map!) {
runPluginOperation(plugin_id: $plugin_id, args: $args)
}"""
if task_mode != None:
args.update({"mode" : task_mode})
variables = {
"plugin_id": plugin_id,
"args": args,
}
if asyn:
self.Submit(self.call_GQL, query, variables)
return f"Made asynchronous call for plugin {plugin_id}"
else:
return self.call_GQL(query, variables)
def find_duplicate_scenes_diff(self, distance: PhashDistance=PhashDistance.EXACT, fragment='id', duration_diff: float=10.00 ):
query = """
query FindDuplicateScenes($distance: Int, $duration_diff: Float) {
findDuplicateScenes(distance: $distance, duration_diff: $duration_diff) {
...SceneSlim
}
}
"""
if fragment:
query = re.sub(r'\.\.\.SceneSlim', fragment, query)
else:
query += "fragment SceneSlim on Scene { id }"
variables = { "distance": distance, "duration_diff": duration_diff }
result = self.call_GQL(query, variables)
return result['findDuplicateScenes']
# #################################################################################################
# The below functions extends class StashInterface with functions which are not yet in the class
def get_all_scenes(self):
query_all_scenes = """
query AllScenes {
allScenes {
id
updated_at
}
}
"""
return self.call_GQL(query_all_scenes)
def metadata_autotag(self, paths:list=[], performers:list=[], studios:list=[], tags:list=[]):
query = """
mutation MetadataAutoTag($input:AutoTagMetadataInput!) {
@@ -393,23 +451,6 @@ class StashPluginHelper(StashInterface):
def rename_generated_files(self):
return self.call_GQL("mutation MigrateHashNaming {migrateHashNaming}")
def find_duplicate_scenes_diff(self, distance: PhashDistance=PhashDistance.EXACT, fragment='id', duration_diff: float=10.00 ):
query = """
query FindDuplicateScenes($distance: Int, $duration_diff: Float) {
findDuplicateScenes(distance: $distance, duration_diff: $duration_diff) {
...SceneSlim
}
}
"""
if fragment:
query = re.sub(r'\.\.\.SceneSlim', fragment, query)
else:
query += "fragment SceneSlim on Scene { id }"
variables = { "distance": distance, "duration_diff": duration_diff }
result = self.call_GQL(query, variables)
return result['findDuplicateScenes']
class mergeMetadata: # A class to merge scene metadata from source scene to destination scene
srcData = None

View File

@@ -54,7 +54,7 @@ stash = StashPluginHelper(
maxbytes=10*1024*1024,
apiKey=parse_args.apikey
)
stash.Status()
stash.Status(logLevel=logging.DEBUG)
stash.Log(f"\nStarting (__file__={__file__}) (stash.CALLED_AS_STASH_PLUGIN={stash.CALLED_AS_STASH_PLUGIN}) (stash.DEBUG_TRACING={stash.DEBUG_TRACING}) (stash.DRY_RUN={stash.DRY_RUN}) (stash.PLUGIN_TASK_NAME={stash.PLUGIN_TASK_NAME})************************************************")
exitMsg = "Change success!!"
@@ -162,29 +162,31 @@ class StashScheduler: # Stash Scheduler
weekDays = task['weekday'].lower()
if 'monthly' in task:
stash.Log(f"Adding to scheduler task '{task['task']}' monthly on number {task['monthly']} {task['weekday']} at {task['time']}")
elif task['weekday'] == "every":
stash.Log(f"Adding to scheduler task '{task['task']}' (weekly) every day at {task['time']}")
else:
stash.Log(f"Adding to scheduler task '{task['task']}' (weekly) every {task['weekday']} at {task['time']}")
hasValidDay = False
if "monday" in weekDays:
if "monday" in weekDays or "every" in weekDays:
schedule.every().monday.at(task['time']).do(self.runTask, task)
hasValidDay = True
if "tuesday" in weekDays:
if "tuesday" in weekDays or "every" in weekDays:
schedule.every().tuesday.at(task['time']).do(self.runTask, task)
hasValidDay = True
if "wednesday" in weekDays:
if "wednesday" in weekDays or "every" in weekDays:
schedule.every().wednesday.at(task['time']).do(self.runTask, task)
hasValidDay = True
if "thursday" in weekDays:
if "thursday" in weekDays or "every" in weekDays:
schedule.every().thursday.at(task['time']).do(self.runTask, task)
hasValidDay = True
if "friday" in weekDays:
if "friday" in weekDays or "every" in weekDays:
schedule.every().friday.at(task['time']).do(self.runTask, task)
hasValidDay = True
if "saturday" in weekDays:
if "saturday" in weekDays or "every" in weekDays or "weekend" in weekDays:
schedule.every().saturday.at(task['time']).do(self.runTask, task)
hasValidDay = True
if "sunday" in weekDays:
if "sunday" in weekDays or "every" in weekDays or "weekend" in weekDays:
schedule.every().sunday.at(task['time']).do(self.runTask, task)
hasValidDay = True
@@ -214,7 +216,7 @@ class StashScheduler: # Stash Scheduler
if task['task'] == "Clean":
result = self.jobIdOutput(stash.metadata_clean(paths=targetPaths, dry_run=stash.DRY_RUN))
elif task['task'] == "Clean Generated Files":
result = self.jobIdOutput(stash.metadata_clean_generated()))
result = self.jobIdOutput(stash.metadata_clean_generated())
elif task['task'] == "Generate":
result = self.jobIdOutput(stash.metadata_generate())
elif task['task'] == "Backup":
@@ -302,31 +304,43 @@ class StashScheduler: # Stash Scheduler
def runPluginTask(self, task):
try:
if 'pluginId' in task and task['pluginId'] != "":
invalidDir = False
validDirMsg = ""
if 'validateDir' in task and task['validateDir'] != "":
invalidDir = True
communityPluginPath = f"{stash.PLUGINS_PATH}{os.sep}community{os.sep}{task['validateDir']}"
basePluginPath = f"{stash.PLUGINS_PATH}{os.sep}{task['validateDir']}"
if os.path.exists(communityPluginPath):
invalidDir = False
validDirMsg = f"Valid path in {communityPluginPath}"
elif os.path.exists(basePluginPath):
invalidDir = False
validDirMsg = f"Valid path in {basePluginPath}"
if invalidDir:
stash.Error(f"Could not run task '{task['task']}' because sub directory '{task['validateDir']}' does not exist under path '{stash.PLUGINS_PATH}'")
else:
if task['task'] == "Delete Duplicates" and not turnOnSchedulerDeleteDup:
stash.Warn(f"Not running task {task['task']}, because [Delete Duplicate Scheduler] is NOT enabled. See Stash UI option Settings->Plugins->Plugins->FileMonitor->[Delete Duplicate Scheduler]")
return None
stash.Trace(f"Running plugin task pluginID={task['pluginId']}, task name = {task['task']}. {validDirMsg}")
return stash.run_plugin_task(plugin_id=task['pluginId'], task_name=task['task'])
invalidDir = False
validDirMsg = ""
if 'validateDir' in task and task['validateDir'] != "":
invalidDir = True
communityPluginPath = f"{stash.PLUGINS_PATH}{os.sep}community{os.sep}{task['validateDir']}"
basePluginPath = f"{stash.PLUGINS_PATH}{os.sep}{task['validateDir']}"
if os.path.exists(communityPluginPath):
invalidDir = False
validDirMsg = f"Valid path in {communityPluginPath}"
elif os.path.exists(basePluginPath):
invalidDir = False
validDirMsg = f"Valid path in {basePluginPath}"
if invalidDir:
stash.Error(f"Could not run task '{task['task']}' because sub directory '{task['validateDir']}' does not exist under path '{stash.PLUGINS_PATH}'")
return None
if not turnOnSchedulerDeleteDup and (task['task'] == "Delete Duplicates" or ('taskName' in task and task['taskName'] == "Delete Duplicates") or ('taskMode' in task and task['taskMode'] == "delete_duplicates_task")):
stash.Warn(f"Not running task {task['task']}, because [Delete Duplicate Scheduler] is NOT enabled. See Stash UI option Settings->Plugins->Plugins->FileMonitor->[Delete Duplicate Scheduler]")
return None
# The pluginId field is only here for backward compatibility, and should not be used in future scheduler configurations
if 'pluginId' in task and task['pluginId'] != "": # Obsolete method
stash.Trace(f"Adding to Task Queue plugin task pluginID={task['pluginId']}, task name = {task['task']}. {validDirMsg}")
return stash.run_plugin_task(plugin_id=task['pluginId'], task_name=task['task'])
else:
stash.Error(f"Can not run task '{task['task']}', because it's an invalid task.")
stash.LogOnce(f"If task '{task['task']}' is supposed to be a built-in task, check for correct task name spelling.")
stash.LogOnce(f"If task '{task['task']}' is supposed to be a plugin, make sure to include the pluginId field in the task. task={task}")
taskName = None
taskMode = None
if 'taskName' in task:
taskName = task['taskName']
if 'taskMode' in task:
taskMode = task['taskMode']
if ('taskQue' in task and task['taskQue'] == False) or taskName == None:
stash.Log(f"Running plugin task pluginID={task['task']}, task mode = {taskMode}. {validDirMsg}")
# Asynchronous threading logic to call run_plugin, because it's a blocking call.
stash.run_plugin(plugin_id=task['task'], task_mode=taskMode, asyn=True)
return None
else:
stash.Trace(f"Adding to Task Queue plugin task pluginID={task['task']}, task name = {taskName}. {validDirMsg}")
return stash.run_plugin_task(plugin_id=task['task'], task_name=taskName)
except Exception as e:
stash.LogOnce(f"Failed to call plugin {task['task']} with plugin-ID {task['pluginId']}. Error: {e}")
pass
@@ -702,7 +716,7 @@ def start_library_monitor_service():
if stash.API_KEY:
args = args + ["-a", stash.API_KEY]
stash.ExecutePythonScript(args)
if parse_args.stop or parse_args.restart or stash.PLUGIN_TASK_NAME == "stop_library_monitor":
stop_library_monitor()
if parse_args.restart:
@@ -720,7 +734,7 @@ elif stash.PLUGIN_TASK_NAME == StartFileMonitorAsAPluginTaskID:
elif not stash.CALLED_AS_STASH_PLUGIN:
try:
start_library_monitor()
stash.Trace(f"Command line FileMonitor EXIT")
stash.Trace("Command line FileMonitor EXIT")
except Exception as e:
tb = traceback.format_exc()
stash.Error(f"Exception while running FileMonitor from the command line. Error: {e}\nTraceBack={tb}")

View File

@@ -11,15 +11,15 @@ config = {
# The hour section in time MUST be a two digit number, and use military time format. Example: 1PM = "13:00" and 1AM = "01:00"
# Note: Look at filemonitor_task_examples.py for many example task having more detailed usage.
"task_scheduler": [
# To create a daily task, include each day of the week for the weekday field.
# To create a daily task, include each day of the week for the weekday field or "every"
# Optional field for task "Auto Tag" is 'paths'. For detail usage, see example #A3: in filemonitor_task_examples.py
{"task" : "Auto Tag", "weekday" : "monday,tuesday,wednesday,thursday,friday,saturday,sunday", "time" : "05:00"}, # Auto Tag -> [Auto Tag] (Daily at 6AM)
# Task "Create Tags" is a plugin task. All plugin task have a REQUIRED pluginId field and an optional validateDir field. For detail usage, see examples #B1 and #B2 in filemonitor_task_examples.py
{"task" : "Create Tags", "pluginId" : "pathParser", "validateDir" : "pathParser",
"weekday" : "monday,tuesday,wednesday,thursday,friday,saturday,sunday", "time" : "05:30"}, # [Plugin Tasks] - > [Path Parser] -> [Create Tags] (Daily at 5AM) : This task requires plugin [Path Parser]
# The following task runs plugin DupFileManager if the plugin is installed.
{"task" : "Tag Duplicates", "pluginId" : "DupFileManager", "validateDir" : "DupFileManager",
"weekday" : "monday,tuesday,wednesday,thursday,friday,saturday,sunday", "time" : "02:30"}, # [Plugin Tasks] -> DupFileManager -> [Delete Duplicates] (Daily at 2:30AM)
# Task "Create Tags" is a plugin task. Optional fields are taskName and validateDir field. For detail usage, see examples #B1, #B2, #B3, and #B4 in filemonitor_task_examples.py
{"task" : "pathParser", "taskName" : "Create Tags", "validateDir" : "pathParser",
"weekday" : "every", "time" : "05:30"}, # [Plugin Tasks] - > [Path Parser] -> [Create Tags] (Daily at 5AM) : This task requires plugin [Path Parser]
# The following task runs plugin DupFileManager (tag_duplicates_task) if the plugin is installed. The task runs in the background because of "taskQue" : False
{"task" : "DupFileManager", "taskMode" : "tag_duplicates_task", "validateDir" : "DupFileManager", "taskQue" : False,
"weekday" : "every", "time" : "02:30"}, # [Plugin Tasks] -> DupFileManager -> [Delete Duplicates] (Daily at 2:30AM)
{"task" : "Optimise Database", "weekday" : "monday,tuesday,wednesday,thursday,friday", "time" : "07:00"}, # Maintenance -> [Optimise Database] (Every weekday at 7AM)
# The following tasks are scheduled weekly
@@ -41,7 +41,7 @@ config = {
# Optional field for task "Backup" is maxBackup. For detail usage, see example #A5 in filemonitor_task_examples.py
{"task" : "Backup", "weekday" : "sunday", "time" : "01:00", "monthly" : 2}, # Backup -> [Backup] 2nd sunday of the month at 1AM (01:00)
# The following task requires plugin DupFileManager and UI option [Delete Duplicate Scheduler] enabled.
{"task" : "Delete Duplicates", "pluginId" : "DupFileManager", "validateDir" : "DupFileManager",
{"task" : "DupFileManager", "taskName" : "Delete Duplicates", "validateDir" : "DupFileManager",
"weekday" : "sunday", "time" : "02:00", "monthly" : 2}, # [Plugin Tasks] -> DupFileManager -> [Delete Duplicates] 2nd sunday of the month at 2AM (02:00)
# The [CheckStashIsRunning] task checks if Stash is running. If not running, it will start up stash.

View File

@@ -8,11 +8,9 @@ self_unit_test = {
{"task" : "TestBadTaskNameError", "minutes" : 1}, # Test invalid task name
{"task" : "execute", "minutes" : 1}, # Test invalid task (missing command)
{"task" : "python", "minutes" : 1}, # Test invalid task (missing scripts)
{"task" : "PluginWithOutID", "minutes" : 1}, # Test invalid task (missing pluginId)
{"task" : "execute", "command" : "", "minutes" : 1}, # Test invalid task (missing command)
{"task" : "python", "script" : "", "minutes" : 1}, # Test invalid task (missing scripts)
{"task" : "PluginWithOutID", "pluginId" : "", "minutes" : 1}, # Test invalid task (missing pluginId)
{"task" : "Foo","pluginId":"foo","validateDir":"foo", "minutes" : 1}, # Test invalid task (missing plugin directory)
{"task" : "Foo","taskName":"foo","validateDir":"foo", "minutes" : 1}, # Test invalid task (missing plugin directory)
{"task" : "Log", "msg" : "Testing Scheduled Log", "minutes" : 1}, # Test plugin log file
{"task" : "Trace", "minutes" : 1}, # Test plugin trace logging
{"task" : "LogOnce", "seconds" :15}, # Test LogOnce
@@ -23,24 +21,25 @@ self_unit_test = {
],
"task_scheduler_set_time": [
# Test [Delete Duplicates] with [Delete Duplicate Scheduler] disabled, and then with it enabled.
{"task" : "Delete Duplicates", "pluginId" : "DupFileManager", "validateDir" : "DupFileManager","weekday" : "sunday", "time" : "17:56"}, # [Plugin Tasks] -> DupFileManager -> [Delete Duplicates]
{"task" : "Generate", "weekday" : "sunday", "time" : "17:56"},
{"task" : "Clean", "weekday" : "sunday", "time" : "17:56"},
{"task" : "Auto Tag", "weekday" : "sunday", "time" : "17:56"},
{"task" : "Optimise Database", "weekday" : "sunday", "time" : "17:56"},
{"task" : "Create Tags", "pluginId" : "pathParser", "validateDir" : "pathParser", "weekday" : "sunday", "time" : "17:56"}, # In task queue as -> Running plugin task: Create Tags
{"task" : "Tag Duplicates", "pluginId" : "DupFileManager", "validateDir" : "DupFileManager", "weekday" : "sunday", "time" : "17:56"}, # [Plugin Tasks] -> DupFileManager -> [Tag Duplicates]
{"task" : "Scan","paths": [r"B:\_\SpecialSet", r"C:\foo"], "weekday" : "sunday", "time" : "17:56"},
{"task" : "GQL", "input" : "mutation OptimiseDatabase { optimiseDatabase }", "weekday" : "sunday", "time" : "17:56"}, # In task queue as -> Optimising database...
{"task" : "Clean Generated Files", "weekday" : "sunday", "time" : "17:56"},
{"task" : "RenameGeneratedFiles", "weekday" : "sunday", "time" : "17:56"}, # In task queue as -> Migrating scene hashes...
{"task" : "Backup", "maxBackups" : 0, "weekday" : "sunday", "time" : "17:56"}, # Does NOT show up in the Task Queue. Must check STASH log file to verify run.
{"task" : "python", "script" : "<plugin_path>test_hello_world2.py", "weekday" : "sunday", "time" : "17:56"}, # Does NOT show up in the Task Queue. Check FileMonitor log file, and look for -> Task 'python' result=???
{"task" : "python", "script" : "<plugin_path>test_hello_world.py", "detach" : False, "weekday" : "sunday", "time" : "17:56"}, # Does NOT show up in the Task Queue. Check FileMonitor log file, and look for -> Task 'python' result=???
{"task" : "execute", "command" : "<plugin_path>test_hello_world2.cmd", "weekday" : "sunday", "time" : "17:56"}, # Does NOT show up in the Task Queue. Check FileMonitor log file, and look for -> Task 'execute' result=???
{"task" : "execute", "command" : "<plugin_path>test_hello_world.bat", "args" : "--name David", "weekday" : "sunday", "time" : "17:56"}, # Does NOT show up in the Task Queue. Check FileMonitor log file, and look for -> Task 'execute' result=???
{"task" : "DupFileManager", "taskName" : "Delete Duplicates", "validateDir" : "DupFileManager", "weekday" : "every", "time" : "09:05"}, # [Plugin Tasks] -> DupFileManager -> [Delete Duplicates]
{"task" : "Generate", "weekday" : "every", "time" : "09:05"},
{"task" : "Clean", "weekday" : "every", "time" : "09:05"},
{"task" : "Auto Tag", "weekday" : "every", "time" : "09:05"},
{"task" : "Optimise Database", "weekday" : "every", "time" : "09:05"},
{"task" : "pathParser", "taskName" : "Create Tags", "validateDir" : "pathParser", "weekday" : "every", "time" : "09:05"}, # In task queue as -> Running plugin task: Create Tags
{"task" : "DupFileManager", "taskMode" : "tag_duplicates_task", "taskQue":False, "weekday" : "every", "time" : "10:09"}, # Does NOT run in the task queue
{"task" : "DupFileManager", "taskName" : "Tag Duplicates", "validateDir" : "DupFileManager", "weekday" : "every", "time" : "10:30"}, # [Plugin Tasks] -> DupFileManager -> [Tag Duplicates]
{"task" : "Scan","paths": [r"B:\_\SpecialSet", r"C:\foo"], "weekday" : "every", "time" : "09:05"},
{"task" : "GQL", "input" : "mutation OptimiseDatabase { optimiseDatabase }", "weekday" : "every", "time" : "09:05"}, # In task queue as -> Optimising database...
{"task" : "Clean Generated Files", "weekday" : "every", "time" : "09:05"},
{"task" : "RenameGeneratedFiles", "weekday" : "every", "time" : "09:05"}, # In task queue as -> Migrating scene hashes...
{"task" : "Backup", "maxBackups" : 0, "weekday" : "every", "time" : "09:05"}, # Does NOT show up in the Task Queue. Must check STASH log file to verify run.
{"task" : "python", "script" : "<plugin_path>test_hello_world2.py", "weekday" : "every", "time" : "09:05"}, # Does NOT show up in the Task Queue. Check FileMonitor log file, and look for -> Task 'python' result=???
{"task" : "python", "script" : "<plugin_path>test_hello_world.py", "detach" : False, "weekday" : "every", "time" : "09:05"}, # Does NOT show up in the Task Queue. Check FileMonitor log file, and look for -> Task 'python' result=???
{"task" : "execute", "command" : "<plugin_path>test_hello_world2.cmd", "weekday" : "every", "time" : "09:05"}, # Does NOT show up in the Task Queue. Check FileMonitor log file, and look for -> Task 'execute' result=???
{"task" : "execute", "command" : "<plugin_path>test_hello_world.bat", "args" : "--name David", "weekday" : "every", "time" : "09:05"}, # Does NOT show up in the Task Queue. Check FileMonitor log file, and look for -> Task 'execute' result=???
],
# MUST ToDo: Always set selfUnitTest to False before checking in this code!!!
"selfUnitTest_repeat" : False , # Enable to turn on self unit test.
"selfUnitTest_set_time" : False , # Enable to turn on self unit test.
"selfUnitTest_set_time" : True , # Enable to turn on self unit test.
}

View File

@@ -30,20 +30,24 @@ task_examples = {
# And days usage is discourage, because it only works if FileMonitor is running for X many days non-stop.
# The below example tasks are done using hours and minutes, however any of these task types can be converted to a daily, weekly, or monthly syntax.
# Example#B1: The following task is the syntax used for a plugin. A plugin task requires the plugin name for the [task] field, and the plugin-ID for the [pluginId] field.
{"task" : "PluginButtonName_Here", "pluginId" : "PluginId_Here", "hours" : 0}, # The zero frequency value makes this task disabled.
# Example#B1: The following task is the syntax used for a plugin. A plugin task requires the plugin-ID for the [task] field. Optional fields are taskName, taskMode, validateDir, and taskQue.
{"task" : "PluginId_Here", "taskName" : "Task Name or Plugin Button Name Here", "hours" : 0}, # The zero frequency value makes this task disabled.
# Example#B2: Optionally, the validateDir field can be included which is used to validate that the plugin is installed either under the plugins folder or under the plugins-community folder.
{"task" : "PluginButtonName_Here", "pluginId" : "PluginId_Here", "validateDir" : "UsuallySameAsPluginID", "hours" : 0}, # The zero frequency value makes this task disabled.
{"task" : "PluginId_Here", "taskName" : "Task Name or Plugin Button Name Here", "validateDir" : "UsuallySameAsPluginID", "hours" : 0},
# Example#B3: To run a plugin WITHOUT using the Task Queue, use taskMode instead of taskName and/or add field "taskQue":False. The plugin will run immediately
{"task" : "PluginId_Here", "taskMode" : "Plugin_Task_MODE", "taskQue" : False, "hours" : 0}, # Do NOT use taskName when including "taskQue":False
# Example#B4: When taskName field is missing, it will always run the task without using the Task Queue. The plugin will run immediately
{"task" : "PluginId_Here", "hours" : 0},
# Example#B3: Task to execute a command
# Example#C1: Task to execute a command
{"task" : "execute", "command" : "C:\\MyPath\\HelloWorld.bat", "hours" : 0},
# Example#B4: Task to execute a command with optional args field, and using keyword <plugin_path>, which gets replaced with filemonitor.py current directory.
# Example#C2: Task to execute a command with optional args field, and using keyword <plugin_path>, which gets replaced with filemonitor.py current directory.
{"task" : "execute", "command" : "<plugin_path>HelloWorld.cmd", "args" : "--name David", "minutes" : 0},
# Example#C1 Some OS may need the "command" field, which specifies the binary path.
# Example#D1 Some OS may need the "command" field, which specifies the binary path.
{"task" : "CheckStashIsRunning", "command" : "<stash_path>stash-linux-arm64v8", "minutes" :0},
# Example#C2 RunAfter field can be used to specify task to run after starting Stash
# Example#D2 RunAfter field can be used to specify task to run after starting Stash
{"task" : "CheckStashIsRunning", "RunAfter" : [{"task" : "Scan"},{"task" : "Backup", "maxBackup" : 0},{"task" : "Clean"}], "minutes" :0},
],
}