def hashtagGetGenerator(folder): for dir, filename in FileHelper.read_images_in_dir_recursively(folder): if dir[-1] == '\\': dir = dir[:-1] path, dwt = os.path.split(dir) yield dir, filename, getTagCoordinates(dwt)
def tag_folder(self, folder, output): print folder if folder[-1] == '\\': folder = folder[:-1] self.currentFolder = folder self.uplevelFolder = os.path.split(folder)[-1] try: self.currentTag = getTagCoordinates(self.uplevelFolder, YX=False) except ValueError: pass self.negativePath = os.path.join(output, 'negative') self.goodPath = os.path.join(output, 'good') self.badPath = os.path.join(output, 'bad') self.awfulPath = os.path.join(output, 'awful') self.twitterPath = os.path.join(output, 'twitter') self.facebookPath = os.path.join(output, 'facebook') self.atPath = os.path.join(output, 'at') self.filelist = sorted(FileHelper.read_images_in_dir(folder, includeDir=True)) if not self.show_next(): shutil.rmtree(folder) return True while True: action = self.wait_for_action() if action == 'break': return False elif action == 'next': if not self.show_next(): shutil.rmtree(folder) return True