X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=print_all.py;h=e03ac4e132e1725c3c4346e7144c7c5f09339824;hb=199f6beec9c9bf6eb08446a4c956ff709aef8fa7;hp=e67c642d0e2ccc247db22524cba568998fa07e6b;hpb=76c9a423c497a1b7c2831087e02e6d8dbda5cb58;p=xsetbg.git diff --git a/print_all.py b/print_all.py index e67c642..e03ac4e 100755 --- a/print_all.py +++ b/print_all.py @@ -6,13 +6,15 @@ This file is a part of XSetBg. """ __author__ = "Oleg Broytman " -__copyright__ = "Copyright (C) 2006-2014 PhiloSoft Design" +__copyright__ = "Copyright (C) 2006-2015 PhiloSoft Design" __license__ = "GNU GPL" -from operator import itemgetter +import sys +from m_lib.defenc import default_encoding from xsetbg_db import xsetbg_db -for key, value in sorted(xsetbg_db.items(), key=itemgetter(1), reverse=1): - if key.startswith('/'): - print key -xsetbg_db.close() +if not xsetbg_db: + sys.exit("Error: no database found") + +for row in xsetbg_db.select('last_shown IS NOT NULL', orderBy='-last_shown'): + print row.full_name.encode(default_encoding)