sys.exit("Error: no database found")
for row in xsetbg_db.select(orderBy='-last_shown'):
- print row.id, row.last_shown, row.full_name.encode(default_encoding)
+ print(row.id, row.last_shown, row.full_name.encode(default_encoding))
#! /usr/bin/env python
-"""Print background filename
+"""print(background filename)
-Print the filename of the current or previous background image.
+print(the filename of the current or previous background image.)
This file is a part of XSetBg.
filename = xsetbg_db.select('last_shown IS NOT NULL',
orderBy='-last_shown')[index].full_name
-print filename.encode(output_encoding)
+print(filename.encode(output_encoding))
if not xsetbg_db:
sys.exit("Error: no database found")
-print "Total files:", xsetbg_db.select().count()
-print "Images:", xsetbg_db.select('is_image = 1').count()
-print "Non-images:", xsetbg_db.select('is_image = 0').count()
-print "Unknown:", xsetbg_db.select('is_image IS NULL').count()
-print "Shown files:", xsetbg_db.select('last_shown IS NOT NULL').count()
-print "Not shown files:", xsetbg_db.select('last_shown IS NULL').count()
+print("Total files:", xsetbg_db.select().count())
+print("Images:", xsetbg_db.select('is_image = 1').count())
+print("Non-images:", xsetbg_db.select('is_image = 0').count())
+print("Unknown:", xsetbg_db.select('is_image IS NULL').count())
+print("Shown files:", xsetbg_db.select('last_shown IS NOT NULL').count())
+print("Not shown files:", xsetbg_db.select('last_shown IS NULL').count())
last_shown = xsetbg_db.select('last_shown IS NOT NULL',
orderBy='last_shown')[0].last_shown
-print "Oldest:", asctime(localtime(last_shown))
+print("Oldest:", asctime(localtime(last_shown)))
min_max = xsetbg_db.select().accumulateMany(('MIN', 'id'), ('MAX', 'id'))
-print "Min id:", min_max[0]
-print "Max id:", min_max[1]
+print("Min id:", min_max[0])
+print("Max id:", min_max[1])
dump_file.close()
-print "New images:", count_new
-print "Existing images:", count_old
-print "Updated images:", count_updated
+print("New images:", count_new)
+print("Existing images:", count_old)
+print("Updated images:", count_updated)
txn.query(query)
NULL.close()
-print "New images:", count_new
-print "Existing images:", count_old
-print "Removed images:", count_del
+print("New images:", count_new)
+print("Existing images:", count_old)
+print("Removed images:", count_del)
raise RuntimeError("Cannot find xsetbg.conf; searched %s", config_dirs)
if __name__ == '__main__':
- print "Config dirs:", config_dirs
- print "Config file:", xsetbg_conf_file
+ print("Config dirs:", config_dirs)
+ print("Config file:", xsetbg_conf_file)
xsetbg_db = None
if __name__ == '__main__':
- print "DB dirs:", db_dirs
- print "DB file:", xsetbg_db_path
+ print("DB dirs:", db_dirs)
+ print("DB file:", xsetbg_db_path)