mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-21 13:53:15 -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
44
libs/common/subliminal/refiners/hash.py
Normal file
44
libs/common/subliminal/refiners/hash.py
Normal file
|
@ -0,0 +1,44 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import logging
|
||||
|
||||
from ..extensions import provider_manager, default_providers
|
||||
from ..utils import hash_napiprojekt, hash_opensubtitles, hash_shooter, hash_thesubdb
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
hash_functions = {
|
||||
'napiprojekt': hash_napiprojekt,
|
||||
'opensubtitles': hash_opensubtitles,
|
||||
'opensubtitlesvip': hash_opensubtitles,
|
||||
'shooter': hash_shooter,
|
||||
'thesubdb': hash_thesubdb
|
||||
}
|
||||
|
||||
|
||||
def refine(video, providers=None, languages=None, **kwargs):
|
||||
"""Refine a video computing required hashes for the given providers.
|
||||
|
||||
The following :class:`~subliminal.video.Video` attribute can be found:
|
||||
|
||||
* :attr:`~subliminal.video.Video.hashes`
|
||||
|
||||
"""
|
||||
if video.size <= 10485760:
|
||||
logger.warning('Size is lower than 10MB: hashes not computed')
|
||||
return
|
||||
|
||||
logger.debug('Computing hashes for %r', video.name)
|
||||
for name in providers or default_providers:
|
||||
provider = provider_manager[name].plugin
|
||||
if name not in hash_functions:
|
||||
continue
|
||||
|
||||
if not provider.check_types(video):
|
||||
continue
|
||||
|
||||
if languages and not provider.check_languages(languages):
|
||||
continue
|
||||
|
||||
video.hashes[name] = hash_functions[name](video.name)
|
||||
|
||||
logger.debug('Computed hashes %r', video.hashes)
|
Loading…
Add table
Add a link
Reference in a new issue