From 6393827e62665b2b4111b9b7ee268ecd46d5dba8 Mon Sep 17 00:00:00 2001 From: endorphant Date: Sun, 14 Oct 2018 16:22:55 -0400 Subject: [PATCH] adding three day lock release; closes #4 --- ttbp/ttbp.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ttbp/ttbp.py b/ttbp/ttbp.py index 1cdd0d1..8eafeb0 100644 --- a/ttbp/ttbp.py +++ b/ttbp/ttbp.py @@ -1493,10 +1493,12 @@ def save_subs(subs): def graffiti_handler(): ''' - Main graffiti handler. + Main graffiti handler; checks for lockfile from another editing sesison + (overwriting by default if the lock is more than three days old. ''' - if os.path.isfile(config.WALL_LOCK): + if os.path.isfile(config.WALL_LOCK) and \ + time.time() - os.path.getmtime(config.WALL_LOCK) < 60*60*24*3: redraw("sorry, {friend}, but someone's there right now. try again in a few!".format(friend=chatter.say("friend"))) else: subprocess.call(["touch", config.WALL_LOCK])