denis-stepanov / advent

Vent intrusive TV ads
GNU General Public License v3.0
14 stars 1 forks source link

Support for database summary display #36

Closed denis-stepanov closed 2 years ago

denis-stepanov commented 2 years ago

It would be good to have a command like db-djv-pg dbinfo which would display a database summary: number of tracks, number of fingerprints, date of last update, etc.

denis-stepanov commented 2 years ago

Implemented as follows:

(advent-pyenv) $ db-djv-pg dbinfo -h
usage: db-djv-pg dbinfo [-h] [-c]

optional arguments:
  -h, --help   show this help message and exit
  -c, --check  check database consistency
(advent-pyenv) $ db-djv-pg dbinfo -c
Dejavu database info:
  Fingerprinted / total tracks = 117 / 117
  Peak groups                  = 29482 (avg. ~= 252 per track)
  Fingerprints                 = 760255 (avg. ~= 6498 per track)
  Total fingerprinted time    ~= 489 s (avg. ~= 4.2 s per track)
  Database size               ~= 117 MB (avg. ~= 1.0 MB per track)
  Fingerprinting frequency    ~= 1555 Hz (~= 3.53% of sampling frequency 44100 Hz)
  Hash size                    = 10 B
  Hash collisions             ~= 19.74%
  First update                ~= 2022-10-27 23:19:34
  Last update                 ~= 2022-10-27 23:24:19
  Last vacuum                 ~= 2022-10-27 23:46:24

AdVent database info:
  Countries                    = 1
  TV channels                  = 11 (avg. ~= 11 per country)
  Jingles                      = 117 (avg. ~= 11 per TV channel)
  Pure entry / entry jingles   = 36 / 70
  Pure exit / exit jingles     = 47 / 81
  No action jingles            = 0
  Time coverage from           = 2022-02-05
  Time coverage till           = 2022-10-14

Database health checks:
  D0010: timestamps in future                       : OK
  D0011: created > modified                         : OK
  D0020: same song name, different SHA1             : OK
  D0021: same SHA1, different song name             : OK
  D0030: fingerprinted without fingerprints         : OK
  D0035: fingerprint counts mismatch                : OK
  D0040: fingerprint hashes of variable size        : OK
  D0100: vacuum needed                              : OK
  A0010: non-fingerprinted tracks                   : OK
  A0020: low confidence tracks                      : OK
  A0050: bad track name format                      : OK
  A0051: bad track date format                      : OK
  A0080: bad flags                                  : OK
  --------------------------------------------------+-------
  TOTAL CHECKS                                      : OK
(advent-pyenv) $