Fixed improper http status code returned that prevented proper cache management on browser side.

pull/2213/head
morpheus65535 9 months ago
parent 8895dd68a8
commit 77283e4063

@ -87,7 +87,7 @@ class EpisodesBlacklist(Resource):
@api_ns_episodes_blacklist.response(200, 'Success')
@api_ns_episodes_blacklist.response(401, 'Not Authenticated')
@api_ns_episodes_blacklist.response(404, 'Episode not found')
@api_ns_episodes_blacklist.response(410, 'Subtitles file not found or permission issue.')
@api_ns_episodes_blacklist.response(500, 'Subtitles file not found or permission issue.')
def post(self):
"""Add an episodes subtitles to blacklist"""
args = self.post_request_parser.parse_args()
@ -125,7 +125,7 @@ class EpisodesBlacklist(Resource):
event_stream(type='episode-history')
return '', 200
else:
return 'Subtitles file not found or permission issue.', 410
return 'Subtitles file not found or permission issue.', 500
delete_request_parser = reqparse.RequestParser()
delete_request_parser.add_argument('all', type=str, required=False, help='Empty episodes subtitles blacklist')

@ -38,7 +38,7 @@ class EpisodesSubtitles(Resource):
@api_ns_episodes_subtitles.response(401, 'Not Authenticated')
@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(410, 'Episode file not found. Path mapping issue?')
@api_ns_episodes_subtitles.response(500, 'Episode file not found. Path mapping issue?')
def patch(self):
"""Download an episode subtitles"""
args = self.patch_request_parser.parse_args()
@ -60,7 +60,7 @@ class EpisodesSubtitles(Resource):
episodePath = path_mappings.path_replace(episodeInfo.path)
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"
@ -106,7 +106,7 @@ class EpisodesSubtitles(Resource):
@api_ns_episodes_subtitles.response(401, 'Not Authenticated')
@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(410, 'Episode file not found. Path mapping issue?')
@api_ns_episodes_subtitles.response(500, 'Episode file not found. Path mapping issue?')
def post(self):
"""Upload an episode subtitles"""
args = self.post_request_parser.parse_args()
@ -124,7 +124,7 @@ class EpisodesSubtitles(Resource):
episodePath = path_mappings.path_replace(episodeInfo.path)
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)
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(401, 'Not Authenticated')
@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):
"""Delete an episode subtitles"""
args = self.delete_request_parser.parse_args()
@ -211,4 +211,4 @@ class EpisodesSubtitles(Resource):
sonarr_episode_id=sonarrEpisodeId):
return '', 204
else:
return 'Subtitles file not found or permission issue.', 410
return 'Subtitles file not found or permission issue.', 500

@ -80,7 +80,7 @@ class MoviesBlacklist(Resource):
@api_ns_movies_blacklist.response(200, 'Success')
@api_ns_movies_blacklist.response(401, 'Not Authenticated')
@api_ns_movies_blacklist.response(404, 'Movie not found')
@api_ns_movies_blacklist.response(410, 'Subtitles file not found or permission issue.')
@api_ns_movies_blacklist.response(500, 'Subtitles file not found or permission issue.')
def post(self):
"""Add a movies subtitles to blacklist"""
args = self.post_request_parser.parse_args()
@ -118,7 +118,7 @@ class MoviesBlacklist(Resource):
event_stream(type='movie-history')
return '', 200
else:
return 'Subtitles file not found or permission issue.', 410
return 'Subtitles file not found or permission issue.', 500
delete_request_parser = reqparse.RequestParser()
delete_request_parser.add_argument('all', type=str, required=False, help='Empty movies subtitles blacklist')

@ -165,7 +165,7 @@ class Movies(Resource):
@api_ns_movies.response(204, 'Success')
@api_ns_movies.response(400, 'Unknown action')
@api_ns_movies.response(401, 'Not Authenticated')
@api_ns_movies.response(410, 'Movie file not found. Path mapping issue?')
@api_ns_movies.response(500, 'Movie file not found. Path mapping issue?')
def patch(self):
"""Run actions on specific movies"""
args = self.patch_request_parser.parse_args()
@ -178,7 +178,7 @@ class Movies(Resource):
try:
movies_download_subtitles(radarrid)
except OSError:
return 'Movie file not found. Path mapping issue?', 410
return 'Movie file not found. Path mapping issue?', 500
else:
return '', 204
elif action == "search-wanted":

