]> git.phdru.name Git - xsetbg.git/commitdiff
Remove old filenames at the start.
authorOleg Broytman <phd@phdru.name>
Sun, 5 Mar 2006 20:30:45 +0000 (20:30 +0000)
committerOleg Broytman <phd@phdru.name>
Sun, 5 Mar 2006 20:30:45 +0000 (20:30 +0000)
git-svn-id: file:///home/phd/archive/SVN/xsetbg/trunk@8 143022c7-580b-0410-bae3-87f2bf5d3141

xsetbg.py

index 93791a4ef38830d5e0e4dacc1be9b0c49cc057b6..865a5eea9f925fb6ec2a8ce27b02665571772684 100755 (executable)
--- a/xsetbg.py
+++ b/xsetbg.py
@@ -123,7 +123,18 @@ except anydbm.error, msg:
       os.remove(global_db_name)
       global_db = shelve.open(global_db_name, flag='c')
 
-global_db.close() # Close DB in parent process
+# Remove old filenames
+old_time = time() - min_delay
+
+to_delete = []
+for key in global_db.keys():
+   if key.startswith('/') and global_db[key] < old_time:
+      to_delete.append(key)
+
+for key in to_delete:
+   del global_db[key]
+
+global_db.close() # Close DB in the parent process
 
 
 # DB keys