From aa3908062f6760262ecf686def29768a13f6ee3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Sun, 21 Apr 2024 21:56:25 +0900 Subject: [PATCH] feat(gui): add assets checking --- gui_v1.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/gui_v1.py b/gui_v1.py index 112fc0a..0bc33b4 100644 --- a/gui_v1.py +++ b/gui_v1.py @@ -142,8 +142,22 @@ if __name__ == "__main__": self.input_devices_indices = None self.output_devices_indices = None self.stream = None + if not self.config.nocheck: self.check_assets() self.update_devices() self.launcher() + + def check_assets(self): + global now_dir + from infer.lib.rvcmd import check_all_assets, download_all_assets + + tmp = os.path.join(now_dir, "TEMP") + shutil.rmtree(tmp, ignore_errors=True) + os.makedirs(tmp, exist_ok=True) + if not check_all_assets(): + download_all_assets(tmpdir=tmp) + if not check_all_assets(): + printt("counld not satisfy all assets needed.") + exit(1) def load(self): try: