|
|
@ -3,7 +3,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
import logging
|
|
|
|
import logging
|
|
|
|
|
|
|
|
|
|
|
|
from app.config import settings
|
|
|
|
from app.config import settings, sync_checker as _defaul_sync_checker
|
|
|
|
from utilities.path_mappings import path_mappings
|
|
|
|
from utilities.path_mappings import path_mappings
|
|
|
|
from utilities.post_processing import pp_replace, set_chmod
|
|
|
|
from utilities.post_processing import pp_replace, set_chmod
|
|
|
|
from languages.get_languages import alpha2_from_alpha3, alpha2_from_language, alpha3_from_language, language_from_alpha3
|
|
|
|
from languages.get_languages import alpha2_from_alpha3, alpha2_from_language, alpha3_from_language, language_from_alpha3
|
|
|
@ -69,6 +69,9 @@ def process_subtitle(subtitle, media_type, audio_language, path, max_score, is_u
|
|
|
|
message = (f"{downloaded_language}{modifier_string} subtitles {action} from {downloaded_provider} with a score of "
|
|
|
|
message = (f"{downloaded_language}{modifier_string} subtitles {action} from {downloaded_provider} with a score of "
|
|
|
|
f"{percent_score}%.")
|
|
|
|
f"{percent_score}%.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sync_checker = _defaul_sync_checker
|
|
|
|
|
|
|
|
logging.debug("Sync checker: %s", sync_checker)
|
|
|
|
|
|
|
|
|
|
|
|
if media_type == 'series':
|
|
|
|
if media_type == 'series':
|
|
|
|
episode_metadata = database.execute(
|
|
|
|
episode_metadata = database.execute(
|
|
|
|
select(TableEpisodes.sonarrSeriesId, TableEpisodes.sonarrEpisodeId)
|
|
|
|
select(TableEpisodes.sonarrSeriesId, TableEpisodes.sonarrEpisodeId)
|
|
|
@ -79,13 +82,14 @@ def process_subtitle(subtitle, media_type, audio_language, path, max_score, is_u
|
|
|
|
series_id = episode_metadata.sonarrSeriesId
|
|
|
|
series_id = episode_metadata.sonarrSeriesId
|
|
|
|
episode_id = episode_metadata.sonarrEpisodeId
|
|
|
|
episode_id = episode_metadata.sonarrEpisodeId
|
|
|
|
|
|
|
|
|
|
|
|
from .sync import sync_subtitles
|
|
|
|
if sync_checker(subtitle) is True:
|
|
|
|
sync_subtitles(video_path=path, srt_path=downloaded_path,
|
|
|
|
from .sync import sync_subtitles
|
|
|
|
forced=subtitle.language.forced,
|
|
|
|
sync_subtitles(video_path=path, srt_path=downloaded_path,
|
|
|
|
srt_lang=downloaded_language_code2, media_type=media_type,
|
|
|
|
forced=subtitle.language.forced,
|
|
|
|
percent_score=percent_score,
|
|
|
|
srt_lang=downloaded_language_code2, media_type=media_type,
|
|
|
|
sonarr_series_id=episode_metadata.sonarrSeriesId,
|
|
|
|
percent_score=percent_score,
|
|
|
|
sonarr_episode_id=episode_metadata.sonarrEpisodeId)
|
|
|
|
sonarr_series_id=episode_metadata.sonarrSeriesId,
|
|
|
|
|
|
|
|
sonarr_episode_id=episode_metadata.sonarrEpisodeId)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
movie_metadata = database.execute(
|
|
|
|
movie_metadata = database.execute(
|
|
|
|
select(TableMovies.radarrId)
|
|
|
|
select(TableMovies.radarrId)
|
|
|
@ -96,12 +100,13 @@ def process_subtitle(subtitle, media_type, audio_language, path, max_score, is_u
|
|
|
|
series_id = ""
|
|
|
|
series_id = ""
|
|
|
|
episode_id = movie_metadata.radarrId
|
|
|
|
episode_id = movie_metadata.radarrId
|
|
|
|
|
|
|
|
|
|
|
|
from .sync import sync_subtitles
|
|
|
|
if sync_checker(subtitle) is True:
|
|
|
|
sync_subtitles(video_path=path, srt_path=downloaded_path,
|
|
|
|
from .sync import sync_subtitles
|
|
|
|
forced=subtitle.language.forced,
|
|
|
|
sync_subtitles(video_path=path, srt_path=downloaded_path,
|
|
|
|
srt_lang=downloaded_language_code2, media_type=media_type,
|
|
|
|
forced=subtitle.language.forced,
|
|
|
|
percent_score=percent_score,
|
|
|
|
srt_lang=downloaded_language_code2, media_type=media_type,
|
|
|
|
radarr_id=movie_metadata.radarrId)
|
|
|
|
percent_score=percent_score,
|
|
|
|
|
|
|
|
radarr_id=movie_metadata.radarrId)
|
|
|
|
|
|
|
|
|
|
|
|
if use_postprocessing is True:
|
|
|
|
if use_postprocessing is True:
|
|
|
|
command = pp_replace(postprocessing_cmd, path, downloaded_path, downloaded_language, downloaded_language_code2,
|
|
|
|
command = pp_replace(postprocessing_cmd, path, downloaded_path, downloaded_language, downloaded_language_code2,
|
|
|
|