Skip to content

Commit

Permalink
[autotimer] checkSimilarity - compare empty descriptions
Browse files Browse the repository at this point in the history
-also remove hardcoded value for name comparison
  • Loading branch information
Dima73 authored and littlesat committed Nov 9, 2024
1 parent a70e0ca commit a5cec2f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
34 changes: 16 additions & 18 deletions autotimer/src/AutoTimer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1229,29 +1229,27 @@ def checkSimilarity(self, timer, name1, name2, shortdesc1, shortdesc2, extdesc1,
ratio = sequenceMatcher.ratio()
ratio_value = force and 0.8 or timer.ratioThresholdDuplicate
doDebug("[AutoTimer] names ratio %f - %s - %d - %s - %d" % (ratio, name1, len(name1), name2, len(name2)))
if name1 in name2 or (0.8 < ratio): # this is probably a match
if (ratio_value < ratio) or (ratio_value == 1.0 and ratio_value == ratio): # this is probably a match
if not force and timer.descShortExtEmpty and (((isMovie and shortdesc1 and not shortdesc2) or (not isMovie and not shortdesc1 and not shortdesc2 and name1 != name2))
or ((isMovie and extdesc1 and not extdesc2) or (not isMovie and not extdesc1 and not extdesc2 and name1 != name2))):
doDebug("[AutoTimer] Configuration caused this sortdesc/extdesc match to be ignored!")
return False
if force or timer.searchForDuplicateDescription > 0:
if shortdesc1 and shortdesc2:
sequenceMatcher.set_seqs(shortdesc1, shortdesc2)
ratio = sequenceMatcher.ratio()
doDebug("[AutoTimer] shortdesc ratio %f - %s - %d - %s - %d" % (ratio, shortdesc1, len(shortdesc1), shortdesc2, len(shortdesc2)))
retValue = (ratio_value < ratio) or (ratio_value == 1.0 and ratio_value == ratio)
doDebug("[AutoTimer] Final result for found shortdesc: %s" % retValue)
if retValue:
doLog("[AutoTimer] shortdesc match: ratio %f - %s - %d - %s - %d" % (ratio, shortdesc1, len(shortdesc1), shortdesc2, len(shortdesc2)))
if force or timer.searchForDuplicateDescription > 1:
if extdesc1 and extdesc2:
sequenceMatcher.set_seqs(extdesc1, extdesc2)
ratio = sequenceMatcher.ratio()
doDebug("[AutoTimer] extdesc ratio %f - %s - %d - %s - %d" % (ratio, extdesc1, len(extdesc1), extdesc2, len(extdesc2)))
retValue = (ratio_value < ratio) or (ratio_value == 1.0 and ratio_value == ratio)
doDebug("[AutoTimer] Final result for found extdesc: %s" % retValue)
if retValue:
doLog("[AutoTimer] extdesc match: ratio %f - %s - %d - %s - %d" % (ratio, extdesc1, len(extdesc1), extdesc2, len(extdesc2)))
sequenceMatcher.set_seqs(shortdesc1 or "", shortdesc2 or "")
ratio = sequenceMatcher.ratio()
doDebug("[AutoTimer] shortdesc ratio %f - %s - %d - %s - %d" % (ratio, shortdesc1, len(shortdesc1), shortdesc2, len(shortdesc2)))
retValue = (ratio_value < ratio) or (ratio_value == 1.0 and ratio_value == ratio)
doDebug("[AutoTimer] Final result for found shortdesc: %s" % retValue)
if retValue:
doLog("[AutoTimer] shortdesc match: ratio %f - %s - %d - %s - %d" % (ratio, shortdesc1, len(shortdesc1), shortdesc2, len(shortdesc2)))
if force or timer.searchForDuplicateDescription > 1:
sequenceMatcher.set_seqs(extdesc1 or "", extdesc2 or "")
ratio = sequenceMatcher.ratio()
doDebug("[AutoTimer] extdesc ratio %f - %s - %d - %s - %d" % (ratio, extdesc1, len(extdesc1), extdesc2, len(extdesc2)))
retValue = (ratio_value < ratio) or (ratio_value == 1.0 and ratio_value == ratio)
doDebug("[AutoTimer] Final result for found extdesc: %s" % retValue)
if retValue:
doLog("[AutoTimer] extdesc match: ratio %f - %s - %d - %s - %d" % (ratio, extdesc1, len(extdesc1), extdesc2, len(extdesc2)))
else:
retValue = True
return retValue
Expand Down
2 changes: 1 addition & 1 deletion autotimer/src/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
autotimer = AutoTimer()
autopoller = None

AUTOTIMER_VERSION = "4.6.8"
AUTOTIMER_VERSION = "4.6.9"

try:
from Plugins.SystemPlugins.MPHelp import registerHelp, XMLHelpReader
Expand Down

0 comments on commit a5cec2f

Please sign in to comment.