|
|
@ -38,7 +38,7 @@ class EpisodesSubtitles(Resource):
|
|
|
|
@api_ns_episodes_subtitles.response(401, 'Not Authenticated')
|
|
|
|
@api_ns_episodes_subtitles.response(401, 'Not Authenticated')
|
|
|
|
@api_ns_episodes_subtitles.response(404, 'Episode not found')
|
|
|
|
@api_ns_episodes_subtitles.response(404, 'Episode not found')
|
|
|
|
@api_ns_episodes_subtitles.response(409, 'Unable to save subtitles file. Permission or path mapping issue?')
|
|
|
|
@api_ns_episodes_subtitles.response(409, 'Unable to save subtitles file. Permission or path mapping issue?')
|
|
|
|
@api_ns_episodes_subtitles.response(410, 'Episode file not found. Path mapping issue?')
|
|
|
|
@api_ns_episodes_subtitles.response(500, 'Episode file not found. Path mapping issue?')
|
|
|
|
def patch(self):
|
|
|
|
def patch(self):
|
|
|
|
"""Download an episode subtitles"""
|
|
|
|
"""Download an episode subtitles"""
|
|
|
|
args = self.patch_request_parser.parse_args()
|
|
|
|
args = self.patch_request_parser.parse_args()
|
|
|
@ -60,7 +60,7 @@ class EpisodesSubtitles(Resource):
|
|
|
|
episodePath = path_mappings.path_replace(episodeInfo.path)
|
|
|
|
episodePath = path_mappings.path_replace(episodeInfo.path)
|
|
|
|
|
|
|
|
|
|
|
|
if not os.path.exists(episodePath):
|
|
|
|
if not os.path.exists(episodePath):
|
|
|
|
return 'Episode file not found. Path mapping issue?', 410
|
|
|
|
return 'Episode file not found. Path mapping issue?', 500
|
|
|
|
|
|
|
|
|
|
|
|
sceneName = episodeInfo.sceneName or "None"
|
|
|
|
sceneName = episodeInfo.sceneName or "None"
|
|
|
|
|
|
|
|
|
|
|
@ -106,7 +106,7 @@ class EpisodesSubtitles(Resource):
|
|
|
|
@api_ns_episodes_subtitles.response(401, 'Not Authenticated')
|
|
|
|
@api_ns_episodes_subtitles.response(401, 'Not Authenticated')
|
|
|
|
@api_ns_episodes_subtitles.response(404, 'Episode not found')
|
|
|
|
@api_ns_episodes_subtitles.response(404, 'Episode not found')
|
|
|
|
@api_ns_episodes_subtitles.response(409, 'Unable to save subtitles file. Permission or path mapping issue?')
|
|
|
|
@api_ns_episodes_subtitles.response(409, 'Unable to save subtitles file. Permission or path mapping issue?')
|
|
|
|
@api_ns_episodes_subtitles.response(410, 'Episode file not found. Path mapping issue?')
|
|
|
|
@api_ns_episodes_subtitles.response(500, 'Episode file not found. Path mapping issue?')
|
|
|
|
def post(self):
|
|
|
|
def post(self):
|
|
|
|
"""Upload an episode subtitles"""
|
|
|
|
"""Upload an episode subtitles"""
|
|
|
|
args = self.post_request_parser.parse_args()
|
|
|
|
args = self.post_request_parser.parse_args()
|
|
|
@ -124,7 +124,7 @@ class EpisodesSubtitles(Resource):
|
|
|
|
episodePath = path_mappings.path_replace(episodeInfo.path)
|
|
|
|
episodePath = path_mappings.path_replace(episodeInfo.path)
|
|
|
|
|
|
|
|
|
|
|
|
if not os.path.exists(episodePath):
|
|
|
|
if not os.path.exists(episodePath):
|
|
|
|
return 'Episode file not found. Path mapping issue?', 410
|
|
|
|
return 'Episode file not found. Path mapping issue?', 500
|
|
|
|
|
|
|
|
|
|
|
|
audio_language = get_audio_profile_languages(episodeInfo.audio_language)
|
|
|
|
audio_language = get_audio_profile_languages(episodeInfo.audio_language)
|
|
|
|
if len(audio_language) and isinstance(audio_language[0], dict):
|
|
|
|
if len(audio_language) and isinstance(audio_language[0], dict):
|
|
|
@ -178,7 +178,7 @@ class EpisodesSubtitles(Resource):
|
|
|
|
@api_ns_episodes_subtitles.response(204, 'Success')
|
|
|
|
@api_ns_episodes_subtitles.response(204, 'Success')
|
|
|
|
@api_ns_episodes_subtitles.response(401, 'Not Authenticated')
|
|
|
|
@api_ns_episodes_subtitles.response(401, 'Not Authenticated')
|
|
|
|
@api_ns_episodes_subtitles.response(404, 'Episode not found')
|
|
|
|
@api_ns_episodes_subtitles.response(404, 'Episode not found')
|
|
|
|
@api_ns_episodes_subtitles.response(410, 'Subtitles file not found or permission issue.')
|
|
|
|
@api_ns_episodes_subtitles.response(500, 'Subtitles file not found or permission issue.')
|
|
|
|
def delete(self):
|
|
|
|
def delete(self):
|
|
|
|
"""Delete an episode subtitles"""
|
|
|
|
"""Delete an episode subtitles"""
|
|
|
|
args = self.delete_request_parser.parse_args()
|
|
|
|
args = self.delete_request_parser.parse_args()
|
|
|
@ -211,4 +211,4 @@ class EpisodesSubtitles(Resource):
|
|
|
|
sonarr_episode_id=sonarrEpisodeId):
|
|
|
|
sonarr_episode_id=sonarrEpisodeId):
|
|
|
|
return '', 204
|
|
|
|
return '', 204
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return 'Subtitles file not found or permission issue.', 410
|
|
|
|
return 'Subtitles file not found or permission issue.', 500
|
|
|
|