@ -37,7 +37,7 @@ class MoviesSubtitles(Resource):
@api_ns_movies_subtitles.response(401, 'Not Authenticated')
@api_ns_movies_subtitles.response(404, 'Movie not found')
@api_ns_movies_subtitles.response(409, 'Unable to save subtitles file. Permission or path mapping issue?')
@api_ns_movies_subtitles.response(410, 'Movie file not found. Path mapping issue?')
@api_ns_movies_subtitles.response(500, 'Movie file not found. Path mapping issue?')
def patch(self):
"""Download a movie subtitles"""
args = self.patch_request_parser.parse_args()
@ -58,7 +58,7 @@ class MoviesSubtitles(Resource):
moviePath = path_mappings.path_replace_movie(movieInfo.path)
if not os.path.exists(moviePath):
return 'Movie file not found. Path mapping issue?', 410
return 'Movie file not found. Path mapping issue?', 500
sceneName = movieInfo.sceneName or 'None'
@ -103,7 +103,7 @@ class MoviesSubtitles(Resource):
@api_ns_movies_subtitles.response(401, 'Not Authenticated')
@api_ns_movies_subtitles.response(404, 'Movie not found')
@api_ns_movies_subtitles.response(409, 'Unable to save subtitles file. Permission or path mapping issue?')
@api_ns_movies_subtitles.response(410, 'Movie file not found. Path mapping issue?')
@api_ns_movies_subtitles.response(500, 'Movie file not found. Path mapping issue?')
def post(self):
"""Upload a movie subtitles"""
# TODO: Support Multiply Upload
@ -120,7 +120,7 @@ class MoviesSubtitles(Resource):
moviePath = path_mappings.path_replace_movie(movieInfo.path)
if not os.path.exists(moviePath):
return 'Movie file not found. Path mapping issue?', 410
return 'Movie file not found. Path mapping issue?', 500
audio_language = get_audio_profile_languages(movieInfo.audio_language)
if len(audio_language) and isinstance(audio_language[0], dict):
@ -174,7 +174,7 @@ class MoviesSubtitles(Resource):
@api_ns_movies_subtitles.response(204, 'Success')
@api_ns_movies_subtitles.response(401, 'Not Authenticated')
@api_ns_movies_subtitles.response(404, 'Movie not found')
@api_ns_movies_subtitles.response(410, 'Subtitles file not found or permission issue.')
@api_ns_movies_subtitles.response(500, 'Subtitles file not found or permission issue.')
def delete(self):
"""Delete a movie subtitles"""
args = self.delete_request_parser.parse_args()
@ -205,4 +205,4 @@ class MoviesSubtitles(Resource):
radarr_id=radarrId):
return '', 204
else:
return 'Subtitles file not found or permission issue.', 410
return 'Subtitles file not found or permission issue.', 500

@ -43,7 +43,7 @@ class ProviderEpisodes(Resource):
@authenticate
@api_ns_providers_episodes.response(401, 'Not Authenticated')
@api_ns_providers_episodes.response(404, 'Episode not found')
@api_ns_providers_episodes.response(410, 'Episode file not found. Path mapping issue?')
@api_ns_providers_episodes.response(500, 'Episode file not found. Path mapping issue?')
@api_ns_providers_episodes.doc(parser=get_request_parser)
def get(self):
"""Search manually for an episode subtitles"""
@ -66,7 +66,7 @@ class ProviderEpisodes(Resource):
episodePath = path_mappings.path_replace(episodeInfo.path)
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"
profileId = episodeInfo.profileId

@ -44,7 +44,7 @@ class ProviderMovies(Resource):
@authenticate
@api_ns_providers_movies.response(401, 'Not Authenticated')
@api_ns_providers_movies.response(404, 'Movie not found')
@api_ns_providers_movies.response(410, 'Movie file not found. Path mapping issue?')
@api_ns_providers_movies.response(500, 'Movie file not found. Path mapping issue?')
@api_ns_providers_movies.doc(parser=get_request_parser)
def get(self):
"""Search manually for a movie subtitles"""
@ -65,7 +65,7 @@ class ProviderMovies(Resource):
moviePath = path_mappings.path_replace_movie(movieInfo.path)
if not os.path.exists(moviePath):
return 'Movie file not found. Path mapping issue?', 410
return 'Movie file not found. Path mapping issue?', 500
sceneName = movieInfo.sceneName or "None"
profileId = movieInfo.profileId

@ -198,7 +198,7 @@ class Series(Resource):
@api_ns_series.response(204, 'Success')
@api_ns_series.response(400, 'Unknown action')
@api_ns_series.response(401, 'Not Authenticated')
@api_ns_series.response(410, 'Series directory not found. Path mapping issue?')
@api_ns_series.response(500, 'Series directory not found. Path mapping issue?')
def patch(self):
"""Run actions on specific series"""
args = self.patch_request_parser.parse_args()
@ -211,7 +211,7 @@ class Series(Resource):
try:
series_download_subtitles(seriesid)
except OSError:
return 'Series directory not found. Path mapping issue?', 410
return 'Series directory not found. Path mapping issue?', 500
else:
return '', 204
elif action == "search-wanted":

@ -43,7 +43,7 @@ class Subtitles(Resource):
@api_ns_subtitles.response(401, 'Not Authenticated')
@api_ns_subtitles.response(404, 'Episode/movie not found')
@api_ns_subtitles.response(409, 'Unable to edit subtitles file. Check logs.')
@api_ns_subtitles.response(410, 'Subtitles file not found. Path mapping issue?')
@api_ns_subtitles.response(500, 'Subtitles file not found. Path mapping issue?')
def patch(self):
"""Apply mods/tools on external subtitles"""
args = self.patch_request_parser.parse_args()
@ -55,7 +55,7 @@ class Subtitles(Resource):
id = args.get('id')
if not os.path.exists(subtitles_path):
return 'Subtitles file not found. Path mapping issue?', 410
return 'Subtitles file not found. Path mapping issue?', 500
if media_type == 'episode':
metadata = database.execute(

Loading…
Cancel
Save