mirror of
https://github.com/Jonny007-MKD/OTR-SaneRename
synced 2025-01-22 08:49:48 +01:00
Added lower() in liberal search
This commit is contained in:
parent
1a9f9772ce
commit
a5b6136bf3
1 changed files with 9 additions and 4 deletions
13
saneRenamix.py
Normal file → Executable file
13
saneRenamix.py
Normal file → Executable file
|
@ -382,7 +382,6 @@ def getEpisodeTitleFromEpgData(info: EpisodeInfo, seriesID: int, args: dict):
|
||||||
for i in range(len(words)): # cut off one word at a time from the end
|
for i in range(len(words)): # cut off one word at a time from the end
|
||||||
for j in range(len(words), i, -1): # cut off one word at a time from the beginning
|
for j in range(len(words), i, -1): # cut off one word at a time from the beginning
|
||||||
title = " ".join(words[i:j])
|
title = " ".join(words[i:j])
|
||||||
logging.debug(f' trying "{title}"')
|
|
||||||
found = searchFunc(title)
|
found = searchFunc(title)
|
||||||
if found:
|
if found:
|
||||||
saveInfo(found)
|
saveInfo(found)
|
||||||
|
@ -402,19 +401,23 @@ def getEpisodeTitleFromEpgData(info: EpisodeInfo, seriesID: int, args: dict):
|
||||||
|
|
||||||
logging.debug(" searching for a matching episode name (exactly)")
|
logging.debug(" searching for a matching episode name (exactly)")
|
||||||
def searchByName(title: str):
|
def searchByName(title: str):
|
||||||
|
logging.debug(f' trying "{title}"')
|
||||||
return episodesByName.get(title, None)
|
return episodesByName.get(title, None)
|
||||||
found = doSearch(searchByName)
|
found = doSearch(searchByName)
|
||||||
if found: return
|
if found: return
|
||||||
|
|
||||||
logging.debug(" searching for a matching episode name more liberally")
|
logging.debug(" searching for a matching episode name more liberally")
|
||||||
episodesByName2 = { regex.sub("", e["episodeName"]): e for e in episodes }
|
episodesByName2 = { regex.sub("", e["episodeName"]).lower(): e for e in episodes }
|
||||||
def searchByName2(title: str):
|
def searchByName2(title: str):
|
||||||
return episodesByName2.get(regex.sub("", title), None)
|
title = regex.sub("", title).lower()
|
||||||
|
logging.debug(f' trying "{title}"')
|
||||||
|
return episodesByName2.get(title, None)
|
||||||
found = doSearch(searchByName2)
|
found = doSearch(searchByName2)
|
||||||
if found: return
|
if found: return
|
||||||
|
|
||||||
logging.debug(" searching for a matching description (startswith)")
|
logging.debug(" searching for a matching description (startswith)")
|
||||||
def searchByOverview(overview: str):
|
def searchByOverview(overview: str):
|
||||||
|
logging.debug(f' trying "{overview}"')
|
||||||
results = [ e for e in episodes if e["overview"] and e["overview"].startswith(overview) ]
|
results = [ e for e in episodes if e["overview"] and e["overview"].startswith(overview) ]
|
||||||
if len(results) == 1: return results[0]
|
if len(results) == 1: return results[0]
|
||||||
return None
|
return None
|
||||||
|
@ -423,7 +426,9 @@ def getEpisodeTitleFromEpgData(info: EpisodeInfo, seriesID: int, args: dict):
|
||||||
|
|
||||||
logging.debug(" searching for a matching description more liberally (startswith)")
|
logging.debug(" searching for a matching description more liberally (startswith)")
|
||||||
def searchByOverview2(overview: str):
|
def searchByOverview2(overview: str):
|
||||||
results = [ e for e in episodes if e["overview"] and regex.sub("", e["overview"]).startswith(regex.sub(overview)) ]
|
overview = regex.sub("", overview).lower()
|
||||||
|
logging.debug(f' trying "{overview}"')
|
||||||
|
results = [ e for e in episodes if e["overview"] and regex.sub("", e["overview"]).lower().startswith(overview) ]
|
||||||
if len(results) == 1: return results[0]
|
if len(results) == 1: return results[0]
|
||||||
return None
|
return None
|
||||||
found = doSearch(searchByOverview2)
|
found = doSearch(searchByOverview2)
|
||||||
|
|
Loading…
Reference in a new issue