From 6dbe1433644b1bc35a631e2f3758cfe8ddcc3b0b Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Sun, 21 Apr 2024 21:31:16 -0400 Subject: [PATCH] Added minimal Python 3.12 compatibility. Not yet official support. --- bazarr/app/scheduler.py | 4 ++-- custom_libs/subliminal/core.py | 8 ++++---- custom_libs/subliminal_patch/providers/legendasdivx.py | 2 +- custom_libs/subscene_api/subscene.py | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bazarr/app/scheduler.py b/bazarr/app/scheduler.py index f0e73637f..f63076aa1 100644 --- a/bazarr/app/scheduler.py +++ b/bazarr/app/scheduler.py @@ -321,8 +321,8 @@ class Scheduler: self.aps_scheduler.modify_job(job.id, next_run_time=datetime.now(tz=self.timezone) + timedelta(seconds=randrange( - job.trigger.interval.total_seconds() * 0.75, - job.trigger.interval.total_seconds()))) + int(job.trigger.interval.total_seconds() * 0.75), + int(job.trigger.interval.total_seconds())))) def __no_task(self): for job in self.aps_scheduler.get_jobs(): diff --git a/custom_libs/subliminal/core.py b/custom_libs/subliminal/core.py index cf26f333a..142d50f22 100644 --- a/custom_libs/subliminal/core.py +++ b/custom_libs/subliminal/core.py @@ -591,7 +591,7 @@ def scan_videos(path, age=None, archives=True): def refine(video, episode_refiners=None, movie_refiners=None, **kwargs): - """Refine a video using :ref:`refiners`. + r"""Refine a video using :ref:`refiners`. .. note:: @@ -619,7 +619,7 @@ def refine(video, episode_refiners=None, movie_refiners=None, **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`. @@ -660,7 +660,7 @@ def list_subtitles(videos, languages, 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. :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, 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`. diff --git a/custom_libs/subliminal_patch/providers/legendasdivx.py b/custom_libs/subliminal_patch/providers/legendasdivx.py index 46a52ffd1..612693bb9 100644 --- a/custom_libs/subliminal_patch/providers/legendasdivx.py +++ b/custom_libs/subliminal_patch/providers/legendasdivx.py @@ -324,7 +324,7 @@ class LegendasdivxProvider(Provider): # for series, if no results found, try again just with series and season (subtitle packs) if isinstance(video, Episode): 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(1) res = self.session.get(_searchurl.format(query=querytext), allow_redirects=False) diff --git a/custom_libs/subscene_api/subscene.py b/custom_libs/subscene_api/subscene.py index e91f6fdef..463e4e26d 100644 --- a/custom_libs/subscene_api/subscene.py +++ b/custom_libs/subscene_api/subscene.py @@ -64,7 +64,7 @@ class NewEndpoint(Exception): # utils 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: r = Request(url, data=None, headers=dict(HEADERS, **{"User-Agent": user_agent})) html = urlopen(r).read().decode("utf-8")