X-Git-Url: https://git.phdru.name/?p=xsetbg.git;a=blobdiff_plain;f=find_oldest.py;h=f98b4e6d6c051756c996019b40514bb0110dc77a;hp=444abe786e30aa2a1a58d62ec10314e580414754;hb=76c9a423c497a1b7c2831087e02e6d8dbda5cb58;hpb=a337e26c169baecb75197b50db5fd734c39f6187 diff --git a/find_oldest.py b/find_oldest.py index 444abe7..f98b4e6 100755 --- a/find_oldest.py +++ b/find_oldest.py @@ -6,26 +6,20 @@ This file is a part of XSetBg. """ __author__ = "Oleg Broytman " -__copyright__ = "Copyright (C) 2006-2012 PhiloSoft Design" +__copyright__ = "Copyright (C) 2006-2014 PhiloSoft Design" __license__ = "GNU GPL" -import os, shelve from time import localtime, asctime - -xsetbg_dir = os.path.join(os.environ["HOME"], "lib", "xsetbg") -os.chdir(xsetbg_dir) - -global_db_name = "xsetbg.db" +from xsetbg_db import xsetbg_db count = 0 oldest = None -global_db = shelve.open(global_db_name, flag='r') -for key in global_db.keys(): +for key in xsetbg_db.keys(): count += 1 - if key.startswith('/') and ((oldest is None) or (global_db[key] < oldest)): - oldest = global_db[key] -global_db.close() + if key.startswith('/') and ((oldest is None) or (xsetbg_db[key] < oldest)): + oldest = xsetbg_db[key] +xsetbg_db.close() print count, "files" print "Oldest:", asctime(localtime(oldest))