Private GIT

Skip to content
Snippets Groups Projects
Commit fdb7ca19 authored by Dustyn Gibson's avatar Dustyn Gibson
Browse files

Monkey patch new subliminal to run on py2.6

parent d8c80a49
Branches
Tags
No related merge requests found
......@@ -13,5 +13,8 @@ from .providers import Provider, ProviderPool, provider_manager
from .subtitle import Subtitle
from .video import VIDEO_EXTENSIONS, SUBTITLE_EXTENSIONS, Video, Episode, Movie, scan_videos, scan_video
class NullHandler(logging.Handler):
def emit(self, record):
pass
logging.getLogger(__name__).addHandler(logging.NullHandler())
logging.getLogger(__name__).addHandler(NullHandler())
......@@ -10,11 +10,13 @@ from dogpile.core.readwrite_lock import ReadWriteMutex # @UnresolvedImport
#: Subliminal's cache version
CACHE_VERSION = 1
EXPIRE_SECONDS = datetime.timedelta(weeks=3)
#: Expiration time for show caching
SHOW_EXPIRATION_TIME = datetime.timedelta(weeks=3).total_seconds()
SHOW_EXPIRATION_TIME = EXPIRE_SECONDS.days * 1440 + EXPIRE_SECONDS.seconds
#: Expiration time for episode caching
EPISODE_EXPIRATION_TIME = datetime.timedelta(days=3).total_seconds()
EPISODE_EXPIRATION_TIME = EXPIRE_SECONDS.days * 1440 + EXPIRE_SECONDS.seconds
def subliminal_key_generator(namespace, fn, to_str=string_type):
......
......@@ -238,7 +238,8 @@ class ProviderPool(object):
"""
def __init__(self, providers=None, provider_configs=None):
self.provider_configs = provider_configs or {}
self.providers = {p: provider_manager[p] for p in (providers or provider_manager.available_providers)}
for p in (providers or provider_manager.available_providers):
self.providers[p] = provider_manager[p]
self.initialized_providers = {}
self.discarded_providers = set()
......
......@@ -137,11 +137,11 @@ class Subtitle(object):
# remove equivalences
if isinstance(video, Episode):
if 'imdb_id' in matches:
matches -= {'series', 'tvdb_id', 'season', 'episode', 'title', 'year'}
matches -= set(('series', 'tvdb_id', 'season', 'episode', 'title', 'year'))
if 'tvdb_id' in matches:
matches -= {'series', 'year'}
matches -= set(('series', 'year'))
if 'title' in matches:
matches -= {'season', 'episode'}
matches -= set(('season', 'episode'))
# add other scores
score += sum((video.scores[match] for match in matches))
logger.info('Computed score %d with matches %r', score, initial_matches)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment