mirror of
https://github.com/beetbox/beets.git
synced 2026-01-30 12:02:41 +01:00
Merge pull request #333 from xhochy/feature/trackcount
Expose number of item via the web API
This commit is contained in:
commit
7053694893
1 changed files with 6 additions and 0 deletions
|
|
@ -73,6 +73,12 @@ def all_items():
|
|||
all_ids = [row[0] for row in rows]
|
||||
return flask.jsonify(item_ids=all_ids)
|
||||
|
||||
@app.route('/item/count')
|
||||
def iten_count():
|
||||
with g.lib.transaction() as tx:
|
||||
rows = tx.query("SELECT COUNT(*) FROM items")
|
||||
return flask.jsonify({'itemcount': rows[0][0]})
|
||||
|
||||
@app.route('/item/<int:item_id>/file')
|
||||
def item_file(item_id):
|
||||
item = g.lib.get_item(item_id)
|
||||
|
|
|
|||
Loading…
Reference in a new issue