Added special menu to advance menu.

This commit is contained in:
David Maisonave
2024-11-02 16:13:08 -04:00
parent 504814b43c
commit 4dadc00156
3 changed files with 91 additions and 10 deletions

View File

@@ -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

View File

@@ -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(){
<center><table style="color:darkgreen;background-color:powderblue;">
<tr><th>DupFileManager Advance <b style="color:red;">_DuplicateMarkForDeletion</b> Tagged Files Menu</th></tr>
<tr><td><center>
<button type="button" id="tag_duplicates_task" title="Create new report which tags duplicates with tag name _DuplicateMarkForDeletion.">Create Duplicate Report with Tagging</button>
<button type="button" id="tag_duplicates_task" value="-1" title="Create new report which tags duplicates with tag name _DuplicateMarkForDeletion using user settings for [Match Duplicate Distance].">Create Duplicate Report with Tagging</button>
<button type="button" id="viewreport" title="View duplicate file report.">View Dup Report</button>
</center></td></tr>
<tr><td><form id="pathToDeleteForm" action="javascript:DeleteDupInPath();" target="_self">
@@ -150,8 +154,8 @@ function DeleteDupInPath(){
</form>
</td></tr>
<tr><td><form id="sizeToDeleteForm" action="javascript:DeleteDupInPath();" target="_self">
<label for="sizeToDelete" title="File size in kilobytes (1024 bytes).">File Size (KB):</label>
<input type="number" id="sizeToDelete" name="sizeToDelete" title="File size in kilobytes (1024 bytes)." value="123456">
<label for="sizeToDelete" title="File size in bytes.">File Size (bytes):</label>
<input type="number" id="sizeToDelete" name="sizeToDelete" title="File size in bytes." value="123456">
<label for="sizeToDeleteLess">All:</label>
<button type="button" id="sizeToDeleteLess" title="Delete tagged duplicates with file size less than"><</button>
<button type="button" id="sizeToDeleteGreater" title="Delete tagged duplicates with file size greater than">></button>
@@ -1659,8 +1663,65 @@ function DeleteDupInPath(){
<button type="button" id="resolutionToDeleteBlacklistGreater" title="Delete blacklist tagged duplicates with resolution greater than">></button>
</form>
</td></tr>
</td></tr></table></center>
</table></center>
<div id="div1"></div>
<br>
<center><table style="color:darkgreen;background-color:powderblue;">
<tr><th>Create report with different <b style="color:red;">[Match Duplicate Distance]</b> options
<br><div style="font-size: 12px;">Overrides user [Match Duplicate Distance] and [significantTimeDiff] settings</div>
<form id="significantTimeDiffForm" action="javascript:DeleteDupInPath();" target="_self">
<label for="significantTimeDiff" title="Significant time difference setting, where 1 equals 100% and (.9) equals 90%.">Time Difference%:</label>
<input type="number" min="0.25" max="1.00" step="0.01" id="significantTimeDiff" name="significantTimeDiff" title="Significant time difference setting, where 1 equals 100% and (.9) equals 90%." value="0.90">
</form>
</th></tr>
<tr><td><center>
<button type="button" id="tag_duplicates_task0" value="0" title="Create report which tags duplicates with tag name _DuplicateMarkForDeletion_0 and using [Match Duplicate Distance]=0 (Exact Match).">Create Duplicate Tagging Report [Exact Match]</button>
</center></td></tr>
<tr><td><center>
<button type="button" id="tag_duplicates_task1" value="1" title="Create report which tags duplicates with tag name _DuplicateMarkForDeletion_1 and using [Match Duplicate Distance]=1 (High Match).">Create Duplicate Tagging Report [High Match]</button>
</center></td></tr>
<tr><td><center>
<button type="button" id="tag_duplicates_task2" value="2" title="Create report which tags duplicates with tag name _DuplicateMarkForDeletion_2 and using [Match Duplicate Distance]=2 (Medium Match).">Create Duplicate Tagging Report [Medium Match]</button>
</center></td></tr>
<tr><td><center>
<button type="button" id="tag_duplicates_task3" value="3" title="Create report which tags duplicates with tag name _DuplicateMarkForDeletion_3 and using [Match Duplicate Distance]=3 (Low Match).">Create Duplicate Tagging Report [Low Match]</button>
</center></td></tr>
<tr><td style="font-size: 12px;">
<b>Details:</b>
<ol type="I" style="padding-left: 16px;">
<li>Match Duplicate Distance Number Details</li>
<ol type="1" start="0" style="padding-left: 16px;">
<li><b style="color:red;">Exact Match</b></li>
<ol type="a" style="padding-left: 16px;">
<li>Safest and most reliable option</li>
<li>Uses tag name _DuplicateMarkForDeletion<b>_0</b></li>
<li>Has the fewest results</li>
</ol>
<li><b style="color:red;">High Match</b></li>
<ol type="a" style="padding-left: 16px;">
<li>Recommended Setting</li>
<li>Safe and usually reliable</li>
<li>Uses tag name _DuplicateMarkForDeletion<b>_1</b></li>
<li>Scenes tagged by Exact Match will have both tags (_DuplicateMarkForDeletion_0 and _DuplicateMarkForDeletion_1)</li>
</ol>
<li><b style="color:red;">Medium Match</b></li>
<ol type="a" style="padding-left: 16px;">
<li>Not so safe. Some false matches</li>
<li>Uses tag name _DuplicateMarkForDeletion<b>_2</b></li>
<li>Scenes tagged by 0 and 1 will have three tags.</li>
</ol>
<li><b style="color:red;">Low Match</b></li>
<ol type="a" style="padding-left: 16px;">
<li>Unsafe, and many false matches</li>
<li>Uses tag name _DuplicateMarkForDeletion<b>_3</b></li>
<li>Scenes tagged by 0, 1, and 2 will have four tags.</li>
<li>Has the most results, but with many false matches</li>
</ol>
</ol>
</ol>
</td></tr>
</table></center>
</body></html>

View File

@@ -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.