From 21b7aa27850038387b8ac6632d5283ddd4217509 Mon Sep 17 00:00:00 2001 From: Nils Vogels Date: Mon, 5 May 2014 23:08:10 +0200 Subject: [PATCH] Only process if there is a name present --- sickbeard/helpers.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/sickbeard/helpers.py b/sickbeard/helpers.py index 3905ea4a..5a4f0230 100644 --- a/sickbeard/helpers.py +++ b/sickbeard/helpers.py @@ -658,24 +658,26 @@ def sanitizeSceneName(name, ezrss=False): Returns: A string containing the scene version of the show name given. """ - if not ezrss: - bad_chars = u",:()'!?\u2019" - # ezrss leaves : and ! in their show names as far as I can tell - else: - bad_chars = u",()'?\u2019" + if name: - # strip out any bad chars - for x in bad_chars: - name = name.replace(x, "") + if not ezrss: + bad_chars = u",:()'!?\u2019" + # ezrss leaves : and ! in their show names as far as I can tell + else: + bad_chars = u",()'?\u2019" - # tidy up stuff that doesn't belong in scene names - name = name.replace("- ", ".").replace(" ", ".").replace("&", "and").replace('/', '.') - name = re.sub("\.\.*", ".", name) + # strip out any bad chars + for x in bad_chars: + name = name.replace(x, "") - if name.endswith('.'): - name = name[:-1] + # tidy up stuff that doesn't belong in scene names + name = name.replace("- ", ".").replace(" ", ".").replace("&", "and").replace('/', '.') + name = re.sub("\.\.*", ".", name) - return name + if name.endswith('.'): + name = name[:-1] + + return name def create_https_certificates(ssl_cert, ssl_key):