def grabNewImages( self ): """ Recurses thru directories and looks for images to upload. I only want to upload my '5-star' images, so we scan the IPTC tags for 'r5', my way of tagging my pics I really like (usually get prints of r5s) """ images = [] for dirpath, dirnames, filenames in os.walk(IMAGE_DIR): for f in filenames : # Grab IPTC keywords info = IPTCInfo(os.path.join(dirpath, f)) # Is it a 5-star photo? if 'r5' in info.keywords: print 'File to upload:',os.path.join(dirpath, f) ext = f.lower().split('.')[-1] if ( ext == 'jpg' or ext == 'gif' or ext == 'png' ): images.append( os.path.normpath( dirpath + '/' + f ) ) images.sort() return images