Skip to content

Instantly share code, notes, and snippets.

@osa1
Created April 21, 2012 18:51
Show Gist options
  • Save osa1/2439072 to your computer and use it in GitHub Desktop.
Save osa1/2439072 to your computer and use it in GitHub Desktop.
glapse patch to continue recording from last screenshot
--- /home/sinan/Downloads/glapse-0.3/glapseControllers/glapseMain.py 2011-06-24 19:16:45.000000000 +0300
+++ /home/sinan/opt/glapse/glapseControllers/glapseMain.py 2012-04-21 13:57:06.864076116 +0300
@@ -47,7 +47,6 @@
self.outputDir = output
self.quality = quality
self.interval = interval
- self.currentShot = 0
# Start a thread to take screenshots
self.done = False
@@ -76,12 +75,12 @@
def getPossibleOverwrite(self, output):
- regex = re.compile('[0-9]{' + str(self.numDigits) + '}.jpg')
+ regex = re.compile('([0-9]{' + str(self.numDigits) + '}).jpg')
- for f in os.listdir(output):
- match = regex.match(f)
- if match != None:
- return True
+ matches = sorted(map(lambda s: int(regex.match(s).group(1)), os.listdir(output)))
+ if len(matches) != 0:
+ self.currentShot = matches[-1]+1
+ print "currentshot set to", self.currentShot
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment