diff --git a/README.md b/README.md index b242da0..097f78d 100644 --- a/README.md +++ b/README.md @@ -214,10 +214,10 @@ For **Linux/Mac**: - start webui's python venv - for Windows: run `cmd_here.cmd` - - for Linux/Mac: run `..\..\venv\Scripts\activate` + - for Linux/Mac: run `../../venv/Scripts/activate` - run `pip install -r requirements.txt` (only setup once) -- run `postprocessor.py` -- find usage help message in right click pop menu +- run `python postprocessor.py`, or for Windows just run the [DOSKEY](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/doskey) `pp` +- find usage help message in right click pop menu to start ⚪ cmd script (for Windows) diff --git a/cmd_here.cmd b/cmd_here.cmd index 09138e8..cc885b4 100644 --- a/cmd_here.cmd +++ b/cmd_here.cmd @@ -15,6 +15,8 @@ SET PY_BIN=python.exe %PY_BIN% --version > NUL IF ERRORLEVEL 1 GOTO die +DOSKEY pp=python postprocessor.py + CMD /K activate.bat ^& ECHO VENV_PATH: %VENV_PATH% ^& %PY_BIN% --version GOTO EOF diff --git a/postprocessor.py b/postprocessor.py index e4ae118..46fcf9b 100644 --- a/postprocessor.py +++ b/postprocessor.py @@ -54,6 +54,7 @@ def sanitize_pathname(path: Union[str, Path]) -> str: return path.replace('\\', os.path.sep) def startfile(path:Union[str, Path]): + # ref: https://stackoverflow.com/questions/17317219/is-there-an-platform-independent-equivalent-of-os-startfile/17317468#17317468 if isinstance(path, Path): path = str(path) if sys.platform == 'win32': os.startfile(path) @@ -318,7 +319,7 @@ def _ls_change(self): self.cur_name = name if name not in self.cache: dp = Path(self.var_root_dp.get()) / name - self.cache[name] = sorted([fp for fp in dp.iterdir() if fp.suffix.lower() in ['.png', '.jpg', '.jpeg']]) + self.cache[name] = sorted([fp for fp in dp.iterdir() if fp.suffix.lower() in ['.png', '.jpg', '.jpeg'] and fp.stem != 'embryo']) n_imgs = len(self.cache[name]) self.sc.config(to=n_imgs-1) @@ -330,7 +331,7 @@ def _ls_change(self): def _ls_open_dir(self): try: startfile(Path(self.var_root_dp.get()) / self.cur_name) - except: pass + except: print_exc() def _pv_change(self, evt=None): if not self.cur_name: return @@ -384,10 +385,17 @@ def run_tasks(*args): try: self.is_running = True self.btn.config(state=tk.DISABLED, text='Running...') + if var_resr: assert run_resr(var_resr_m, var_resr_r, base_dp, base_dp / 'resr') + + # NOTE: fix case of Embryo mode + embryo_fp: Path = base_dp / 'resr' / 'embryo.png' + if embryo_fp.exists(): embryo_fp.unlink() + if var_rife: assert run_rife(var_rife_m, var_rife_r, base_dp / 'resr', base_dp / 'rife') + if var_ffmpeg: assert run_ffmpeg(var_ffmpeg_r, var_ffmpeg_f, base_dp / 'rife', base_dp)