Browse Source

Merge branch 'hotfix/0.21.8'

tags/release_0.21.8^0 release_0.21.8
JackDandy 5 years ago
parent
commit
c48659025c
  1. 9
      CHANGES.md
  2. 32
      sickbeard/name_cache.py
  3. 8
      sickbeard/postProcessor.py
  4. 3
      sickbeard/providers/omgwtfnzbs.py
  5. 4
      sickbeard/tv_base.py

9
CHANGES.md

@ -1,4 +1,11 @@
### 0.21.7 (2020-01-24 15:05:00 UTC) ### 0.21.8 (2020-01-27 09:00:00 UTC)
* Fix issue processing files with no quality parsed
* Change remove nonsense text that quality of pp item is from snatch history given that it may not be
* Fix update NameCache in case show name changes
### 0.21.7 (2020-01-24 15:05:00 UTC)
* Fix rTorrent py3 compat * Fix rTorrent py3 compat
* Fix edit show with multiple list values under py3 * Fix edit show with multiple list values under py3

32
sickbeard/name_cache.py

@ -22,12 +22,12 @@ import sickbeard
from . import db from . import db
from .helpers import try_int from .helpers import try_int
from _23 import list_items
from six import iteritems from six import iteritems
# noinspection PyUnreachableCode # noinspection PyUnreachableCode
if False: if False:
from typing import AnyStr, Tuple, Union from typing import AnyStr, Optional, Tuple, Union
from .tv import TVShow, TVShowBase
nameCache = {} nameCache = {}
nameCacheLock = threading.Lock() nameCacheLock = threading.Lock()
@ -47,10 +47,11 @@ def addNameToCache(name, tvid=0, prodid=0, season=-1):
""" """
global nameCache global nameCache
# standardize the name we're using to account for small differences in providers with nameCacheLock:
name = sickbeard.helpers.full_sanitize_scene_name(name) # standardize the name we're using to account for small differences in providers
if name not in nameCache: name = sickbeard.helpers.full_sanitize_scene_name(name)
nameCache[name] = [int(tvid), int(prodid), season] if name not in nameCache:
nameCache[name] = [int(tvid), int(prodid), season]
def retrieveNameFromCache(name): def retrieveNameFromCache(name):
@ -63,16 +64,19 @@ def retrieveNameFromCache(name):
global nameCache global nameCache
name = sickbeard.helpers.full_sanitize_scene_name(name) name = sickbeard.helpers.full_sanitize_scene_name(name)
if name in nameCache: try:
return int(nameCache[name][0]), int(nameCache[name][1]) if name in nameCache:
return int(nameCache[name][0]), int(nameCache[name][1])
except (BaseException, Exception):
pass
return None, None return None, None
def buildNameCache(show_obj=None): def buildNameCache(show_obj=None):
# type: (Optional[Union[TVShow, TVShowBase]]) -> None
"""Adds all new name exceptions to the namecache memory and flushes any removed name exceptions """Adds all new name exceptions to the namecache memory and flushes any removed name exceptions
:param show_obj : (optional) Only update namecache for this show object :param show_obj : Only update name cache for this show object, otherwise update all
:type show_obj: sickbeard.tv.TVShow or None
""" """
global nameCache global nameCache
with nameCacheLock: with nameCacheLock:
@ -80,7 +84,8 @@ def buildNameCache(show_obj=None):
if show_obj: if show_obj:
# search for only the requested show id and flush old show entries from namecache # search for only the requested show id and flush old show entries from namecache
show_ids = {show_obj.tvid: [show_obj.prodid]} show_ids = {show_obj.tvid: [show_obj.prodid]}
nameCache = dict([(k, v) for k, v in list_items(nameCache) if v != (show_obj.tvid, show_obj.prodid)]) nameCache = dict([(k, v) for k, v in iteritems(nameCache)
if not (v[0] == show_obj.tvid and v[1] == show_obj.prodid)])
# add standard indexer name to namecache # add standard indexer name to namecache
nameCache[sickbeard.helpers.full_sanitize_scene_name(show_obj.name)] = [show_obj.tvid, show_obj.prodid, -1] nameCache[sickbeard.helpers.full_sanitize_scene_name(show_obj.name)] = [show_obj.tvid, show_obj.prodid, -1]
@ -123,5 +128,6 @@ def remove_from_namecache(tvid, prodid):
""" """
global nameCache global nameCache
if nameCache: with nameCacheLock:
nameCache = dict([(k, v) for k, v in list_items(nameCache) if v != (tvid, prodid)]) if nameCache:
nameCache = dict([(k, v) for k, v in iteritems(nameCache) if not (v[0] == tvid and v[1] == prodid)])

