def choose_drive(cfg): """ Choose a stream dir manuely. """ path = askopenfilename2( title = "Choose the stream dir:", initialdir = cfg["last sourcedir"], filetypes = [('M2TS File','*.m2ts')], ) vol_info = path.replace("\\", "_").replace(":","_") # Fallback for part in reversed(path.split(os.sep)[:-1]): # Use the last part of the path as a vol_info if part.upper() not in ("BDMV", "STREAM"): vol_info = part break drive = Drive(os.path.splitdrive(path)[0], cfg) drive["stream_dir"] = os.path.split(path)[0] drive.set_vol_info((vol_info,)) drive.debug() drives = [drive,] cfg["last sourcedir"] = path return drives
def choose_drive(cfg): """ Choose a stream dir manuely. """ path = askopenfilename2( title="Choose the stream dir:", initialdir=cfg["last sourcedir"], filetypes=[('M2TS File', '*.m2ts')], ) vol_info = path.replace("\\", "_").replace(":", "_") # Fallback for part in reversed(path.split(os.sep)[:-1]): # Use the last part of the path as a vol_info if part.upper() not in ("BDMV", "STREAM"): vol_info = part break drive = Drive(os.path.splitdrive(path)[0], cfg) drive["stream_dir"] = os.path.split(path)[0] drive.set_vol_info((vol_info, )) drive.debug() drives = [ drive, ] cfg["last sourcedir"] = path return drives
def select_sourcefile(cfg): video_file_path = askopenfilename2( title = "Choose video source file:", initialdir = cfg["last sourcedir"], filetypes = cfg["videofiletypes"], ) if video_file_path == "": sys.exit() path, filename = os.path.split(video_file_path) if path != cfg["last sourcedir"]: cfg["last sourcedir"] = path cfg.save_config() return video_file_path
parts1.append(", ".join(parts)) parts1 += [p.strip(" -") for p in parameters] basename = " - ".join(parts1) return basename + ".ac3" if __name__ == "__main__": cfg = VideoToolsConfig() cfg.debug() files = sys.argv[1:] if not files: files = askopenfilename2( title = "Choose the source file(s):", initialdir = cfg["last sourcedir"], multiple = True # filetypes = [('M2TS File','*.*')], ) assert isinstance(files, list) if PARAM_KEY not in cfg: cfg[PARAM_KEY] = ["-384, -down6"] new_values = simple_input( title="eac3to parameters", pre_lable="Please input the used parameters (separated by comma!):", init_value=cfg[PARAM_KEY][0], post_lable="last values: %r\nUse nothing for only demuxing!" % cfg[PARAM_KEY], ) parameters = [i.strip() for i in new_values.split(",")]
parts1.append(", ".join(parts)) parts1 += [p.strip(" -") for p in parameters] basename = " - ".join(parts1) return basename + ".ac3" if __name__ == "__main__": cfg = VideoToolsConfig() cfg.debug() files = sys.argv[1:] if not files: files = askopenfilename2( title="Choose the source file(s):", initialdir=cfg["last sourcedir"], multiple=True # filetypes = [('M2TS File','*.*')], ) assert isinstance(files, list) if PARAM_KEY not in cfg: cfg[PARAM_KEY] = ["-384, -down6"] new_values = simple_input( title="eac3to parameters", pre_lable="Please input the used parameters (separated by comma!):", init_value=cfg[PARAM_KEY][0], post_lable="last values: %r\nUse nothing for only demuxing!" % cfg[PARAM_KEY], ) parameters = [i.strip() for i in new_values.split(",")]