mirror of
https://github.com/moparisthebest/SickRage
synced 2024-11-05 17:05:03 -05:00
Modified sanitizeSceneName() for anime exception.
In use in nyaatorrents.py: E.g.: Kuroko's Basketball
This commit is contained in:
parent
c62d8f2c79
commit
f1d46a54ce
@ -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:
|
||||
|
@ -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)
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user