diff --git a/bazarr/api.py b/bazarr/api.py index 026130d1e..9c5fccc66 100644 --- a/bazarr/api.py +++ b/bazarr/api.py @@ -535,6 +535,35 @@ class Movies(Resource): return '', 204 +class MoviesEditSave(Resource): + def post(self): + changed_movies = request.json + lang = changed_movies['languages'] + hi = changed_movies['hi'] + forced = changed_movies['forced'] + + if lang == ['None']: + lang = 'None' + + for item in changed_movies['radarrid']: + radarrid = item.lstrip('row_') + try: + if len(lang): + database.execute("UPDATE table_movies SET languages=? WHERE radarrId=?", (str(lang), radarrid)) + if len(hi): + database.execute("UPDATE table_movies SET hearing_impaired=? WHERE radarrId=?", (hi[0], radarrid)) + if len(forced): + database.execute("UPDATE table_movies SET forced=? WHERE radarrId=?", (forced[0], radarrid)) + except: + pass + else: + list_missing_subtitles_movies(no=radarrid) + + event_stream.write(type='movie', action='update', movie=radarrid) + + return '', 204 + + class HistorySeries(Resource): def get(self): start = request.args.get('start') or 0 @@ -793,7 +822,7 @@ api.add_resource(EpisodesSearchMissing, '/episodes_search_missing') api.add_resource(EpisodesHistory, '/episodes_history') api.add_resource(Movies, '/movies') - +api.add_resource(MoviesEditSave, '/movies_edit_save') api.add_resource(HistorySeries, '/history_series') api.add_resource(HistoryMovies, '/history_movies') diff --git a/bazarr/main.py b/bazarr/main.py index d913aa0f9..c08be5178 100644 --- a/bazarr/main.py +++ b/bazarr/main.py @@ -553,8 +553,7 @@ def search_json(query): return dict(items=search_list) -@app.route('/episodes/', methods=['GET']) -@app.route('/episodes/') +@app.route('/episodes/') @login_required def episodes(no): return render_template('episodes.html', id=str(no)) @@ -569,20 +568,7 @@ def movies(): @app.route('/movieseditor') @login_required def movieseditor(): - - - missing_count = database.execute("SELECT COUNT(*) as count FROM table_movies", only_one=True)['count'] - - data = database.execute("SELECT tmdbId, title, path, languages, hearing_impaired, radarrId, poster, " - "audio_language, forced FROM table_movies ORDER BY sortTitle ASC") - # path_replace - dict_mapper.path_replace_movie(data) - - languages = database.execute("SELECT code2, name FROM table_settings_languages WHERE enabled=1") - - return render_template('movieseditor.html', bazarr_version=bazarr_version, rows=data, languages=languages, - missing_count=missing_count, base_url=base_url, single_language= - settings.general.getboolean('single_language'), current_port=settings.general.port) + return render_template('movieseditor.html') @app.route('/edit_movieseditor', methods=['POST']) @@ -615,63 +601,10 @@ def edit_movieseditor(): redirect(ref) -@app.route('/edit_movie/', methods=['POST']) -@login_required -def edit_movie(no): - - ref = request.environ['HTTP_REFERER'] - - lang = request.form.getlist('languages') - if len(lang) > 0: - pass - else: - lang = 'None' - - single_language = settings.general.getboolean('single_language') - if single_language: - if str(lang) == "['None']": - lang = 'None' - else: - lang = str(lang) - else: - if str(lang) == "['']": - lang = '[]' - - hi = request.form.get('hearing_impaired') - forced = request.form.get('forced') - - if hi == "on": - hi = "True" - else: - hi = "False" - - database.execute("UPDATE table_movies SET languages=?, hearing_impaired=?, forced=? WHERE radarrId=?", - (str(lang), hi, forced, no)) - - list_missing_subtitles_movies(no) - - redirect(ref) - - -@app.route('/movie/', methods=['GET']) +@app.route('/movie/') @login_required def movie(no): - - - movies_details = database.execute("SELECT title, overview, poster, fanart, hearing_impaired, tmdbId, " - "audio_language, languages, path, subtitles, radarrId, missing_subtitles, " - "scenename, monitored, failedAttempts, forced FROM table_movies " - "WHERE radarrId=?", (no,), only_one=True) - # path_replace - dict_mapper.path_replace_movie(movies_details) - - tmdbid = movies_details['tmdbId'] - - languages = database.execute("SELECT code2, name FROM table_settings_languages WHERE enabled=1") - - return render_template('movie.html', bazarr_version=bazarr_version, no=no, details=movies_details, - languages=languages, url_radarr_short=url_radarr_short(), base_url=base_url, tmdbid=tmdbid, - current_port=settings.general.port) + return render_template('movie.html', id=str(no)) @app.route('/scan_disk_movie/', methods=['GET']) diff --git a/views/movies.html b/views/movies.html index c128c2d35..1f7c24eec 100644 --- a/views/movies.html +++ b/views/movies.html @@ -3,18 +3,16 @@ {% block title %}Movies - Bazarr{% endblock %} {% block bcleft %} -
-
{% endblock bcleft %} {% block bcright %} -
-
Some page settings
-
+ {% endblock bcright %} {% block body %} @@ -167,9 +165,9 @@ "data": null, "render": function (data) { if (data.sceneName) { - return ' ' + data.title; + return ' ' + '' + data.title + ''; } else { - return data.title; + return '' + data.title + ''; } } }, diff --git a/views/movieseditor.html b/views/movieseditor.html index e32285732..8a7338e16 100644 --- a/views/movieseditor.html +++ b/views/movieseditor.html @@ -1,189 +1,231 @@ - - - - - - - - - - - - - - - - - - Movies Editor - Bazarr - - - - -
-
Loading...
-
- % include('menu.tpl') - -
- - - - - - - - - - - - - %import ast - %import os - %for row in rows: - - - - - - - - - %end - -
-
- - -
-
NameAudio LanguageSubtitles Language(s)Hearing-ImpairedForced
-
- - -
-
{{row['title']}}{{row['audio_language']}} - %subs_languages = ast.literal_eval(str(row['languages'])) - %if subs_languages is not None: - %for subs_language in subs_languages: -
{{subs_language}}
- %end - %end -
{{!"" if row['hearing_impaired'] == None else row['hearing_impaired']}}{{!"" if row['forced'] is None else row['forced']}}
-
- - - % include('footer.tpl') -



- - - - - +{% extends '_main.html' %} + +{% block title %}Series Editor - Bazarr{% endblock %} + +{% block bcleft %} +
+{% endblock bcleft %} + +{% block bcright %} + +{% endblock bcright %} + +{% block body %} + + + + + + + + + + + +
NameAudio LanguageSubtitles LanguagesHearing-ImpairedForced
+ + +{% endblock body %} + +{% block tail %} + +{% endblock tail %} diff --git a/views/series.html b/views/series.html index 87769dc3f..5bc43b58e 100644 --- a/views/series.html +++ b/views/series.html @@ -151,7 +151,7 @@ "columns": [ {"data": null, "render": function (data) { - return '' + data.title + '' + return '' + data.title + ''; } }, { diff --git a/views/serieseditor.html b/views/serieseditor.html index 583e835d0..ab72964d9 100644 --- a/views/serieseditor.html +++ b/views/serieseditor.html @@ -127,7 +127,7 @@ {"defaultContent": ""}, {"data": null, "render": function (data) { - return '' + data.title + '' + return '' + data.title + '' } }, {"data": "audio_language.name"},