pull/884/head
Louis Vézina 5 years ago
parent ad601c60a1
commit 8b52c4d6ae

@ -47,7 +47,25 @@ class Series(Resource):
return jsonify(result) return jsonify(result)
class Episodes(Resource):
def get(self):
seriesId = request.args.get('id')
if seriesId:
result = database.execute("SELECT * FROM table_episodes WHERE sonarrSeriesId=?", (seriesId,))
else:
result = database.execute("SELECT * FROM table_episodes")
for item in result:
# Provide mapped path
mapped_path = path_replace(item['path'])
item.update({"mapped_path": mapped_path})
# Confirm if path exist
item.update({"exist": os.path.isfile(mapped_path)})
return jsonify(result)
api.add_resource(Series, '/api/series') api.add_resource(Series, '/api/series')
api.add_resource(Episodes, '/api/episodes')
if __name__ == '__main__': if __name__ == '__main__':
app.run(debug=True) app.run(debug=True)

Loading…
Cancel
Save