if flv[3] == 'pass': new_flv.append(flv[0]) new_flv.append(flv[1]) new_flv.append(flv[2]) cuted_flvs.append(new_flv) dest = dest_path + '/' + str(flv[0]) copy(src, dest) retimestamp_flv.retimestamp_file_inplace(dest) index_flv.index_file(dest) elif flv[3] == 'cut_head': new_flv.append(course_id + '-' + str(flv[4]) + '.flv') new_flv.append(flv[4]) new_flv.append(flv[2] - flv[5]) cuted_flvs.append(new_flv) dest = dest_path + '/' + new_flv[0] if not cut_flv.cut_file(src, dest, flv[5] * 1000, None): logger.error('cut False at %s', str(course_id)) else : retimestamp_flv.retimestamp_file_inplace(dest) index_flv.index_file(dest) elif flv[3] == 'cut_tail': new_flv.append(flv[0]) new_flv.append(flv[1]) new_flv.append(flv[5]) cuted_flvs.append(new_flv) dest = dest_path + '/' + new_flv[0] if not cut_flv.cut_file(src, dest, None, flv[5] * 1000): logger.error('cut False at %s', str(course_id)) else : retimestamp_flv.retimestamp_file_inplace(dest) index_flv.index_file(dest)
def main(): cut_flv.cut_file("test.flv", "test1.flv", None, 20)