grooveondemand/groove/shell/stats.py
2022-11-30 00:09:23 -08:00

17 lines
539 B
Python

from .base import BasePrompt
from sqlalchemy import func
from rich import print
from groove import db
class stats(BasePrompt):
def process(self, cmd, *parts):
sess = self.parent.manager.session
playlists = sess.query(func.count(db.playlist.c.id)).scalar()
entries = sess.query(func.count(db.entry.c.track)).scalar()
tracks = sess.query(func.count(db.track.c.relpath)).scalar()
print(f"Database contains {playlists} playlists with a total of {entries} entries, from {tracks} known tracks.")