From 308c54cacd1b0854733e1ccf412e030d78253348 Mon Sep 17 00:00:00 2001 From: David Maisonave <47364845+David-Maisonave@users.noreply.github.com> Date: Sat, 10 Aug 2024 12:22:57 -0400 Subject: [PATCH] Added issue templates --- .github/ISSUE_TEMPLATE/bug_report.yml | 58 +++++++++++++++++ .github/ISSUE_TEMPLATE/bug_report_plugin.yml | 65 ++++++++++++++++++++ .github/ISSUE_TEMPLATE/discussion.yml | 42 +++++++++++++ .github/ISSUE_TEMPLATE/feature_request.yml | 35 +++++++++++ .github/ISSUE_TEMPLATE/help.yml | 37 +++++++++++ StashPluginHelper/StashPluginHelper.py | 15 +++++ plugins/FileMonitor/StashPluginHelper.py | 15 +++++ plugins/FileMonitor/filemonitor.py | 10 ++- plugins/FileMonitor/filemonitor_config.py | 2 +- 9 files changed, 275 insertions(+), 4 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/bug_report_plugin.yml create mode 100644 .github/ISSUE_TEMPLATE/discussion.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml create mode 100644 .github/ISSUE_TEMPLATE/help.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..ee1f6ae --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,58 @@ +name: 🐞 Bug +description: Create a bug report +title: "🐞[Bug] Your_Short_title" +labels: [Bug] +body: + - type: markdown + attributes: + value: | + Thank you for taking the time to fill out this bug report! + Fields marked with an asterisk (*) are required, and remaining fields are optional, but we encourage their usage. + - type: textarea + id: feature + attributes: + label: Please enter a clear and concise description of the bug. + validations: + required: true + - type: input + id: os + attributes: + label: What Operating System (OS)? + placeholder: e.g. Windows, MacOS, Linux + validations: + required: true + - type: input + id: browser + attributes: + label: What browser and version? + placeholder: e.g. Chrome Ver:127, Firefox Ver:129, Safari Ver:1.3.2, Any + validations: + required: true + - type: textarea + id: steps-to-reproduce + attributes: + label: Steps To Reproduce + description: What are the steps used to reproduce this issue? + validations: + required: false + - type: textarea + id: expected-behavior + attributes: + label: Expected Behavior + description: What was the expected behavior? + validations: + required: false + - type: textarea + id: logging + attributes: + label: Logging + description: Enter Stash logging. + validations: + required: false + - type: textarea + id: snapshots + attributes: + label: Snapshot(s) + description: Optionally attach snapshot(s) which displays the bug. + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/bug_report_plugin.yml b/.github/ISSUE_TEMPLATE/bug_report_plugin.yml new file mode 100644 index 0000000..5695985 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report_plugin.yml @@ -0,0 +1,65 @@ +name: 🪲 Plugin Bug +description: Create a plugin bug report +title: "🪲[EnterPluginNameHere] Your_Short_title" +labels: [Plugin_Bug] +body: + - type: markdown + attributes: + value: | + Thank you for taking the time to fill out this bug report! + Fields marked with an asterisk (*) are required, and remaining fields are optional, but we encourage their usage. + - type: textarea + id: feature + attributes: + label: Please enter a clear and concise description of the bug. + validations: + required: true + - type: input + id: os + attributes: + label: What Operating System (OS)? + placeholder: e.g. Windows, MacOS, Linux + validations: + required: true + - type: input + id: browser + attributes: + label: What browser and version? + placeholder: e.g. Chrome Ver:127, Firefox Ver:129, Safari Ver:1.3.2, Any + validations: + required: true + - type: textarea + id: install + attributes: + label: The pip install for the plugin + description: pip install stashapp-tools --upgrade, pip install pyYAML + validations: + required: true + - type: textarea + id: steps-to-reproduce + attributes: + label: Steps To Reproduce + description: What are the steps used to reproduce this issue? + validations: + required: false + - type: textarea + id: expected-behavior + attributes: + label: Expected Behavior + description: What was the expected behavior? + validations: + required: false + - type: textarea + id: logging + attributes: + label: Logging + description: Enter Stash logging and plugin logging file if applicable. + validations: + required: false + - type: textarea + id: snapshots + attributes: + label: Snapshot(s) + description: Optionally attach snapshot(s) which displays the bug. + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/discussion.yml b/.github/ISSUE_TEMPLATE/discussion.yml new file mode 100644 index 0000000..177b35c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/discussion.yml @@ -0,0 +1,42 @@ +name: 🛗Discussion / Request for Commentary [RFC] +description: This is for issues that will be discussed and won't necessarily result directly in commits or pull requests. +title: "🛗[RFC]: Your_Short_title" +labels: [RFC] +body: + - type: markdown + attributes: + value: | + This is for issues that will be discussed and won't necessarily result directly in commits or pull requests. + Please ensure that you respect people's time and attention and understand that people are volunteering their time, so concision is ideal and considerate. + Fields marked with an asterisk (*) are required, and remaining fields are optional, but we encourage their usage. + - type: textarea + id: Title + attributes: + label: Optional title of the topic to discuss. + validations: + required: false + - type: textarea + id: Summary + attributes: + label: Describe the scope of your topic and your goals ideally within a single paragraph or TL. A summary that makes it easier for people to determine if they can contribute at a glance. + validations: + required: true + - type: textarea + id: Details + attributes: + label: Only required if summary and title doesn't cover everything. + validations: + required: false + - type: textarea + id: Examples + attributes: + label: If you can show a picture or video examples post them here. + validations: + required: false + - type: textarea + id: snapshots + attributes: + label: Snapshot(s) + description: Optionally attach additional snapshot(s) which helps describe the discussion. + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..9593dc4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,35 @@ +name: 💡️Feature Request +description: Suggest improvement for this project +title: "💡️[Enhancement]: Your_Short_title" +labels: [Enhancement] +body: + - type: markdown + attributes: + value: | + Please fill out the following fields with as much detail as possible: + Fields marked with an asterisk (*) are required, and remaining fields are optional, but we encourage their usage. + - type: textarea + id: problem + attributes: + label: If feature request is related to a problem, give a clear and concise description of what is the problem. Ex. I'm always frustrated when [...] + validations: + required: false + - type: textarea + id: solution + attributes: + label: Describe the solution you'd like. A clear and concise description of what you want to happen. + validations: + required: true + - type: textarea + id: alternatives + attributes: + label: Describe alternatives you've considered. A clear and concise description of any alternative solutions or features you've considered. + validations: + required: false + - type: textarea + id: Snapshots + attributes: + label: Snapshots / Images + description: Add any other context or screenshots about the feature request here, which can help explain the feature, and a description of what to look for in the image(s). + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/help.yml b/.github/ISSUE_TEMPLATE/help.yml new file mode 100644 index 0000000..dae58e2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/help.yml @@ -0,0 +1,37 @@ +name: ❓Help +description: Post your question +title: "❓[Help]: Your_Short_title" +labels: [Question] +body: + - type: markdown + attributes: + value: | + Please fill out the following fields with as much detail as possible, so that we can better answer your question. + Fields marked with an asterisk (*) are required, and remaining fields are optional, but we encourage their usage. + - type: textarea + id: question + attributes: + label: Please enter a clear and concise detailed question. + validations: + required: true + - type: input + id: os + attributes: + label: What Operating System (OS)? + placeholder: e.g. Windows, MacOS, Linux + validations: + required: false + - type: input + id: browser + attributes: + label: What browser and version? + placeholder: e.g. Chrome Ver:127, Firefox Ver:129, Safari Ver:1.3.2, Any + validations: + required: false + - type: textarea + id: snapshots + attributes: + label: Snapshot(s) + description: Optionally attach snapshot(s) which helps describe the question. + validations: + required: false diff --git a/StashPluginHelper/StashPluginHelper.py b/StashPluginHelper/StashPluginHelper.py index 379eacb..eaeae19 100644 --- a/StashPluginHelper/StashPluginHelper.py +++ b/StashPluginHelper/StashPluginHelper.py @@ -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 diff --git a/plugins/FileMonitor/StashPluginHelper.py b/plugins/FileMonitor/StashPluginHelper.py index 379eacb..eaeae19 100644 --- a/plugins/FileMonitor/StashPluginHelper.py +++ b/plugins/FileMonitor/StashPluginHelper.py @@ -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 diff --git a/plugins/FileMonitor/filemonitor.py b/plugins/FileMonitor/filemonitor.py index 6f66324..aa7bc2b 100644 --- a/plugins/FileMonitor/filemonitor.py +++ b/plugins/FileMonitor/filemonitor.py @@ -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 diff --git a/plugins/FileMonitor/filemonitor_config.py b/plugins/FileMonitor/filemonitor_config.py index 51986a2..78c1e76 100644 --- a/plugins/FileMonitor/filemonitor_config.py +++ b/plugins/FileMonitor/filemonitor_config.py @@ -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.