From b6879def0f341cc1ae09b9c958c9b0696e53fdcf Mon Sep 17 00:00:00 2001 From: Escartem Date: Thu, 7 Nov 2024 11:55:26 +0100 Subject: [PATCH] fix bug and add subfolders --- app.py | 10 ++++++++-- extract.py | 3 +-- wwise.py | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app.py b/app.py index 8fb000d..37f622d 100644 --- a/app.py +++ b/app.py @@ -54,7 +54,6 @@ class BackgroundWorker(QObject): def run(self): if self.action == "load": print("Loading files and mapping if necessary...") - self.currentInput = self.input fileStructure = self.extract.load_folder(self.map, self.input, self.diff, progress=self.progress.emit) if fileStructure is None: self.finished.emit({"action": "error", "content": {"msg": "Nothing found !", "state": 1}}) @@ -244,7 +243,10 @@ class AnimeWwise(QMainWindow): self.setFolder(folder="input") files = [] if self.folders["input"]: - files = [os.path.join(self.folders["input"], f) for f in os.listdir(self.folders["input"]) if f.endswith(".pck")] + if self.pckSubFold.isChecked(): + files = [os.path.join(root, f) for root, dirs, files_in_dir in os.walk(self.folders["input"]) for f in files_in_dir if f.endswith(".pck")] + else: + files = [os.path.join(self.folders["input"], f) for f in os.listdir(self.folders["input"]) if f.endswith(".pck")] elif self.loadType == "file": path = QFileDialog.getOpenFileName(self, "Select .pck File", "", "PCK Files (*.pck)", options=QFileDialog.Options()) files = [path[0]] @@ -253,6 +255,10 @@ class AnimeWwise(QMainWindow): QMessageBox.warning(None, "Warning", "Nothing to load !", QMessageBox.Ok) return + self.currentInput = self.folders["input"] + if not self.folders["input"]: + self.currentInput = os.path.dirname(path[0]) + _map = self.assetMap.currentIndex() if _map != 0: _map = self.maps["maps"][_map-1]["name"] diff --git a/extract.py b/extract.py index 7fdd246..184fa38 100644 --- a/extract.py +++ b/extract.py @@ -25,10 +25,9 @@ class WwiseExtract: self.steps = 1 self.mapper = None if _map is not None: - self.mapper = Mapper(path(cwd, f"maps/{_map}")) + self.mapper = Mapper(path(cwd, f"maps/{_map}")) # TODO: load maps once self.file_structure = {"folders": {}, "files": []} - # files = [f for f in os.listdir(folder_path) if f.endswith(".pck")] hdiff_files = [] if diff_path != "": hdiff_files = [f for f in os.listdir(diff_path) if f.endswith(".pck.hdiff")] diff --git a/wwise.py b/wwise.py index 93de3b7..49c9cd3 100644 --- a/wwise.py +++ b/wwise.py @@ -1,5 +1,5 @@ # wwise riff header parser -# thanks to hcs and bnnm +# thanks to hcs and bnnm work def parse_wwise(reader): header = reader.ReadBytes(4)