def _temp_dir(path): path = app.path(path) d = os.path.join( app.temp_dir, urllib.quote(path.replace('\\', '/')).replace( '/', '%2F').replace('%', '.')) app.sure_mkdir(d) return d
def video_slice_export(r): config['bitrate'] = '16M' config['resolution'] = '1280:720' segment = madmagia.sequence.Segment(**json.loads(r.form['segment'])) input_files = madmagia.files.input_videos(r.form['video_dir'], ['mkv']) output_dir = _temp_dir(r.form['output_dir']) + '.export' app.sure_mkdir(output_dir) return madmagia.video_slice.slice_segment(0, segment, input_files, output_dir)
def clear_cached(r): shutil.rmtree(app.temp_dir) app.sure_mkdir(app.temp_dir)