Permalink
Browse files

Add photos/minute statistic (including errors)

As requested by jmathai on IRC.
  • Loading branch information...
samatjain committed Feb 3, 2012
1 parent d6f0491 commit fb068b81957e60b92b550244079db2f182f67904
Showing with 8 additions and 0 deletions.
  1. +8 −0 import.py
View
8 import.py 100644 → 100755
@@ -4,6 +4,8 @@
import json
# shutil for file renaming
import shutil
+import time
+
# import flickrapi
# `easy_install flickrapi` or `pip install flickrapi`
from openphoto import OpenPhoto
@@ -32,6 +34,7 @@ def main():
current = 1
processed = 0
errored = 0
+ start_time = time.time()
print "Found a total of %d files to process" % total
for i in files:
print "Processing %d of %d %s ..." % (current, total, i),
@@ -52,8 +55,13 @@ def main():
errored = errored + 1
shutil.move(infile, "errored/%s" % i)
+ end_time = time.time()
+ total_time = (end_time - start_time) / 60.0
+ photos_minute = int(total / total_time)
+
if total > 0:
print "Results. Processed: %d. Errored: %d." % (processed, errored)
+ print "Imported %d photos at %d photos/minute." % (total, photos_minute)
# create a directory only if it doesn't already exist
def createDirectorySafe( name ):

0 comments on commit fb068b8

Please sign in to comment.