pull/884/head
Louis Vézina 5 years ago
parent f1d83ab8d5
commit a8118f4e22

@ -89,7 +89,13 @@ class Series(Resource):
class Episodes(Resource): class Episodes(Resource):
def get(self): 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') 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: if seriesId:
result = database.execute("SELECT * FROM table_episodes WHERE sonarrSeriesId=?", (seriesId,)) result = database.execute("SELECT * FROM table_episodes WHERE sonarrSeriesId=?", (seriesId,))
else: else:
@ -117,7 +123,7 @@ class Episodes(Resource):
# Confirm if path exist # Confirm if path exist
item.update({"exist": os.path.isfile(mapped_path)}) 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): class Movies(Resource):

@ -130,13 +130,22 @@
"ordering": false, "ordering": false,
"lengthChange": false, "lengthChange": false,
"responsive": true, "responsive": true,
"ajax": "{{ url_for('api.episodes') }}?id=160", "pageLength": 250,
"ajax": "{{ url_for('api.episodes') }}?id={{id}}",
"columns": [ "columns": [
{"data": "monitored"}, {"data": "monitored",
"render": function (data, type, row) {
if (data === 'False') {
return '<i class="far fa-bookmark" data-toggle="tooltip" data-placement="right" title="Episode unmonitored in Sonarr"></i>';
} else if (data === 'True') {
return '<i class="fas fa-bookmark" data-toggle="tooltip" data-placement="right" title="Episode monitored in Sonarr"></i>';
}
}
},
{"data": "episode"}, {"data": "episode"},
{"data": "title"}, {"data": "title"},
{"data": "subtitles"}, {"data": "subtitles[, ]"},
{"data": "missing_subtitles"}, {"data": "missing_subtitles[, ]"},
{"data": "title"}, {"data": "title"},
{"data": "title"} {"data": "title"}
] ]

Loading…
Cancel
Save