From a8118f4e2275df69f20a3c2be401ca91723dde2f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20V=C3=A9zina?=
<5130500+morpheus65535@users.noreply.github.com>
Date: Thu, 2 Jan 2020 09:41:30 -0500
Subject: [PATCH] WIP
---
bazarr/api.py | 8 +++++++-
views/episodes.html | 17 +++++++++++++----
2 files changed, 20 insertions(+), 5 deletions(-)
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"}
]