From 2c98a5a448932ce40df6b78292c2364c58c69d68 Mon Sep 17 00:00:00 2001 From: echel0n Date: Sun, 29 Jun 2014 23:20:19 -0700 Subject: [PATCH] Fixed "show must be added to list", regexes now check if numbers following after the series name is a date or part of the series name to properly parse and return correct show object. Fixes TVDB and TVRAGE cache_location variable. --- lib/tvdb_api/tvdb_api.py | 6 ++++-- lib/tvrage_api/tvrage_api.py | 6 ++++-- sickbeard/name_parser/parser.py | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/tvdb_api/tvdb_api.py b/lib/tvdb_api/tvdb_api.py index 30942e29..4a09261b 100644 --- a/lib/tvdb_api/tvdb_api.py +++ b/lib/tvdb_api/tvdb_api.py @@ -466,12 +466,14 @@ class Tvdb: if cache is True: self.config['cache_enabled'] = True - self.sess = cachecontrol.CacheControl(cache=caches.FileCache(self._getTempDir())) + self.config['cache_location'] = self._getTempDir() + self.sess = cachecontrol.CacheControl(cache=caches.FileCache(self.config['cache_location'])) elif cache is False: self.config['cache_enabled'] = False elif isinstance(cache, basestring): self.config['cache_enabled'] = True - self.sess = cachecontrol.CacheControl(cache=caches.FileCache(cache)) + self.config['cache_location'] = cache + self.sess = cachecontrol.CacheControl(cache=caches.FileCache(self.config['cache_location'])) else: raise ValueError("Invalid value for Cache %r (type was %s)" % (cache, type(cache))) diff --git a/lib/tvrage_api/tvrage_api.py b/lib/tvrage_api/tvrage_api.py index e1661627..9aae00d2 100644 --- a/lib/tvrage_api/tvrage_api.py +++ b/lib/tvrage_api/tvrage_api.py @@ -318,12 +318,14 @@ class TVRage: if cache is True: self.config['cache_enabled'] = True - self.sess = cachecontrol.CacheControl(cache=caches.FileCache(self._getTempDir())) + self.config['cache_location'] = self._getTempDir() + self.sess = cachecontrol.CacheControl(cache=caches.FileCache(self.config['cache_location'])) elif cache is False: self.config['cache_enabled'] = False elif isinstance(cache, basestring): self.config['cache_enabled'] = True - self.sess = cachecontrol.CacheControl(cache=caches.FileCache(cache)) + self.config['cache_location'] = cache + self.sess = cachecontrol.CacheControl(cache=caches.FileCache(self.config['cache_location'])) else: raise ValueError("Invalid value for Cache %r (type was %s)" % (cache, type(cache))) diff --git a/sickbeard/name_parser/parser.py b/sickbeard/name_parser/parser.py index bf57c84a..1f02a38f 100644 --- a/sickbeard/name_parser/parser.py +++ b/sickbeard/name_parser/parser.py @@ -124,8 +124,8 @@ class NameParser(object): if not self.showObj and not self.naming_pattern: # Regex pattern to return the Show / Series Name regardless of the file pattern tossed at it, matched 53 show name examples from regexes.py - show_pattern = '''(?:(?:\[.*?\])|(?:\d{3}[\.-]))*[ _\.]?(?P.*?(?:[ ._-](\d{4}))?)(?:(?:(?:[ ._-]+\d+)|(?:[ ._-]+s\d{2}))|(?:\W+(?:(?:S\d[\dE._ -])|(?:\d\d?x)|(?:\d{4}\W\d\d\W\d\d)|(?:(?:part|pt)[\._ -]?(?:\d|[ivx]))|Season\W+\d+\W+|E\d+\W+|(?:\d{1,3}.+\d{1,}[a-zA-Z]{2}\W+[a-zA-Z]{3,}\W+\d{4}.+))))''' - show_pattern_alt = '''^(?P.*?(?:[ ._-](\d{4}))?)(?:(?:(?:[ ._-]+\d+)|(?:[ ._-]+s\d{2}))|(?:\W+(?:(?:S\d[\dE._ -])|(?:\d\d?x)|(?:\d{4}\W\d\d\W\d\d)|(?:(?:part|pt)[\._ -]?(?:\d|[ivx]))|Season\W+\d+\W+|E\d+\W+|(?:\d{1,3}.+\d{1,}[a-zA-Z]{2}\W+[a-zA-Z]{3,}\W+\d{4}.+))))''' + show_pattern = '''(?:(?:\[.*?\])|(?:\d{3}[\.-]))*[ _\.]?(?P.*?(?:[ ._-]((?!\d{4}\W\d\d\W\d\d\W)\d{4}))?)(?:(?:(?:[ ._-]+\d+)|(?:[ ._-]+s\d{2}))|(?:\W+(?:(?:S\d[\dE._ -])|(?:\d\d?x)|(?:\d{4}\W\d\d\W\d\d)|(?:(?:part|pt)[\._ -]?(?:\d|[ivx]))|Season\W+\d+\W+|E\d+\W+|(?:\d{1,3}.+\d{1,}[a-zA-Z]{2}\W+[a-zA-Z]{3,}\W+\d{4}.+))))''' + show_pattern_alt = '''^(?P.*?(?:[ ._-]((?!\d{4}\W\d\d\W\d\d\W)\d{4}))?)(?:(?:(?:[ ._-]+\d+)|(?:[ ._-]+s\d{2}))|(?:\W+(?:(?:S\d[\dE._ -])|(?:\d\d?x)|(?:\d{4}\W\d\d\W\d\d)|(?:(?:part|pt)[\._ -]?(?:\d|[ivx]))|Season\W+\d+\W+|E\d+\W+|(?:\d{1,3}.+\d{1,}[a-zA-Z]{2}\W+[a-zA-Z]{3,}\W+\d{4}.+))))''' self.showObj = self._matchShowName(name, show_pattern) if not self.showObj: