From 4dadc001567c9a66d1b623206db9c53dfaf98bd5 Mon Sep 17 00:00:00 2001 From: David Maisonave <47364845+David-Maisonave@users.noreply.github.com> Date: Sat, 2 Nov 2024 16:13:08 -0400 Subject: [PATCH] Added special menu to advance menu. --- plugins/DupFileManager/DupFileManager.py | 27 ++++++-- plugins/DupFileManager/advance_options.html | 71 +++++++++++++++++++-- plugins/FileMonitor/filemonitor_config.py | 3 +- 3 files changed, 91 insertions(+), 10 deletions(-) diff --git a/plugins/DupFileManager/DupFileManager.py b/plugins/DupFileManager/DupFileManager.py index 9e40156..f442035 100644 --- a/plugins/DupFileManager/DupFileManager.py +++ b/plugins/DupFileManager/DupFileManager.py @@ -118,7 +118,7 @@ alternateTrashCanPath = stash.Setting('dup_path') whitelistDelDupInSameFolder = stash.Setting('whitelistDelDupInSameFolder') graylistTagging = stash.Setting('graylistTagging') maxDupToProcess = int(stash.Setting('zyMaxDupToProcess')) -significantTimeDiff = stash.Setting('significantTimeDiff') +significantTimeDiff = float(stash.Setting('significantTimeDiff')) toRecycleBeforeSwap = stash.Setting('toRecycleBeforeSwap') cleanAfterDel = stash.Setting('cleanAfterDel') @@ -149,9 +149,25 @@ tagLongDurationLowRes = stash.Setting('tagLongDurationLowRes') bitRateIsImporantComp = stash.Setting('bitRateIsImporantComp') codecIsImporantComp = stash.Setting('codecIsImporantComp') +excludeFromReportIfSignificantTimeDiff = False + matchDupDistance = int(stash.Setting('matchDupDistance')) matchPhaseDistance = PhashDistance.EXACT matchPhaseDistanceText = "Exact Match" +if stash.PLUGIN_TASK_NAME == "tag_duplicates_task" and 'Target' in stash.JSON_INPUT['args']: + if stash.JSON_INPUT['args']['Target'].startswith("0"): + matchDupDistance = 0 + elif stash.JSON_INPUT['args']['Target'].startswith("1"): + matchDupDistance = 1 + elif stash.JSON_INPUT['args']['Target'].startswith("2"): + matchDupDistance = 2 + elif stash.JSON_INPUT['args']['Target'].startswith("3"): + matchDupDistance = 3 + + if stash.JSON_INPUT['args']['Target'].find(":") == 1: + significantTimeDiff = float(stash.JSON_INPUT['args']['Target'][2:]) + excludeFromReportIfSignificantTimeDiff = True + if matchDupDistance == 1: matchPhaseDistance = PhashDistance.HIGH matchPhaseDistanceText = "High Match" @@ -164,9 +180,9 @@ elif matchDupDistance == 3: # significantTimeDiff can not be higher than 1 and shouldn't be lower than .5 if significantTimeDiff > 1: - significantTimeDiff = 1 -if significantTimeDiff < .5: - significantTimeDiff = .5 + significantTimeDiff = float(1.00) +if significantTimeDiff < .25: + significantTimeDiff = float(0.25) duplicateMarkForDeletion = stash.Setting('DupFileTag') @@ -718,6 +734,9 @@ def mangeDupFiles(merge=False, deleteDup=False, tagDuplicates=False, deleteBlack sendToTrash(DupFileName) stash.destroyScene(DupFile['id'], delete_file=True) elif tagDuplicates or fileHtmlReport != None: + if excludeFromReportIfSignificantTimeDiff and significantTimeDiffCheck(DupFile, DupFileToKeep, True): + stash.Log(f"Skipping duplicate {DupFile['files'][0]['path']} (ID={DupFile['id']}), because of time difference greater than {significantTimeDiff} for file {DupFileToKeep['files'][0]['path']}.") + continue QtyTagForDel+=1 QtyTagForDelPaginate+=1 didAddTag = False diff --git a/plugins/DupFileManager/advance_options.html b/plugins/DupFileManager/advance_options.html index a9c0c29..e4bda64 100644 --- a/plugins/DupFileManager/advance_options.html +++ b/plugins/DupFileManager/advance_options.html @@ -68,7 +68,11 @@ $(document).ready(function(){ if (this.id === "tag_duplicates_task") { - RunPluginDupFileManager(this.id, 0, true); + RunPluginDupFileManager(this.id, this.value, true); + } + else if (this.id.startsWith("tag_duplicates_task")) + { + RunPluginDupFileManager("tag_duplicates_task", this.value + ":" + $("#significantTimeDiff").val(), true); } else if (this.id === "viewreport") { @@ -139,7 +143,7 @@ function DeleteDupInPath(){
-
DupFileManager Advance _DuplicateMarkForDeletion Tagged Files Menu
- +
@@ -150,8 +154,8 @@ function DeleteDupInPath(){
- - + + @@ -1659,8 +1663,65 @@ function DeleteDupInPath(){
+
+
+ +
+ + + + + + +
Create report with different [Match Duplicate Distance] options +
Overrides user [Match Duplicate Distance] and [significantTimeDiff] settings
+
+ + +
+
+ +
+ +
+ +
+ +
+ Details: +
    +
  1. Match Duplicate Distance Number Details
  2. +
      +
    1. Exact Match
    2. +
        +
      1. Safest and most reliable option
      2. +
      3. Uses tag name _DuplicateMarkForDeletion_0
      4. +
      5. Has the fewest results
      6. +
      +
    3. High Match
    4. +
        +
      1. Recommended Setting
      2. +
      3. Safe and usually reliable
      4. +
      5. Uses tag name _DuplicateMarkForDeletion_1
      6. +
      7. Scenes tagged by Exact Match will have both tags (_DuplicateMarkForDeletion_0 and _DuplicateMarkForDeletion_1)
      8. +
      +
    5. Medium Match
    6. +
        +
      1. Not so safe. Some false matches
      2. +
      3. Uses tag name _DuplicateMarkForDeletion_2
      4. +
      5. Scenes tagged by 0 and 1 will have three tags.
      6. +
      +
    7. Low Match
    8. +
        +
      1. Unsafe, and many false matches
      2. +
      3. Uses tag name _DuplicateMarkForDeletion_3
      4. +
      5. Scenes tagged by 0, 1, and 2 will have four tags.
      6. +
      7. Has the most results, but with many false matches
      8. +
      +
    +
+
diff --git a/plugins/FileMonitor/filemonitor_config.py b/plugins/FileMonitor/filemonitor_config.py index c4a2844..98249d6 100644 --- a/plugins/FileMonitor/filemonitor_config.py +++ b/plugins/FileMonitor/filemonitor_config.py @@ -21,6 +21,7 @@ config = { # 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" : "Backup", "weekday" : "saturday", "time" : "01:00"}, # Backup -> [Backup] (Weekly) (Every saturday at 1AM) {"task" : "Scan", "weekday" : "saturday", "time" : "02:30"}, # Library -> [Scan] (Weekly) (Every saturday at 2:30AM) {"task" : "Auto Tag", "weekday" : "saturday", "time" : "03:00"}, # Auto Tag -> [Auto Tag] (Weekly) (Every saturday at 3AM) {"task" : "Generate", "weekday" : "saturday", "time" : "03:30"}, # Generated Content-> [Generate] (Every saturday at 3:30AM) @@ -43,7 +44,7 @@ config = { # 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" : "saturday", "time" : "01:00", "monthly" : 2}, # Backup -> [Backup] 2nd sunday of the month at 1AM (01: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.