1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-04 15:12:23 -05:00

Modified sanitizeSceneName() for anime exception.

In use in nyaatorrents.py:
E.g.: Kuroko's Basketball
This commit is contained in:
Alexandre Beloin 2015-01-31 22:32:21 -05:00
parent c62d8f2c79
commit f1d46a54ce
3 changed files with 17 additions and 7 deletions

View File

@ -666,21 +666,26 @@ def get_all_episodes_from_absolute_number(show, absolute_numbers, indexer_id=Non
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.
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.
"""
if name:
if not ezrss:
bad_chars = u",:()'!?\u2019"
# anime: removed ' for Kuroko's Basketball
if anime:
bad_chars = u",:()!?\u2019"
# ezrss leaves : and ! in their show names as far as I can tell
else:
elif ezrss:
bad_chars = u",()'?\u2019"
else:
bad_chars = u",:()'!?\u2019"
# strip out any 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)
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=''):
return self._get_season_search_strings(ep_obj)

View File

@ -20,6 +20,7 @@ import os
import re
import datetime
from functools import partial
import sickbeard
from sickbeard import common
@ -114,11 +115,15 @@ def sceneToNormalShowNames(name):
return list(set(results))
def makeSceneShowSearchStrings(show, season=-1):
def makeSceneShowSearchStrings(show, season=-1, anime=False):
showNames = allPossibleShowNames(show, season=season)
# 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):