X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=print-stats.py;h=fe7cfa585c2c1287c3ecbee5c1177826c15754a0;hb=080d6169f03836330b355e5304e51122d7956c11;hp=a87ad5cc411cdd24bf2f810b549d877ac893e156;hpb=60d6e12a4e0b7dadb0212fd26c04bfffbba5ad80;p=xsetbg.git diff --git a/print-stats.py b/print-stats.py index a87ad5c..fe7cfa5 100755 --- a/print-stats.py +++ b/print-stats.py @@ -1,14 +1,10 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 """Display stats: shown and non-shown files; oldest and newest and so on This file is a part of XSetBg. """ -__author__ = "Oleg Broytman " -__copyright__ = "Copyright (C) 2006-2015 PhiloSoft Design" -__license__ = "GNU GPL" - import sys from time import localtime, asctime from xsetbg_db import xsetbg_db @@ -16,12 +12,15 @@ from xsetbg_db import xsetbg_db if not xsetbg_db: sys.exit("Error: no database found") -print "Total files:", xsetbg_db.select().count() -print "Shown files:", xsetbg_db.select('last_shown IS NOT NULL').count() -print "Not shown files:", xsetbg_db.select('last_shown IS NULL').count() +print("Total files:", xsetbg_db.select().count()) +print("Images:", xsetbg_db.select('is_image = 1').count()) +print("Non-images:", xsetbg_db.select('is_image = 0').count()) +print("Unknown:", xsetbg_db.select('is_image IS NULL').count()) +print("Shown files:", xsetbg_db.select('last_shown IS NOT NULL').count()) +print("Not shown files:", xsetbg_db.select('last_shown IS NULL').count()) last_shown = xsetbg_db.select('last_shown IS NOT NULL', orderBy='last_shown')[0].last_shown -print "Oldest:", asctime(localtime(last_shown)) +print("Oldest:", asctime(localtime(last_shown))) min_max = xsetbg_db.select().accumulateMany(('MIN', 'id'), ('MAX', 'id')) -print "Min id:", min_max[0] -print "Max id:", min_max[1] +print("Min id:", min_max[0]) +print("Max id:", min_max[1])