mirror of
https://github.com/morpheus65535/bazarr
synced 2025-01-03 13:35:18 +00:00
Fixed subtitles synchronization process when settings values have changed since Bazarr started
This commit is contained in:
parent
af370372de
commit
5d87b10475
4 changed files with 24 additions and 7 deletions
|
@ -264,7 +264,10 @@ def list_missing_subtitles_movies(no=None, send_event=True):
|
|||
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(
|
||||
select(TableMovies.path))\
|
||||
.all()
|
||||
|
|
|
@ -266,7 +266,10 @@ def list_missing_subtitles(no=None, epno=None, send_event=True):
|
|||
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(
|
||||
select(TableEpisodes.path))\
|
||||
.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)):
|
||||
subsync = SubSyncer()
|
||||
subsync.sync(video_path=video_path, srt_path=srt_path, srt_lang=srt_lang,
|
||||
sonarr_series_id=sonarr_series_id, sonarr_episode_id=sonarr_episode_id, radarr_id=radarr_id)
|
||||
sync_kwargs = {
|
||||
'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
|
||||
gc.collect()
|
||||
return True
|
||||
|
|
|
@ -30,9 +30,9 @@ class SubSyncer:
|
|||
self.vad = 'subs_then_webrtc'
|
||||
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,
|
||||
reference=None, max_offset_seconds=str(settings.subsync.max_offset_seconds),
|
||||
no_fix_framerate=settings.subsync.no_fix_framerate, gss=settings.subsync.gss):
|
||||
def sync(self, video_path, srt_path, srt_lang,
|
||||
max_offset_seconds, no_fix_framerate, gss, reference=None,
|
||||
sonarr_series_id=None, sonarr_episode_id=None, radarr_id=None):
|
||||
self.reference = video_path
|
||||
self.srtin = srt_path
|
||||
if self.srtin.casefold().endswith('.ass'):
|
||||
|
|
Loading…
Reference in a new issue