1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-12 11:02:21 -05:00

Merge pull request #1323 from abeloin/patch-anime_sanitize

Modified sanitizeSceneName() for anime exception.
This commit is contained in:
Alexandre Beloin 2015-02-15 20:10:04 -05:00
commit 72060fe6a8
3 changed files with 17 additions and 7 deletions

View File

@ -669,21 +669,26 @@ def get_all_episodes_from_absolute_number(show, absolute_numbers, indexer_id=Non
return (season, episodes) return (season, episodes)
def sanitizeSceneName(name, ezrss=False): def sanitizeSceneName(name, ezrss=False, anime=False):
""" """
Takes a show name and returns the "scenified" version of it. Takes a show name and returns the "scenified" version of it.
ezrss: If true the scenified version will follow EZRSS's cracksmoker rules as best as possible ezrss: If true the scenified version will follow EZRSS's cracksmoker rules as best as possible
anime: Some show have a ' in their name(Kuroko's Basketball) and is needed for search.
Returns: A string containing the scene version of the show name given. Returns: A string containing the scene version of the show name given.
""" """
if name: if name:
if not ezrss: # anime: removed ' for Kuroko's Basketball
bad_chars = u",:()'!?\u2019" if anime:
bad_chars = u",:()!?\u2019"
# ezrss leaves : and ! in their show names as far as I can tell # ezrss leaves : and ! in their show names as far as I can tell
else: elif ezrss:
bad_chars = u",()'?\u2019" bad_chars = u",()'?\u2019"
else:
bad_chars = u",:()'!?\u2019"
# strip out any bad chars # strip out any bad chars
for x in bad_chars: for x in bad_chars:

View File

@ -61,7 +61,7 @@ class NyaaProvider(generic.TorrentProvider):
return generic.TorrentProvider.findSearchResults(self, show, episodes, search_mode, manualSearch) return generic.TorrentProvider.findSearchResults(self, show, episodes, search_mode, manualSearch)
def _get_season_search_strings(self, ep_obj): def _get_season_search_strings(self, ep_obj):
return show_name_helpers.makeSceneShowSearchStrings(self.show) return show_name_helpers.makeSceneShowSearchStrings(self.show, anime=True)
def _get_episode_search_strings(self, ep_obj, add_string=''): def _get_episode_search_strings(self, ep_obj, add_string=''):
return self._get_season_search_strings(ep_obj) return self._get_season_search_strings(ep_obj)

View File

@ -20,6 +20,7 @@ import os
import re import re
import datetime import datetime
from functools import partial
import sickbeard import sickbeard
from sickbeard import common from sickbeard import common
@ -114,11 +115,15 @@ def sceneToNormalShowNames(name):
return list(set(results)) return list(set(results))
def makeSceneShowSearchStrings(show, season=-1): def makeSceneShowSearchStrings(show, season=-1, anime=False):
showNames = allPossibleShowNames(show, season=season) showNames = allPossibleShowNames(show, season=season)
# scenify the names # scenify the names
return map(sanitizeSceneName, showNames) if anime:
sanitizeSceneNameAnime = partial(sanitizeSceneName, anime=True)
return map(sanitizeSceneNameAnime, showNames)
else:
return map(sanitizeSceneName, showNames)
def makeSceneSeasonSearchString(show, ep_obj, extraSearchType=None): def makeSceneSeasonSearchString(show, ep_obj, extraSearchType=None):