X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=dump_db.py;h=ea6b0f16ea8e7254dbc2bca9dc1f9fe3cde4bb5b;hb=5be27ee9d6b805200db0295a9426d22159336cbe;hp=c3daada248e2bbd272a16d6f628df6fda4e08ce2;hpb=a18440e4fb901f7a132e6a10272593cb8a5ee142;p=xsetbg.git diff --git a/dump_db.py b/dump_db.py index c3daada..ea6b0f1 100755 --- a/dump_db.py +++ b/dump_db.py @@ -5,24 +5,12 @@ This file is a part of XSetBg. """ -__version__ = "$Revision: 17 $"[11:-2] -__revision__ = "$Id: print_all.py 17 2007-06-14 10:37:08Z phd $"[5:-2] -__date__ = "$Date: 2007-06-14 14:37:08 +0400 (Thu, 14 Jun 2007) $"[7:-2] +import sys +from m_lib.defenc import default_encoding +from xsetbg_db import xsetbg_db -__author__ = "Oleg Broytman " -__copyright__ = "Copyright (C) 2006, 2007 PhiloSoft Design" -__license__ = "GNU GPL" +if not xsetbg_db: + sys.exit("Error: no database found") -import os, shelve -from operator import itemgetter - -xsetbg_dir = os.path.join(os.environ["HOME"], "lib", "xsetbg") -os.chdir(xsetbg_dir) - -global_db_name = "xsetbg.db" - -global_db = shelve.open(global_db_name, flag='r') -for key, value in sorted(global_db.items(), key=itemgetter(1), reverse=1): - if key.startswith('/'): - print value, key -global_db.close() +for row in xsetbg_db.select(orderBy='-last_shown'): + print row.id, row.last_shown, row.full_name.encode(default_encoding)