8
sickbeard/postProcessor.py

@ -66,7 +66,8 @@ class PostProcessor(object):
nzb_name: The name of the NZB which resulted in this file being downloaded (optional) nzb_name: The name of the NZB which resulted in this file being downloaded (optional)
""" """
# absolute path to the folder that is being processed # absolute path to the folder that is being processed
self.folder_path = long_path(ek.ek(os.path.dirname, long_path(ek.ek(os.path.abspath, long_path(file_path))))) # type: AnyStr self.folder_path = long_path(ek.ek(os.path.dirname, long_path(
ek.ek(os.path.abspath, long_path(file_path))))) # type: AnyStr
# full path to file # full path to file
self.file_path = long_path(file_path) # type: AnyStr self.file_path = long_path(file_path) # type: AnyStr
@ -1032,12 +1033,11 @@ class PostProcessor(object):
ep_obj = self._get_ep_obj(show_obj, season_number, episode_numbers) ep_obj = self._get_ep_obj(show_obj, season_number, episode_numbers)
# get the quality of the episode we're processing # get the quality of the episode we're processing
if common.Quality.UNKNOWN == quality: if quality in (None, common.Quality.UNKNOWN):
new_ep_quality = self._get_quality(ep_obj) new_ep_quality = self._get_quality(ep_obj)
else: else:
new_ep_quality = quality new_ep_quality = quality
self._log(u'Using "%s" quality from the snatch history' self._log(u'Using "%s" quality' % common.Quality.qualityStrings[new_ep_quality], logger.DEBUG)
% common.Quality.qualityStrings[new_ep_quality], logger.DEBUG)
# see if it's safe to replace existing episode (is download snatched, PROPER, better quality) # see if it's safe to replace existing episode (is download snatched, PROPER, better quality)
if not self._safe_replace(ep_obj, new_ep_quality): if not self._safe_replace(ep_obj, new_ep_quality):

3
sickbeard/providers/omgwtfnzbs.py

@ -55,6 +55,7 @@ class OmgwtfnzbsProvider(generic.NZBProvider):
'search_html': self.url_base + 'browse.php?cat=tv&search=%s'} # type: Dict[AnyStr, AnyStr] 'search_html': self.url_base + 'browse.php?cat=tv&search=%s'} # type: Dict[AnyStr, AnyStr]
self.needs_auth = True # type: bool self.needs_auth = True # type: bool
self.nn = True # type: bool
self.username, self.api_key, self.cookies = 3 * [None] self.username, self.api_key, self.cookies = 3 * [None]
self.cache = OmgwtfnzbsCache(self) self.cache = OmgwtfnzbsCache(self)
@ -395,6 +396,8 @@ class OmgwtfnzbsProvider(generic.NZBProvider):
self.cookies = re.sub(r'(?i)([\s\']+|cookie\s*:)', '', api_key) self.cookies = re.sub(r'(?i)([\s\']+|cookie\s*:)', '', api_key)
success, msg = self._check_cookie() success, msg = self._check_cookie()
if success and self.nn:
success, msg = None, 'pm dev in irc about this feature'
if not success: if not success:
logger.log(u'%s: %s' % (msg, self.cookies), logger.WARNING) logger.log(u'%s: %s' % (msg, self.cookies), logger.WARNING)
self.cookies = None self.cookies = None

4
sickbeard/tv_base.py

@ -20,6 +20,7 @@ import sickbeard
from . import logger from . import logger
from ._legacy_classes import LegacyTVShow, LegacyTVEpisode from ._legacy_classes import LegacyTVShow, LegacyTVEpisode
from .common import UNKNOWN from .common import UNKNOWN
from .name_cache import buildNameCache
from six import string_types from six import string_types
@ -92,7 +93,10 @@ class TVShowBase(LegacyTVShow, TVBase):
@name.setter @name.setter
def name(self, *arg): def name(self, *arg):
_current_name = self._name
self.dirty_setter('_name')(self, *arg) self.dirty_setter('_name')(self, *arg)
if _current_name != self._name:
buildNameCache(self)
# imdbid = property(lambda self: self._imdbid, dirty_setter('_imdbid')) # imdbid = property(lambda self: self._imdbid, dirty_setter('_imdbid'))
@property @property

Loading…
Cancel
Save