From c4ed470af597180309e7a54fd39f5645ae334617 Mon Sep 17 00:00:00 2001 From: Balthasar Reuter Date: Mon, 11 May 2015 22:41:06 +0200 Subject: [PATCH] Fixed image count --- photobooth.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/photobooth.py b/photobooth.py index 5bdd031..eafae79 100755 --- a/photobooth.py +++ b/photobooth.py @@ -51,14 +51,15 @@ class Images: self.suffix = ".jpg" self.count_width = 5 # Find existing files - pictures = glob.glob(self.basename + "[0-9]" + self.suffix) + count_pattern = "[0-9]" * self.count_width + pictures = glob.glob(self.basename + count_pattern + self.suffix) if len(pictures) == 0: self.counter = 0 else: pictures.sort() last_picture = pictures[-1] self.counter = int(last_picture[-(self.count_width+len(self.suffix)):-len(self.suffix)]) - print "Number of existing files: " + str(self.counter) + print "Number of last existing file: " + str(self.counter) + "(" + str(len(pictures)) + ")" print "Saving as: " + self.basename def get(self, count): @@ -224,8 +225,8 @@ def main(): ######################## display = GUI_PyGame('Photobooth', display_size) -camera = Camera() images = Images(image_basename) +camera = Camera() if __name__ == "__main__": sys.exit(main()) \ No newline at end of file