prettier changes

This commit is contained in:
David Maisonave
2024-08-28 05:03:57 -04:00
parent a87c9db4b5
commit e148a12ed7
4 changed files with 36 additions and 18 deletions

View File

@@ -5,7 +5,7 @@ url: https://github.com/David-Maisonave/Axter-Stash/tree/main/plugins/DupFileMan
settings:
mergeDupFilename:
displayName: Merge Duplicate Tags
description: Before deletion, merge metadata from duplicate. E.g. Tag names, performers, studios, title, galleries, rating, details, etc...
description: Before deletion, merge metadata from duplicate. E.g. Tag names, performers, studios, title, galleries, rating, details, etc...
type: BOOLEAN
permanentlyDelete:
displayName: Permanent Delete

View File

@@ -1,6 +1,9 @@
# DupFileManager: Ver 0.1.2 (By David Maisonave)
DupFileManager is a [Stash](https://github.com/stashapp/stash) plugin which manages duplicate file in the Stash system.
### Features
- Can merge potential source in the duplicate file names for tag names, performers, and studios.
- Normally when Stash searches the file name for tag names, performers, and studios, it only does so using the primary file.
- Delete duplicate file task with the following options:
@@ -13,7 +16,7 @@ DupFileManager is a [Stash](https://github.com/stashapp/stash) plugin which mana
- Use a black-list to determine which duplicates should be deleted first.
- **Permanent Delete** - Enable to permanently delete files, instead of moving files to trash can.
- **Max Dup Process** - Use to limit the maximum files to process. Can be used to do a limited test run.
- **Merge Duplicate Tags** - Before deletion, merge metadata from duplicate. E.g. Tag names, performers, studios, title, galleries, rating, details, etc...
- **Merge Duplicate Tags** - Before deletion, merge metadata from duplicate. E.g. Tag names, performers, studios, title, galleries, rating, details, etc...
- Options available via DupFileManager_config.py
- **dup_path** - Alternate path to move deleted files to. Example: "C:\TempDeleteFolder"
- **swapHighRes** - When enabled, swaps higher resolution files between whitelist and blacklist/graylist files.
@@ -21,11 +24,13 @@ DupFileManager is a [Stash](https://github.com/stashapp/stash) plugin which mana
- **toRecycleBeforeSwap** - When enabled, moves destination file to recycle bin before swapping files.
### Requirements
`pip install --upgrade stashapp-tools`
`pip install pyYAML`
`pip install Send2Trash`
### Installation
- Follow **Requirements** instructions.
- In the stash plugin directory (C:\Users\MyUserName\.stash\plugins), create a folder named **DupFileManager**.
- Copy all the plugin files to this folder.(**C:\Users\MyUserName\\.stash\plugins\DupFileManager**).
@@ -34,6 +39,6 @@ DupFileManager is a [Stash](https://github.com/stashapp/stash) plugin which mana
That's it!!!
### Options
- Options are accessible in the GUI via Settings->Plugins->Plugins->[DupFileManager].
- More options available in DupFileManager_config.py.

View File

@@ -1,19 +1,24 @@
# FileMonitor: Ver 0.9.0 (By David Maisonave)
FileMonitor is a [Stash](https://github.com/stashapp/stash) plugin with the following two main features:
- Updates Stash when any file changes occurs in the Stash library.
- **Task Scheduler**: Runs scheduled task based on the scheduler configuration in **filemonitor_config.py**.
## Starting FileMonitor from the UI
From the GUI, FileMonitor can be started as a service or as a plugin. The recommended method is to start it as a service. When started as a service, it will jump on the Task Queue momentarily, and then disappear as it starts running in the background.
- To start monitoring file changes, go to **Stash->Settings->Task->[Plugin Tasks]->FileMonitor**, and click on the [Start Library Monitor Service] button.
- ![FileMonitorService](https://github.com/user-attachments/assets/b12aeca9-37a8-447f-90da-26e9440735ad)
- **Important Note**: At first, this will show up as a plugin in the Task Queue momentarily. It will then disappear from the Task Queue and run in the background as a service.
- To stop FileMonitor click on [Stop Library Monitor] button.
- The **[Monitor as a Plugin]** option is mainly available for backwards compatibility and for test purposes.
## Using FileMonitor as a script
**FileMonitor** can be called as a standalone script.
- To start monitoring call the script and pass --url and the Stash URL.
- python filemonitor.py --url http://localhost:9999
- To stop **FileMonitor**, pass argument **--stop**.
@@ -24,6 +29,7 @@ From the GUI, FileMonitor can be started as a service or as a plugin. The recomm
- The restart command restarts FileMonitor as a Task in Stash.
# Task Scheduler
To enable the scheduler go to **Stash->Settings->Plugins->Plugins->FileMonitor** and enable the **Scheduler** option.
![ReoccurringTaskScheduler](https://github.com/user-attachments/assets/5a7bf6a4-3bd6-4692-a6c3-e9f8f4664f14)
@@ -38,19 +44,20 @@ To enable the scheduler go to **Stash->Settings->Plugins->Plugins->FileMonitor**
- The example tasks are disabled by default because they either have a zero frequency value or the time field is set to **DISABLED**.
To configure the schedule or to add new task, edit the **task_scheduler** section in the **filemonitor_config.py** file.
```` python
```python
"task_scheduler": [
# 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. 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",
{"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
# Optional field for task "Scan", "Auto Tag", and "Clean" is 'paths'. For detail usage, see examples #A3: in filemonitor_task_examples.py
{"task" : "Scan", "weekday" : "saturday", "time" : "03:00"}, # Library -> [Scan] (Weekly) (Every saturday at 3AM)
@@ -59,7 +66,7 @@ To configure the schedule or to add new task, edit the **task_scheduler** sectio
{"task" : "Clean", "weekday" : "saturday", "time" : "04:30"}, # Maintenance -> [Clean] (Every saturday at 4:30AM)
{"task" : "Clean Generated Files", "weekday" : "saturday", "time" : "05:00"}, # Maintenance -> [Clean Generated Files] (Every saturday at 5AM)
{"task" : "Optimise Database", "weekday" : "saturday", "time" : "05:30"}, # Maintenance -> [Optimise Database] (Every saturday at 5:30AM)
# To perform a task monthly, specify the day of the month as in the weekly schedule format, and add a monthly field.
# The monthly field value must be 1, 2, 3, or 4.
# 1 = 1st specified weekday of the month. Example 1st monday.
@@ -68,26 +75,29 @@ To configure the schedule or to add new task, edit the **task_scheduler** sectio
# 4 = 4th specified weekday of the month.
# The Backup task is scheduled monthly
# 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)
{"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" : "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.
{"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.
# This task only works if FileMonitor is started as a service or in command line mode.
# Optional fields are 'command' and 'RunAfter'. For detail usage, see examples #C1 and #C2 in filemonitor_task_examples.py
{"task" : "CheckStashIsRunning", "minutes" :5}, # Checks every 5 minutes
],
````
```
- To add plugins to the task list, use the Plugin-ID in the "task" field. The plugin ID is usually the file name of the script without the extension.
- Plugin task have the following optional fields: taskName, taskMode, validateDir, and taskQue
- The **validateDir** field can be used to define the plugin sub directory, which is checked to see if it exist before running the task.
- **taskName** field is used to name the task to call for the associated plugin. It can not be used with "taskQue":False
- **taskQue** field is used to call the plugin without using the Task Queue. I.E. "taskQue":False. When this field is set to False, the taskName field can NOT be used. Instead use taskMode to identify the task to call.
- **taskMode** field is used in order to run the plugin without using the Task Queue. The plugin runs immediatly. Be careful not to confuse taskMode with taskName. Look in the plugin *.yml file under the **tasks** section where it defines both the task-name and the task-mode.
- **taskQue** field is used to call the plugin without using the Task Queue. I.E. "taskQue":False. When this field is set to False, the taskName field can NOT be used. Instead use taskMode to identify the task to call.
- **taskMode** field is used in order to run the plugin without using the Task Queue. The plugin runs immediatly. Be careful not to confuse taskMode with taskName. Look in the plugin \*.yml file under the **tasks** section where it defines both the task-name and the task-mode.
- Task can be scheduled to run monthly, weekly, hourly, and by minutes.
- The scheduler list uses two types of syntax. One is **weekday** based, and the other is **frequency** based.
- **weekday Based**
- Use the weekday based syntax for daily, weekly, and monthly schedules.
- All the weekday based methods must have a **weekday** field and a **time** field, which specifies the day(s) of the week and the time to start the task.
- **Daily**:
@@ -128,6 +138,7 @@ To configure the schedule or to add new task, edit the **task_scheduler** sectio
- For best results use the scheduler with FileMonitor running as a service.
## Requirements
- pip install -r requirements.txt
- Or manually install each requirement:
- `pip install stashapp-tools --upgrade`
@@ -136,6 +147,7 @@ To configure the schedule or to add new task, edit the **task_scheduler** sectio
- `pip install schedule`
## Installation
- Follow **Requirements** instructions.
- In the stash plugin directory (C:\Users\MyUserName\.stash\plugins), create a folder named **FileMonitor**.
- Copy all the plugin files to this folder.(**C:\Users\MyUserName\\.stash\plugins\FileMonitor**).
@@ -144,16 +156,17 @@ To configure the schedule or to add new task, edit the **task_scheduler** sectio
That's it!!!
## Options
- Main options are accessible in the GUI via Settings->Plugins->Plugins->[FileMonitor].
- When the UI option [Max DB Backups] is set to a value greater than 1, and when the scheduler is enabled, the quantity of database backup files are trim down to the set [**Max DB Backups**] value after the scheduler executes the Backup task.
- The other options are self explanatory from the UI.
- Additional options available in filemonitor_config.py. The options are well documented in the commented code.
## Bugs and Feature Request
Please use the following link to report FileMonitor bugs:
[FileMonitor Bug Report](https://github.com/David-Maisonave/Axter-Stash/issues/new?assignees=&labels=Plugin_Bug&projects=&template=bug_report_plugin.yml&title=%F0%9F%AA%B2%5BFileMonitor%5D+Your_Short_title)
Please use the following link to report FileMonitor Feature Request:[FileMonitor Feature Reques](https://github.com/David-Maisonave/Axter-Stash/issues/new?assignees=&labels=Enhancement&projects=&template=feature_request_plugin.yml&title=%F0%9F%92%A1%EF%B8%8F%5BEnhancement%5D%3A%5BFileMonitor%5D+Your_Short_title)
Please do **NOT** use the feature request to include any problems associated with errors. Instead use the bug report for error issues.

View File

@@ -13,7 +13,7 @@ settings:
type: BOOLEAN
turnOnSchedulerDeleteDup:
displayName: Delete Duplicate Scheduler
description: Turn on scheduler for deleting duplicates in Stash library. (Requires plugin DupFileManager and [Scheduler] enabled)
description: Turn on scheduler for deleting duplicates in Stash library. (Requires plugin DupFileManager and [Scheduler] enabled)
type: BOOLEAN
zmaximumBackups:
displayName: Max DB Backups