diff --git a/bazarr/api.py b/bazarr/api.py index 8686c9c8c..fe86280aa 100644 --- a/bazarr/api.py +++ b/bazarr/api.py @@ -89,7 +89,13 @@ class Series(Resource): class Episodes(Resource): def get(self): + start = request.args.get('start') or 0 + length = request.args.get('length') or -1 + draw = request.args.get('draw') + seriesId = request.args.get('id') + row_count = database.execute("SELECT COUNT(*) as count FROM table_episodes WHERE sonarrSeriesId=?", + (seriesId,), only_one=True)['count'] if seriesId: result = database.execute("SELECT * FROM table_episodes WHERE sonarrSeriesId=?", (seriesId,)) else: @@ -117,7 +123,7 @@ class Episodes(Resource): # Confirm if path exist item.update({"exist": os.path.isfile(mapped_path)}) - return jsonify(result) + return jsonify(draw=draw, recordsTotal=row_count, recordsFiltered=row_count, data=result) class Movies(Resource): diff --git a/views/episodes.html b/views/episodes.html index e2b3ff323..59cccddb5 100644 --- a/views/episodes.html +++ b/views/episodes.html @@ -130,13 +130,22 @@ "ordering": false, "lengthChange": false, "responsive": true, - "ajax": "{{ url_for('api.episodes') }}?id=160", + "pageLength": 250, + "ajax": "{{ url_for('api.episodes') }}?id={{id}}", "columns": [ - {"data": "monitored"}, + {"data": "monitored", + "render": function (data, type, row) { + if (data === 'False') { + return ''; + } else if (data === 'True') { + return ''; + } + } + }, {"data": "episode"}, {"data": "title"}, - {"data": "subtitles"}, - {"data": "missing_subtitles"}, + {"data": "subtitles[, ]"}, + {"data": "missing_subtitles[, ]"}, {"data": "title"}, {"data": "title"} ]