Fixed subtitles synchronization process when settings values have changed since Bazarr started

pull/2418/head v1.4.3-beta.5
JayZed 10 months ago committed by GitHub
parent af370372de
commit 5d87b10475
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -264,7 +264,10 @@ def list_missing_subtitles_movies(no=None, send_event=True):
event_stream(type='badges') event_stream(type='badges')
def movies_full_scan_subtitles(use_cache=settings.radarr.use_ffprobe_cache): def movies_full_scan_subtitles(use_cache=None):
if use_cache is None:
use_cache = settings.radarr.use_ffprobe_cache
movies = database.execute( movies = database.execute(
select(TableMovies.path))\ select(TableMovies.path))\
.all() .all()

@ -266,7 +266,10 @@ def list_missing_subtitles(no=None, epno=None, send_event=True):
event_stream(type='badges') event_stream(type='badges')
def series_full_scan_subtitles(use_cache=settings.sonarr.use_ffprobe_cache): def series_full_scan_subtitles(use_cache=None):
if use_cache is None:
use_cache = settings.sonarr.use_ffprobe_cache
episodes = database.execute( episodes = database.execute(
select(TableEpisodes.path))\ select(TableEpisodes.path))\
.all() .all()

@ -26,8 +26,19 @@ def sync_subtitles(video_path, srt_path, srt_lang, forced, percent_score, sonarr
if not use_subsync_threshold or (use_subsync_threshold and percent_score < float(subsync_threshold)): if not use_subsync_threshold or (use_subsync_threshold and percent_score < float(subsync_threshold)):
subsync = SubSyncer() subsync = SubSyncer()
subsync.sync(video_path=video_path, srt_path=srt_path, srt_lang=srt_lang, sync_kwargs = {
sonarr_series_id=sonarr_series_id, sonarr_episode_id=sonarr_episode_id, radarr_id=radarr_id) 'video_path': video_path,
'srt_path': srt_path,
'srt_lang': srt_lang,
'max_offset_seconds': str(settings.subsync.max_offset_seconds),
'no_fix_framerate': settings.subsync.no_fix_framerate,
'gss': settings.subsync.gss,
'reference': None, # means choose automatically within video file
'sonarr_series_id': sonarr_series_id,
'sonarr_episode_id': sonarr_episode_id,
'radarr_id': radarr_id,
}
subsync.sync(**sync_kwargs)
del subsync del subsync
gc.collect() gc.collect()
return True return True

@ -30,9 +30,9 @@ class SubSyncer:
self.vad = 'subs_then_webrtc' self.vad = 'subs_then_webrtc'
self.log_dir_path = os.path.join(args.config_dir, 'log') self.log_dir_path = os.path.join(args.config_dir, 'log')
def sync(self, video_path, srt_path, srt_lang, sonarr_series_id=None, sonarr_episode_id=None, radarr_id=None, def sync(self, video_path, srt_path, srt_lang,
reference=None, max_offset_seconds=str(settings.subsync.max_offset_seconds), max_offset_seconds, no_fix_framerate, gss, reference=None,
no_fix_framerate=settings.subsync.no_fix_framerate, gss=settings.subsync.gss): sonarr_series_id=None, sonarr_episode_id=None, radarr_id=None):
self.reference = video_path self.reference = video_path
self.srtin = srt_path self.srtin = srt_path
if self.srtin.casefold().endswith('.ass'): if self.srtin.casefold().endswith('.ass'):

Loading…
Cancel
Save