mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-07 10:33:38 +00:00
Change improve add show search results by comparing search term to an additional unidecoded result set.
This commit is contained in:
parent
b07712181a
commit
e43e3c7c56
2 changed files with 23 additions and 20 deletions
|
@ -6,6 +6,7 @@
|
||||||
* Change improve page load time when loading images
|
* Change improve page load time when loading images
|
||||||
* Update isotope library 2.2.2 to 3.0.1
|
* Update isotope library 2.2.2 to 3.0.1
|
||||||
* Add lazyload package 3.0.0 (2e318b1)
|
* Add lazyload package 3.0.0 (2e318b1)
|
||||||
|
* Change improve add show search results by comparing search term to an additional unidecoded result set
|
||||||
|
|
||||||
|
|
||||||
[develop changelog]
|
[develop changelog]
|
||||||
|
|
|
@ -21,6 +21,7 @@ import datetime
|
||||||
import sickbeard
|
import sickbeard
|
||||||
from lib.dateutil import parser
|
from lib.dateutil import parser
|
||||||
from sickbeard.common import Quality
|
from sickbeard.common import Quality
|
||||||
|
from unidecode import unidecode
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
@ -121,35 +122,36 @@ class AllShowsListUI:
|
||||||
self.log = log
|
self.log = log
|
||||||
|
|
||||||
def selectSeries(self, allSeries):
|
def selectSeries(self, allSeries):
|
||||||
searchResults = []
|
search_results = []
|
||||||
seriesnames = []
|
|
||||||
|
|
||||||
# get all available shows
|
# get all available shows
|
||||||
if allSeries:
|
if allSeries:
|
||||||
if 'searchterm' in self.config:
|
search_term = self.config.get('searchterm', '').lower()
|
||||||
searchterm = self.config['searchterm']
|
if search_term:
|
||||||
# try to pick a show that's in my show list
|
# try to pick a show that's in my show list
|
||||||
for curShow in allSeries:
|
for cur_show in allSeries:
|
||||||
if curShow in searchResults:
|
if cur_show in search_results:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if 'seriesname' in curShow:
|
seriesnames = []
|
||||||
seriesnames.append(curShow['seriesname'])
|
if 'seriesname' in cur_show:
|
||||||
if 'aliasnames' in curShow:
|
name = cur_show['seriesname'].lower()
|
||||||
seriesnames.extend(curShow['aliasnames'].split('|'))
|
seriesnames += [name, unidecode(name)]
|
||||||
|
if 'aliasnames' in cur_show:
|
||||||
|
name = cur_show['aliasnames'].lower()
|
||||||
|
seriesnames += [name.split('|'), unidecode(name).split('|')]
|
||||||
|
|
||||||
for name in seriesnames:
|
if search_term in seriesnames:
|
||||||
if searchterm.lower() in name.lower():
|
if 'firstaired' not in cur_show:
|
||||||
if 'firstaired' not in curShow:
|
cur_show['firstaired'] = str(datetime.date.fromordinal(1))
|
||||||
curShow['firstaired'] = str(datetime.date.fromordinal(1))
|
cur_show['firstaired'] = re.sub('([-]0{2})+', '', cur_show['firstaired'])
|
||||||
curShow['firstaired'] = re.sub('([-]0{2}){1,}', '', curShow['firstaired'])
|
fix_date = parser.parse(cur_show['firstaired'], fuzzy=True).date()
|
||||||
fixDate = parser.parse(curShow['firstaired'], fuzzy=True).date()
|
cur_show['firstaired'] = fix_date.strftime('%Y-%m-%d')
|
||||||
curShow['firstaired'] = fixDate.strftime('%Y-%m-%d')
|
|
||||||
|
|
||||||
if curShow not in searchResults:
|
if cur_show not in search_results:
|
||||||
searchResults += [curShow]
|
search_results += [cur_show]
|
||||||
|
|
||||||
return searchResults
|
return search_results
|
||||||
|
|
||||||
|
|
||||||
class ShowListUI:
|
class ShowListUI:
|
||||||
|
|
Loading…
Reference in a new issue