-for key, value in sorted(xsetbg_db.items(), key=itemgetter(1), reverse=1):
- if key.startswith('/'):
- print value, key
-xsetbg_db.close()
+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'):
+ sys.stdout.buffer.write(
+ ('%d %s %s\n' % (row.id, row.last_shown, row.full_name
+ )).encode(fs_encoding)
+ )