Compare commits

..

2 Commits

Author SHA1 Message Date
Chris King
24aa00de8d Adjust duration difference check to allow small non-significant differences if one file is better in other ways
Duration difference now respects the setting for what is significant duration difference
2025-02-16 06:18:47 -08:00
Chris King
b646da289c Change some default settings 2025-02-16 06:16:54 -08:00
2 changed files with 12 additions and 5 deletions

View File

@@ -503,11 +503,18 @@ def isBetterVideo(scene1, scene2, swapCandidateCk = False): # is scene2 better t
return True return True
return False return False
def isSignificantTimeDiff(duration1, duration2):
dur1 = int(duration1)
dur2 = int(duration2)
return abs(dur1 - dur2) / max(abs(dur1), abs(dur2)) > (1 - significantTimeDiff)
def significantMoreTimeCompareToBetterVideo(scene1, scene2): # is scene2 better than scene1 def significantMoreTimeCompareToBetterVideo(scene1, scene2): # is scene2 better than scene1
if isinstance(scene1, int): if isinstance(scene1, int):
scene1 = stash.find_scene(scene1) scene1 = stash.find_scene(scene1)
scene2 = stash.find_scene(scene2) scene2 = stash.find_scene(scene2)
if int(scene1['files'][0]['duration']) >= int(scene2['files'][0]['duration']): dur1 = int(scene1['files'][0]['duration'])
dur2 = int(scene2['files'][0]['duration'])
if dur1 >= dur2 or not isSignificantTimeDiff(dur1, dur2):
return False return False
if int(scene1['files'][0]['width']) * int(scene1['files'][0]['height']) > int(scene2['files'][0]['width']) * int(scene2['files'][0]['height']): if int(scene1['files'][0]['width']) * int(scene1['files'][0]['height']) > int(scene2['files'][0]['width']) * int(scene2['files'][0]['height']):
if significantTimeDiffCheck(scene1, scene2): if significantTimeDiffCheck(scene1, scene2):
@@ -520,7 +527,7 @@ def significantMoreTimeCompareToBetterVideo(scene1, scene2): # is scene2 better
return True return True
def allThingsEqual(scene1, scene2): # If all important things are equal, return true def allThingsEqual(scene1, scene2): # If all important things are equal, return true
if int(scene1['files'][0]['duration']) != int(scene2['files'][0]['duration']): if isSignificantTimeDiff(scene1['files'][0]['duration'], scene2['files'][0]['duration']):
return False return False
if scene1['files'][0]['width'] != scene2['files'][0]['width']: if scene1['files'][0]['width'] != scene2['files'][0]['width']:
return False return False

View File

@@ -7,13 +7,13 @@ config = {
# Alternative path to move duplicate files. # Alternative path to move duplicate files.
"dup_path": "", #Example: "C:\\TempDeleteFolder" "dup_path": "", #Example: "C:\\TempDeleteFolder"
# The threshold as to what percentage is consider a significant shorter time. # The threshold as to what percentage is consider a significant shorter time.
"significantTimeDiff" : .90, # 90% threshold "significantTimeDiff" : .98, # 90% threshold
# If enabled, moves destination file to recycle bin before swapping Hi-Res file. # If enabled, moves destination file to recycle bin before swapping Hi-Res file.
"toRecycleBeforeSwap" : True, "toRecycleBeforeSwap" : True,
# Character used to seperate items on the whitelist, blacklist, and graylist # Character used to seperate items on the whitelist, blacklist, and graylist
"listSeparator" : ",", "listSeparator" : ",",
# Enable to permanently delete files, instead of moving files to trash can. # Enable to permanently delete files, instead of moving files to trash can.
"permanentlyDelete" : False, "permanentlyDelete" : True,
# After running a 'Delete Duplicates' task, run Clean, Clean-Generated, and Optimize-Database. # After running a 'Delete Duplicates' task, run Clean, Clean-Generated, and Optimize-Database.
"cleanAfterDel" : True, "cleanAfterDel" : True,
# Generate PHASH after tag or delete task. # Generate PHASH after tag or delete task.
@@ -61,7 +61,7 @@ config = {
# If enabled, favor videos with higher bit rate. Used with either favorBitRateChange option or UI [Swap Bit Rate Change] option. # If enabled, favor videos with higher bit rate. Used with either favorBitRateChange option or UI [Swap Bit Rate Change] option.
"favorHighBitRate" : True, "favorHighBitRate" : True,
# If enabled, favor videos with a different frame rate value. If favorHigherFrameRate is true, favor higher rate. If favorHigherFrameRate is false, favor lower rate # If enabled, favor videos with a different frame rate value. If favorHigherFrameRate is true, favor higher rate. If favorHigherFrameRate is false, favor lower rate
"favorFrameRateChange" : True, "favorFrameRateChange" : False,
# If enabled, favor videos with higher frame rate. Used with either favorFrameRateChange option or UI [Swap Better Frame Rate] option. # If enabled, favor videos with higher frame rate. Used with either favorFrameRateChange option or UI [Swap Better Frame Rate] option.
"favorHigherFrameRate" : True, "favorHigherFrameRate" : True,
# If enabled, favor videos with better codec according to codecRanking # If enabled, favor videos with better codec according to codecRanking