X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=dump_db.py;h=ca3c6a74be70213190721f1940f564607e9eb79a;hb=a0577ff865f17f5988b5192adae263e0ef32b09a;hp=2bdffedf9972887873326bbf132c573347a40770;hpb=bc04f70d3ae1ef5fc15bdf95db1e61fe54db2b95;p=xsetbg.git diff --git a/dump_db.py b/dump_db.py index 2bdffed..ca3c6a7 100755 --- a/dump_db.py +++ b/dump_db.py @@ -1,20 +1,20 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 """Dump the DB sorted by date This file is a part of XSetBg. """ -__author__ = "Oleg Broytman " -__copyright__ = "Copyright (C) 2006-2015 PhiloSoft Design" -__license__ = "GNU GPL" - import sys -from m_lib.defenc import default_encoding +from xsetbg_conf import xsetbg_conf from xsetbg_db import xsetbg_db if not xsetbg_db: sys.exit("Error: no database found") +fs_encoding = xsetbg_conf.get("images", "fs_encoding") for row in xsetbg_db.select(orderBy='-last_shown'): - print row.id, row.last_shown, row.full_name.encode(default_encoding) + sys.stdout.buffer.write( + ('%d %s %s\n' % (row.id, row.last_shown, row.full_name + )).encode(fs_encoding) + )