forked from Github/Axter-Stash
Added issue templates
This commit is contained in:
@@ -61,6 +61,7 @@ class StashPluginHelper:
|
||||
STDIN_READ = None
|
||||
FRAGMENT_SERVER = None
|
||||
logger = None
|
||||
traceOncePreviousHits = []
|
||||
|
||||
# Prefix message value
|
||||
LEV_TRACE = "TRACE: "
|
||||
@@ -223,6 +224,20 @@ class StashPluginHelper:
|
||||
logMsg = f"Line number {lineNo}..."
|
||||
self.Log(logMsg, printTo, logLev, lineNo, self.LEV_TRACE, logAlways)
|
||||
|
||||
# Log once per session. Only logs the first time called from a particular line number in the code.
|
||||
def TraceOnce(self, logMsg = "", printTo = 0, logAlways = False):
|
||||
if printTo == 0: printTo = self.LOG_TO_FILE
|
||||
lineNo = inspect.currentframe().f_back.f_lineno
|
||||
logLev = logging.INFO if logAlways else logging.DEBUG
|
||||
if self.DEBUG_TRACING or logAlways:
|
||||
FuncAndLineNo = f"{inspect.currentframe().f_back.f_code.co_name}:{lineNo}"
|
||||
if FuncAndLineNo in traceOncePreviousHits:
|
||||
return
|
||||
traceOncePreviousHits.append(FuncAndLineNo)
|
||||
if logMsg == "":
|
||||
logMsg = f"Line number {lineNo}..."
|
||||
self.Log(logMsg, printTo, logLev, lineNo, self.LEV_TRACE, logAlways)
|
||||
|
||||
def Warn(self, logMsg, printTo = 0):
|
||||
if printTo == 0: printTo = self.log_to_wrn_set
|
||||
lineNo = inspect.currentframe().f_back.f_lineno
|
||||
|
||||
@@ -103,6 +103,7 @@ if plugin.CALLED_AS_STASH_PLUGIN:
|
||||
plugin.Trace(f"isJobWaitingToRun() = {isJobWaitingToRun()})")
|
||||
|
||||
# Reoccurring scheduler code
|
||||
# ToDo: Change the following functions into a class called reoccurringScheduler
|
||||
def runTask(task):
|
||||
import datetime
|
||||
plugin.Trace(f"Running task {task}")
|
||||
@@ -145,7 +146,10 @@ def reoccurringScheduler():
|
||||
plugin.Log(f"Adding to reoccurring scheduler task '{task['task']}' at {task['days']} days interval")
|
||||
schedule.every(task['days']).days.do(runTask, task)
|
||||
elif 'weekday' in task and task['weekday'].lower() in dayOfTheWeek and 'time' in task:
|
||||
plugin.Log(f"Adding to reoccurring scheduler task '{task['task']}' (weekly) every {task['weekday']} at {task['time']}")
|
||||
if 'monthly' in task:
|
||||
plugin.Log(f"Adding to reoccurring scheduler task '{task['task']}' monthly on number {task['monthly']} {task['weekday']} at {task['time']}")
|
||||
else:
|
||||
plugin.Log(f"Adding to reoccurring scheduler task '{task['task']}' (weekly) every {task['weekday']} at {task['time']}")
|
||||
if task['weekday'].lower() == "monday":
|
||||
schedule.every().monday.at(task['time']).do(runTask, task)
|
||||
elif task['weekday'].lower() == "tuesday":
|
||||
@@ -213,7 +217,7 @@ def start_library_monitor():
|
||||
shouldUpdate = True
|
||||
signal.notify()
|
||||
else:
|
||||
plugin.Trace(f"Ignoring modifications due to plugin UI setting. path='{event.src_path}'")
|
||||
plugin.TraceOnce(f"Ignoring modifications due to plugin UI setting. path='{event.src_path}'")
|
||||
|
||||
def on_moved(event):
|
||||
global shouldUpdate
|
||||
@@ -235,7 +239,7 @@ def start_library_monitor():
|
||||
shouldUpdate = True
|
||||
signal.notify()
|
||||
else:
|
||||
plugin.Trace("Ignoring on_any_event trigger.")
|
||||
plugin.TraceOnce("Ignoring on_any_event trigger.")
|
||||
|
||||
event_handler.on_created = on_created
|
||||
event_handler.on_deleted = on_deleted
|
||||
|
||||
@@ -40,7 +40,7 @@ config = {
|
||||
# 3 = 3rd specified weekday of the month.
|
||||
# 4 = 4th specified weekday of the month.
|
||||
# Example monthly method.
|
||||
{"task" : "Backup", "weekday" : "saturday", "time" : "01:00", "monthly" : 2}, # Backup -> [Backup] 2nd saturday of the month at 1AM
|
||||
{"task" : "Backup", "weekday" : "saturday", "time" : "02:30", "monthly" : 2}, # Backup -> [Backup] 2nd saturday of the month at 2:30AM
|
||||
|
||||
# The following is a place holder for a plugin.
|
||||
{"task" : "PluginButtonName_Here", "pluginId" : "PluginId_Here", "hours" : 0}, # The zero frequency value makes this task disabled.
|
||||
|
||||
Reference in New Issue
Block a user