Adrian Sampson  committed 022f4c9 Merge

Merge pull request #333 from xhochy/feature/trackcount

Expose number of item via the web API

  • Participants
  • Parent commits 9188fb7, 8a4b850
  • Branches default

Comments (0)

Files changed (1)

File beetsplug/web/

     all_ids = [row[0] for row in rows]
     return flask.jsonify(item_ids=all_ids)
+def iten_count():
+    with g.lib.transaction() as tx:
+        rows = tx.query("SELECT COUNT(*) FROM items")
+    return flask.jsonify({'itemcount': rows[0][0]})
 def item_file(item_id):
     item = g.lib.get_item(item_id)