mirror of https://github.com/morpheus65535/bazarr
Added minimal Python 3.12 compatibility. Not yet official support.
This commit is contained in:
parent
516df9d410
commit
6dbe143364
|
@ -321,8 +321,8 @@ class Scheduler:
|
||||||
self.aps_scheduler.modify_job(job.id,
|
self.aps_scheduler.modify_job(job.id,
|
||||||
next_run_time=datetime.now(tz=self.timezone) +
|
next_run_time=datetime.now(tz=self.timezone) +
|
||||||
timedelta(seconds=randrange(
|
timedelta(seconds=randrange(
|
||||||
job.trigger.interval.total_seconds() * 0.75,
|
int(job.trigger.interval.total_seconds() * 0.75),
|
||||||
job.trigger.interval.total_seconds())))
|
int(job.trigger.interval.total_seconds()))))
|
||||||
|
|
||||||
def __no_task(self):
|
def __no_task(self):
|
||||||
for job in self.aps_scheduler.get_jobs():
|
for job in self.aps_scheduler.get_jobs():
|
||||||
|
|
|
@ -591,7 +591,7 @@ def scan_videos(path, age=None, archives=True):
|
||||||
|
|
||||||
|
|
||||||
def refine(video, episode_refiners=None, movie_refiners=None, **kwargs):
|
def refine(video, episode_refiners=None, movie_refiners=None, **kwargs):
|
||||||
"""Refine a video using :ref:`refiners`.
|
r"""Refine a video using :ref:`refiners`.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
|
@ -619,7 +619,7 @@ def refine(video, episode_refiners=None, movie_refiners=None, **kwargs):
|
||||||
|
|
||||||
|
|
||||||
def list_subtitles(videos, languages, pool_class=ProviderPool, **kwargs):
|
def list_subtitles(videos, languages, pool_class=ProviderPool, **kwargs):
|
||||||
"""List subtitles.
|
r"""List subtitles.
|
||||||
|
|
||||||
The `videos` must pass the `languages` check of :func:`check_video`.
|
The `videos` must pass the `languages` check of :func:`check_video`.
|
||||||
|
|
||||||
|
@ -660,7 +660,7 @@ def list_subtitles(videos, languages, pool_class=ProviderPool, **kwargs):
|
||||||
|
|
||||||
|
|
||||||
def download_subtitles(subtitles, pool_class=ProviderPool, **kwargs):
|
def download_subtitles(subtitles, pool_class=ProviderPool, **kwargs):
|
||||||
"""Download :attr:`~subliminal.subtitle.Subtitle.content` of `subtitles`.
|
r"""Download :attr:`~subliminal.subtitle.Subtitle.content` of `subtitles`.
|
||||||
|
|
||||||
:param subtitles: subtitles to download.
|
:param subtitles: subtitles to download.
|
||||||
:type subtitles: list of :class:`~subliminal.subtitle.Subtitle`
|
:type subtitles: list of :class:`~subliminal.subtitle.Subtitle`
|
||||||
|
@ -677,7 +677,7 @@ def download_subtitles(subtitles, pool_class=ProviderPool, **kwargs):
|
||||||
|
|
||||||
def download_best_subtitles(videos, languages, min_score=0, hearing_impaired=False, only_one=False, compute_score=None,
|
def download_best_subtitles(videos, languages, min_score=0, hearing_impaired=False, only_one=False, compute_score=None,
|
||||||
pool_class=ProviderPool, **kwargs):
|
pool_class=ProviderPool, **kwargs):
|
||||||
"""List and download the best matching subtitles.
|
r"""List and download the best matching subtitles.
|
||||||
|
|
||||||
The `videos` must pass the `languages` and `undefined` (`only_one`) checks of :func:`check_video`.
|
The `videos` must pass the `languages` and `undefined` (`only_one`) checks of :func:`check_video`.
|
||||||
|
|
||||||
|
|
|
@ -324,7 +324,7 @@ class LegendasdivxProvider(Provider):
|
||||||
# for series, if no results found, try again just with series and season (subtitle packs)
|
# for series, if no results found, try again just with series and season (subtitle packs)
|
||||||
if isinstance(video, Episode):
|
if isinstance(video, Episode):
|
||||||
logger.debug("Legendasdivx.pt :: trying again with just series and season on query.")
|
logger.debug("Legendasdivx.pt :: trying again with just series and season on query.")
|
||||||
querytext = re.sub("(e|E)(\d{2})", "", querytext)
|
querytext = re.sub(r"(e|E)(\d{2})", "", querytext)
|
||||||
# sleep for a 1 second before another request
|
# sleep for a 1 second before another request
|
||||||
sleep(1)
|
sleep(1)
|
||||||
res = self.session.get(_searchurl.format(query=querytext), allow_redirects=False)
|
res = self.session.get(_searchurl.format(query=querytext), allow_redirects=False)
|
||||||
|
|
|
@ -64,7 +64,7 @@ class NewEndpoint(Exception):
|
||||||
|
|
||||||
# utils
|
# utils
|
||||||
def soup_for(url, data=None, session=None, user_agent=DEFAULT_USER_AGENT):
|
def soup_for(url, data=None, session=None, user_agent=DEFAULT_USER_AGENT):
|
||||||
url = re.sub("\s", "+", url)
|
url = re.sub(r"\s", "+", url)
|
||||||
if not session:
|
if not session:
|
||||||
r = Request(url, data=None, headers=dict(HEADERS, **{"User-Agent": user_agent}))
|
r = Request(url, data=None, headers=dict(HEADERS, **{"User-Agent": user_agent}))
|
||||||
html = urlopen(r).read().decode("utf-8")
|
html = urlopen(r).read().decode("utf-8")
|
||||||
|
|
Loading…
Reference in New Issue