|
|
|
@ -2,6 +2,7 @@
|
|
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
import sys
|
|
|
|
|
import gc
|
|
|
|
|
|
|
|
|
|
from flask import request
|
|
|
|
|
from flask_restful import Resource
|
|
|
|
@ -9,7 +10,7 @@ from flask_restful import Resource
|
|
|
|
|
from database import TableEpisodes, TableMovies
|
|
|
|
|
from helper import path_mappings
|
|
|
|
|
from ..utils import authenticate
|
|
|
|
|
from subsyncer import subsync
|
|
|
|
|
from subsyncer import SubSyncer
|
|
|
|
|
from utils import translate_subtitles_file, subtitles_apply_mods
|
|
|
|
|
from list_subtitles import store_subtitles, store_subtitles_movie
|
|
|
|
|
from config import settings
|
|
|
|
@ -46,6 +47,7 @@ class Subtitles(Resource):
|
|
|
|
|
video_path = path_mappings.path_replace_movie(metadata['path'])
|
|
|
|
|
|
|
|
|
|
if action == 'sync':
|
|
|
|
|
subsync = SubSyncer()
|
|
|
|
|
if media_type == 'episode':
|
|
|
|
|
subsync.sync(video_path=video_path, srt_path=subtitles_path,
|
|
|
|
|
srt_lang=language, media_type='series', sonarr_series_id=metadata['sonarrSeriesId'],
|
|
|
|
@ -53,6 +55,8 @@ class Subtitles(Resource):
|
|
|
|
|
else:
|
|
|
|
|
subsync.sync(video_path=video_path, srt_path=subtitles_path,
|
|
|
|
|
srt_lang=language, media_type='movies', radarr_id=id)
|
|
|
|
|
del subsync
|
|
|
|
|
gc.collect()
|
|
|
|
|
elif action == 'translate':
|
|
|
|
|
dest_language = language
|
|
|
|
|
forced = True if request.form.get('forced') == 'true' else False
|
|
|
|
|