]> git.phdru.name Git - xsetbg.git/blob - dump_db.py
Fix(py3): Fix encodings
[xsetbg.git] / dump_db.py
1 #! /usr/bin/env python3
2 """Dump the DB sorted by date
3
4 This file is a part of XSetBg.
5
6 """
7
8 import sys
9 from xsetbg_conf import xsetbg_conf
10 from xsetbg_db import xsetbg_db
11
12 if not xsetbg_db:
13     sys.exit("Error: no database found")
14
15 fs_encoding = xsetbg_conf.get("images", "fs_encoding")
16 for row in xsetbg_db.select(orderBy='-last_shown'):
17     sys.stdout.buffer.write(
18         ('%d %s %s\n' % (row.id, row.last_shown, row.full_name
19                          )).encode(fs_encoding)
20     )