mirror of
https://github.com/morpheus65535/bazarr
synced 2024-12-25 09:12:38 +00:00
WIP
This commit is contained in:
parent
ad601c60a1
commit
8b52c4d6ae
1 changed files with 18 additions and 0 deletions
|
@ -47,7 +47,25 @@ class Series(Resource):
|
|||
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(Episodes, '/api/episodes')
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True)
|
||||
|
|
Loading…
Reference in a new issue