mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-01-08 15:57:36 +08:00
core: update to subliminal_patch:head; add missing file
This commit is contained in:
parent
98f456e20f
commit
ee65371089
3 changed files with 26 additions and 10 deletions
|
@ -86,6 +86,7 @@ class CFSession(CloudflareScraper, CertifiSession, TimeoutSession):
|
|||
self.headers['User-Agent'] = user_agent
|
||||
|
||||
ret = super(CFSession, self).request(method, url, *args, **kwargs)
|
||||
|
||||
try:
|
||||
cf_data = self.get_live_tokens(domain)
|
||||
except:
|
||||
|
|
|
@ -200,23 +200,23 @@ class SubsceneProvider(Provider, ProviderSubtitleArchiveMixin):
|
|||
def query(self, video):
|
||||
vfn = get_video_filename(video)
|
||||
subtitles = []
|
||||
logger.debug(u"Searching for: %s", vfn)
|
||||
film = search(vfn, session=self.session)
|
||||
#logger.debug(u"Searching for: %s", vfn)
|
||||
# film = search(vfn, session=self.session)
|
||||
#
|
||||
# if film and film.subtitles:
|
||||
# logger.debug('Release results found: %s', len(film.subtitles))
|
||||
# subtitles = self.parse_results(video, film)
|
||||
# else:
|
||||
# logger.debug('No release results found')
|
||||
|
||||
if film and film.subtitles:
|
||||
logger.debug('Release results found: %s', len(film.subtitles))
|
||||
subtitles = self.parse_results(video, film)
|
||||
else:
|
||||
logger.debug('No release results found')
|
||||
|
||||
time.sleep(self.search_throttle)
|
||||
#time.sleep(self.search_throttle)
|
||||
|
||||
# re-search for episodes without explicit release name
|
||||
if isinstance(video, Episode):
|
||||
#term = u"%s S%02iE%02i" % (video.series, video.season, video.episode)
|
||||
more_than_one = len([video.series] + video.alternative_series) > 1
|
||||
for series in [video.series] + video.alternative_series:
|
||||
term = u"%s - %s Season" % (series, p.number_to_words("%sth" % video.season).capitalize())
|
||||
time.sleep(self.search_throttle)
|
||||
logger.debug('Searching for alternative results: %s', term)
|
||||
film = search(term, session=self.session, release=False)
|
||||
if film and film.subtitles:
|
||||
|
@ -238,12 +238,17 @@ class SubsceneProvider(Provider, ProviderSubtitleArchiveMixin):
|
|||
logger.debug('No pack results found')
|
||||
else:
|
||||
logger.debug("Not searching for packs, because the season hasn't fully aired")
|
||||
if more_than_one:
|
||||
time.sleep(self.search_throttle)
|
||||
else:
|
||||
more_than_one = len([video.title] + video.alternative_titles) > 1
|
||||
for title in [video.title] + video.alternative_titles:
|
||||
logger.debug('Searching for movie results: %s', title)
|
||||
film = search(title, year=video.year, session=self.session, limit_to=None, release=False)
|
||||
if film and film.subtitles:
|
||||
subtitles += self.parse_results(video, film)
|
||||
if more_than_one:
|
||||
time.sleep(self.search_throttle)
|
||||
|
||||
logger.info("%s subtitles found" % len(subtitles))
|
||||
return subtitles
|
||||
|
|
10
libs/subliminal_patch/refiners/util.py
Normal file
10
libs/subliminal_patch/refiners/util.py
Normal file
|
@ -0,0 +1,10 @@
|
|||
# coding=utf-8
|
||||
|
||||
import types
|
||||
from subliminal_patch.http import TimeoutSession
|
||||
|
||||
|
||||
def fix_session_bases(obj):
|
||||
obj.__class__ = type("PatchedTimeoutSession", (TimeoutSession,),
|
||||
{"request": types.MethodType(TimeoutSession.request, obj)})
|
||||
return obj
|
Loading…
Reference in a new issue