File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -73,12 +73,6 @@ def all_items():
73
73
all_ids = [row [0 ] for row in rows ]
74
74
return flask .jsonify (item_ids = all_ids )
75
75
76
- @app .route ('/item/count' )
77
- def iten_count ():
78
- with g .lib .transaction () as tx :
79
- rows = tx .query ("SELECT COUNT(*) FROM items" )
80
- return flask .jsonify ({'itemcount' : rows [0 ][0 ]})
81
-
82
76
@app .route ('/item/<int:item_id>/file' )
83
77
def item_file (item_id ):
84
78
item = g .lib .get_item (item_id )
@@ -130,6 +124,19 @@ def all_artists():
130
124
return flask .jsonify (artist_names = all_artists )
131
125
132
126
127
+ # Library information.
128
+
129
+ @app .route ('/stats' )
130
+ def stats ():
131
+ with g .lib .transaction () as tx :
132
+ item_rows = tx .query ("SELECT COUNT(*) FROM items" )
133
+ album_rows = tx .query ("SELECT COUNT(*) FROM albums" )
134
+ return flask .jsonify ({
135
+ 'items' : item_rows [0 ][0 ],
136
+ 'albums' : album_rows [0 ][0 ],
137
+ })
138
+
139
+
133
140
# UI.
134
141
135
142
@app .route ('/' )
Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ And some little enhancements and bug fixes:
33
33
34
34
* Multi-disc directory names can now contain "disk" (in addition to "disc").
35
35
Thanks to John Hawthorn.
36
+ * :doc: `/plugins/web `: An item count is now exposed through the API for use
37
+ with the Tomahawk resolver. Thanks to Uwe L. Korn.
36
38
* Python 2.6 compatibility for :doc: `/plugins/beatport `,
37
39
:doc: `/plugins/missing `, and `/plugins/duplicates `. Thanks to Wesley
38
40
Bitter and Pedro Silva.
You can’t perform that action at this time.
0 commit comments