mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-01 00:43:37 +00:00
Fixes issues with searches and importing existing shows
This commit is contained in:
parent
aa94711788
commit
a71ed25b19
5 changed files with 16 additions and 8 deletions
|
@ -919,6 +919,7 @@ class Tvdb:
|
||||||
selected_series = self._getSeries(key)
|
selected_series = self._getSeries(key)
|
||||||
if isinstance(selected_series, dict):
|
if isinstance(selected_series, dict):
|
||||||
selected_series = [selected_series]
|
selected_series = [selected_series]
|
||||||
|
[[self._setShowData(show['id'], k, v) for k,v in show.items()] for show in selected_series]
|
||||||
return selected_series
|
return selected_series
|
||||||
#test = self._getSeries(key)
|
#test = self._getSeries(key)
|
||||||
#sids = self._nameToSid(key)
|
#sids = self._nameToSid(key)
|
||||||
|
|
|
@ -30,7 +30,7 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import xml.etree.ElementTree as ElementTree
|
import xml.etree.ElementTree as ElementTree
|
||||||
|
|
||||||
from dateutil.parser import parse
|
from lib.dateutil.parser import parse
|
||||||
from cachecontrol import caches
|
from cachecontrol import caches
|
||||||
|
|
||||||
from tvrage_ui import BaseUI
|
from tvrage_ui import BaseUI
|
||||||
|
@ -658,6 +658,7 @@ class TVRage:
|
||||||
selected_series = self._getSeries(key)
|
selected_series = self._getSeries(key)
|
||||||
if isinstance(selected_series, dict):
|
if isinstance(selected_series, dict):
|
||||||
selected_series = [selected_series]
|
selected_series = [selected_series]
|
||||||
|
[[self._setShowData(show['id'], k, v) for k, v in show.items()] for show in selected_series]
|
||||||
return selected_series
|
return selected_series
|
||||||
#test = self._getSeries(key)
|
#test = self._getSeries(key)
|
||||||
#sids = self._nameToSid(key)
|
#sids = self._nameToSid(key)
|
||||||
|
|
|
@ -21,6 +21,7 @@ import sickbeard
|
||||||
|
|
||||||
import urllib
|
import urllib
|
||||||
import datetime
|
import datetime
|
||||||
|
from lib.dateutil import parser
|
||||||
|
|
||||||
from common import USER_AGENT, Quality
|
from common import USER_AGENT, Quality
|
||||||
|
|
||||||
|
@ -154,16 +155,20 @@ class AllShowsListUI:
|
||||||
if allSeries:
|
if allSeries:
|
||||||
if 'searchterm' in self.config:
|
if 'searchterm' in self.config:
|
||||||
searchterm = self.config['searchterm']
|
searchterm = self.config['searchterm']
|
||||||
|
|
||||||
# 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 curShow in allSeries:
|
||||||
if curShow in searchResults:
|
if curShow in searchResults:
|
||||||
continue
|
continue
|
||||||
searchterm = re.escape(searchterm)
|
if 'seriesname' in curShow:
|
||||||
if re.search(searchterm, curShow['seriesname'], flags=re.I) and 'firstaired' in curShow:
|
if searchterm.lower() in curShow['seriesname'].lower():
|
||||||
searchResults.append(curShow)
|
if 'firstaired' not in curShow:
|
||||||
|
curShow['firstaired'] = str(datetime.date.fromordinal(1))
|
||||||
|
curShow['firstaired'] = re.sub("([-]0{2}){1,}", "", curShow['firstaired'])
|
||||||
|
fixDate = parser.parse(curShow['firstaired'], fuzzy=True).date()
|
||||||
|
curShow['firstaired'] = fixDate.strftime("%Y-%m-%d")
|
||||||
|
searchResults.append(curShow)
|
||||||
|
|
||||||
return searchResults
|
return searchResults
|
||||||
|
|
||||||
class ShowListUI:
|
class ShowListUI:
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1977,7 +1977,8 @@ class NewHomeAddShows:
|
||||||
try:
|
try:
|
||||||
# add search results
|
# add search results
|
||||||
results.setdefault(indexer, []).extend(t[search_term])
|
results.setdefault(indexer, []).extend(t[search_term])
|
||||||
except:continue
|
except Exception, e:
|
||||||
|
continue
|
||||||
|
|
||||||
|
|
||||||
map(final_results.extend,
|
map(final_results.extend,
|
||||||
|
|
|
@ -31,7 +31,7 @@ from sickbeard import classes
|
||||||
class APICheck(unittest.TestCase):
|
class APICheck(unittest.TestCase):
|
||||||
|
|
||||||
lang = "en"
|
lang = "en"
|
||||||
search_term = 'Reign (2013)'
|
search_term = 'Gold Rush South America'
|
||||||
|
|
||||||
results = {}
|
results = {}
|
||||||
final_results = []
|
final_results = []
|
||||||
|
|
Loading…
Reference in a new issue