Skip to content

Commit

Permalink
Merge pull request midgetspy#885 from thezoggy/dev--omg_update
Browse files Browse the repository at this point in the history
OMG update
  • Loading branch information
midgetspy committed Oct 16, 2014
2 parents 90a7622 + 26b298e commit 59c0ae0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 9 deletions.
7 changes: 4 additions & 3 deletions sickbeard/providers/omgwtfnzbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,11 @@ def _checkAuthFromData(self, parsed_data, is_XML=True):
if 'information is incorrect' in parsedJSON.get('notice'):
logger.log(u"Incorrect authentication credentials for " + self.name + " : " + str(description_text), logger.DEBUG)
raise AuthException("Your authentication credentials for " + self.name + " are incorrect, check your config.")

elif 'please try again later' in parsedJSON.get('notice'):
logger.log(self.name + u" down for maintenance, aborting", logger.DEBUG)
return False
elif '0 results matched your terms' in parsedJSON.get('notice'):
return True

else:
logger.log(u"Unknown error given from " + self.name + " : " + str(description_text), logger.DEBUG)
return False
Expand Down Expand Up @@ -165,7 +166,7 @@ def _getRSSData(self):
params = {'user': sickbeard.OMGWTFNZBS_USERNAME,
'api': sickbeard.OMGWTFNZBS_APIKEY,
'eng': 1,
'delay': 20,
'delay': 25,
'catid': '19,20'} # SD,HD

rss_url = 'https://rss.omgwtfnzbs.org/rss-download.php?' + urllib.urlencode(params)
Expand Down
31 changes: 25 additions & 6 deletions sickbeard/show_name_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,10 @@ def makeSceneSearchString(episode):

for curShow in showNames:
for curEpString in epStrings:
toReturn.append(curShow + '.' + curEpString)
if curEpString != '':
toReturn.append(curShow + '.' + curEpString)
else:
toReturn.append(curShow)

return toReturn

Expand Down Expand Up @@ -211,6 +214,23 @@ def isGoodResult(name, show, log=True):
return False


def uniqify(seq, idfun=None):
# http://www.peterbe.com/plog/uniqifiers-benchmark
if idfun is None:
def idfun(x):
return x
seen = {}
result = []
for item in seq:
marker = idfun(item)
if marker in seen:
continue
seen[marker] = 1
result.append(item)

return result


def allPossibleShowNames(show):
"""
Figures out every possible variation of the name for a particular show. Includes TVDB name, TVRage name,
Expand All @@ -225,7 +245,7 @@ def allPossibleShowNames(show):
showNames += [name for name in get_scene_exceptions(show.tvdbid)]

# if we have a tvrage name then use it
if show.tvrname != "" and show.tvrname != None:
if show.tvrname != "" and show.tvrname is not None:
showNames.append(show.tvrname)

newShowNames = []
Expand All @@ -234,8 +254,7 @@ def allPossibleShowNames(show):
country_list.update(dict(zip(countryList.values(), countryList.keys())))

# if we have "Show Name Australia" or "Show Name (Australia)" this will add "Show Name (AU)" for
# any countries defined in common.countryList
# (and vice versa)
# any countries defined in common.countryList (and vice versa)
for curName in set(showNames):
if not curName:
continue
Expand All @@ -246,5 +265,5 @@ def allPossibleShowNames(show):
newShowNames.append(curName.replace(' (' + curCountry + ')', ' (' + country_list[curCountry] + ')'))

showNames += newShowNames

return showNames
# at this point we could have duplicates due to case-ing, prune dupes
return uniqify(showNames, lambda x: x.lower())

0 comments on commit 59c0ae0

Please sign in to comment.