X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=find_oldest.py;h=f98b4e6d6c051756c996019b40514bb0110dc77a;hb=d8a985cb7c3aa4e0e3592ef9ef2ce62a2ca50695;hp=df79432bcf0bc34e1d88fe28335631659724bccd;hpb=c4015ab84f9ceae1eb814fd3ea4cda580af48771;p=xsetbg.git diff --git a/find_oldest.py b/find_oldest.py index df79432..f98b4e6 100755 --- a/find_oldest.py +++ b/find_oldest.py @@ -1,35 +1,25 @@ -#! /usr/local/bin/python -O +#! /usr/bin/env python """Count shown files; display the date of oldest file This file is a part of XSetBg. """ -__version__ = "$Revision$"[11:-2] -__revision__ = "$Id$"[5:-2] -__date__ = "$Date$"[7:-2] - -__author__ = "Oleg BroytMann " -__copyright__ = "Copyright (C) 2006 PhiloSoft Design" +__author__ = "Oleg Broytman " +__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))