Thanks: 0
Ergebnis 1 bis 1 von 1
-
09.01.2015, 15:27 #1
- Registriert seit
- 06.03.2014
- Beiträge
- 92
- Thanks (gegeben)
- 1
- Thanks (bekommen)
- 3
- Total Downloaded
- 5,32 MB
- Total Downloaded
- 5,32 MB
AutoTimer checkSimilarity Methode fehlerhaft ?
Hi,
kann es sein, dass die Methode checkSimilarity falsch ist?
Ich wundere mich ständig, warum mein AutoTimer Sendungen aufnimmt, die schon längst auf der Festplatte sind.
Jetzt habe ich mir mal den entsprechenden Source Code angesehen.
Quelle: https://github.com/oe-alliance/enigm...c/AutoTimer.py
(Ist das überhaupt die richtige Quellcodedatei, die dann im openATV 4.2 Image landet ?)
Code:def checkSimilarity(self, timer, name1, name2, shortdesc1, shortdesc2, extdesc1, extdesc2, force=False): foundTitle = False foundShort = False foundExt = False if name1 and name2: foundTitle = ( 0.8 < SequenceMatcher(lambda x: x == " ",name1, name2).ratio() ) # NOTE: only check extended & short if tile is a partial match if foundTitle: if timer.searchForDuplicateDescription > 0 or force: if extdesc1 and extdesc2: # Some channels indicate replays in the extended descriptions # If the similarity percent is higher then 0.7 it is a very close match foundExt = ( 0.7 < SequenceMatcher(lambda x: x == " ",extdesc1, extdesc2).ratio() ) if not foundExt and shortdesc1 and shortdesc2: # some channels do not use extended description, so try to find a close match to short description. # If the similarity percent is higher then 0.7 it is a very close match foundShort = ( 0.7 < SequenceMatcher(lambda x: x == " ",shortdesc1, shortdesc2).ratio() ) return foundShort or foundExt
Zwei Problemfelder meine ich gefunden zu haben.
Der Parameter searchForDuplicateDescription kann folgende Werte haben:
0 = "Title"
1 = "Title and Short description"
2 = "Title and all descriptions"
Im Code gibt es aber nur ein "if timer.searchForDuplicateDescription > 0 or force:".
Das heiflt zwischen den Suchmethoden "Title and Short description" und "Title and all descriptions" wird gar nicht unterschieden.
Schlimmer ist aber, dass bei der Suchmethode "Title" scheinbar nie ein TRUE zurückgegeben wird, da es nur ein "return foundShort or foundExt" gibt und diese beiden Variablen zu Beginn der Methode auf FALSE gesetzt werden.
Ich glaube mit diesem "Tweak" wurde die Funktion kaputt gemacht:
https://github.com/oe-alliance/enigm...b8a8e557264b60
Habe ich da einen Denkfehler oder ist der Algorithmus in der Tat falsch? (Ist das erste Mal, dass ich mit Python konfrontiert bin.)
Ich habe jetzt bei mir den Code wie folgt abgeändert und schon funktioniert es richtig (für mich).
Code:def checkSimilarity(self, timer, name1, name2, shortdesc1, shortdesc2, extdesc1, extdesc2, force=False): foundTitle = False foundShort = False retValue = False if name1 and name2: foundTitle = ( 0.8 < SequenceMatcher(lambda x: x == " ",name1, name2).ratio() ) # NOTE: only check extended & short if tile is a partial match if foundTitle: if timer.searchForDuplicateDescription > 0 or force: if shortdesc1 and shortdesc2: # If the similarity percent is higher then 0.7 it is a very close match foundShort = ( 0.7 < SequenceMatcher(lambda x: x == " ",shortdesc1, shortdesc2).ratio() ) if foundShort: if timer.searchForDuplicateDescription == 3: if extdesc1 and extdesc2: # Some channels indicate replays in the extended descriptions # If the similarity percent is higher then 0.7 it is a very close match retValue = ( 0.7 < SequenceMatcher(lambda x: x == " ",extdesc1, extdesc2).ratio() ) else: retValue = True else: retValue = True return retValue
britannia
-
Advertising
Lesezeichen