mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-14 18:47:09 -07:00
Updates vendored subliminal to 2.1.0
Updates rarfile to 3.1 Updates stevedore to 3.5.0 Updates appdirs to 1.4.4 Updates click to 8.1.3 Updates decorator to 5.1.1 Updates dogpile.cache to 1.1.8 Updates pbr to 5.11.0 Updates pysrt to 1.1.2 Updates pytz to 2022.6 Adds importlib-metadata version 3.1.1 Adds typing-extensions version 4.1.1 Adds zipp version 3.11.0
This commit is contained in:
parent
d8da02cb69
commit
f05b09f349
694 changed files with 16621 additions and 11056 deletions
|
@ -7,7 +7,6 @@ import requests
|
|||
from .. import __short_version__
|
||||
from ..cache import REFINER_EXPIRATION_TIME, region
|
||||
from ..video import Episode, Movie
|
||||
from ..utils import sanitize
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -68,7 +67,8 @@ class OMDBClient(object):
|
|||
return j
|
||||
|
||||
|
||||
omdb_client = OMDBClient(headers={'User-Agent': 'Subliminal/%s' % __short_version__})
|
||||
user_agent = 'Subliminal/%s' % __short_version__
|
||||
omdb_client = OMDBClient(headers={'User-Agent': user_agent})
|
||||
|
||||
|
||||
@region.cache_on_arguments(expiration_time=REFINER_EXPIRATION_TIME)
|
||||
|
@ -89,7 +89,7 @@ def search(title, type, year):
|
|||
return all_results
|
||||
|
||||
|
||||
def refine(video, **kwargs):
|
||||
def refine(video, apikey=None, **kwargs):
|
||||
"""Refine a video by searching `OMDb API <http://omdbapi.com/>`_.
|
||||
|
||||
Several :class:`~subliminal.video.Episode` attributes can be found:
|
||||
|
@ -105,6 +105,12 @@ def refine(video, **kwargs):
|
|||
* :attr:`~subliminal.video.Video.imdb_id`
|
||||
|
||||
"""
|
||||
if not apikey:
|
||||
logger.warning('No apikey. Skipping omdb refiner.')
|
||||
return
|
||||
|
||||
omdb_client.session.params['apikey'] = apikey
|
||||
|
||||
if isinstance(video, Episode):
|
||||
# exit if the information is complete
|
||||
if video.series_imdb_id:
|
||||
|
@ -119,7 +125,7 @@ def refine(video, **kwargs):
|
|||
logger.debug('Found %d results', len(results))
|
||||
|
||||
# filter the results
|
||||
results = [r for r in results if sanitize(r['Title']) == sanitize(video.series)]
|
||||
results = [r for r in results if video.matches(r['Title'])]
|
||||
if not results:
|
||||
logger.warning('No matching series found')
|
||||
return
|
||||
|
@ -154,12 +160,12 @@ def refine(video, **kwargs):
|
|||
# search the movie
|
||||
results = search(video.title, 'movie', video.year)
|
||||
if not results:
|
||||
logger.warning('No results')
|
||||
logger.warning('No results for movie')
|
||||
return
|
||||
logger.debug('Found %d results', len(results))
|
||||
|
||||
# filter the results
|
||||
results = [r for r in results if sanitize(r['Title']) == sanitize(video.title)]
|
||||
results = [r for r in results if video.matches(r['Title'])]
|
||||
if not results:
|
||||
logger.warning('No matching movie found')
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue