def all_schedules(cls): """ create all xls files and join as one """ def is_dir(di): return os.path.isdir(os.path.join(cls.root_dir,di)) folders = [x for x in os.listdir(cls.root_dir) if is_dir(x)] schedules = [] for f in folders: fi = cls(f) schedules.append(fi.produce_schedule()) ql = QuickList().union(schedules) ql.save("F:\\mp4s\joined.xls")
def produce_schedule(self): """ moves files and creates a schedule """ destination_path = "F:\\mp4s" ql = QuickList() ql.header = ["title", "year", "nice_title", "film_ident", "timestamp", "original_name", "file_name", "delete", "trim"] for x,c in enumerate(self.clips()): print c old_name = c seconds = float(c.replace(".mp4","").replace("clip_","")) m, s = divmod(seconds, 60) h, m = divmod(m, 60) timestamp = "%d:%02d:%02d" % (h, m, s) file_name = self.ident + "_{0}.mp4".format(x) shutil.copyfile(os.path.join(self.clip_dir,old_name), os.path.join(destination_path,file_name)) row = [self.title, self.date, self.nice_name, self.ident, timestamp, old_name, file_name, "", "", ] ql.add(row) ql.save(os.path.join(self.dir,"schedule.xls")) return ql