def main(args): """ process each argument """ table = Texttable() table.set_cols_align(["r", "r", "r", "r", "r"]) rows = [["Number", "File Name", "File Size", "Video Duration (H:MM:SS)", "Conversion Time"]] total_time = 0.0 total_file_size = 0 for index, arg in enumerate(args, start=1): timer = utils.Timer() with timer: result = resize(arg, (index, len(args))) # result.elapsed_time = timer.elapsed_time() rows.append([index, result.file_name, utils.sizeof_fmt(result.file_size), utils.sec_to_hh_mm_ss(utils.get_video_length(result.file_name)) if result.file_name else "--", "{0:.1f} sec.".format(result.elapsed_time) if result.status else FAILED]) # if rows[-1][-1] != FAILED: total_time += result.elapsed_time total_file_size += result.file_size table.add_rows(rows) print table.draw() print 'Total file size:', utils.sizeof_fmt(total_file_size) print 'Total time: {0} (H:MM:SS)'.format(utils.sec_to_hh_mm_ss(total_time)) print utils.get_unix_date()
def frame(fname, size_tuple): index, full_size = size_tuple t = utils.sec_to_hh_mm_ss(utils.get_video_length(fname)) s = "({index} of {full_size}) {fname} ({time})".format( index=index, full_size=full_size, fname=fname, time=t ) size = len(s) horizontal = '+' + '-' * (size+2) + '+' print termcolor.colored(horizontal, "green") print termcolor.colored('| ' + s + ' |', "green") print termcolor.colored(horizontal, "green")