1
0
mirror of https://github.com/Escartem/AnimeWwise.git synced 2026-06-04 23:40:25 +08:00

fix bug and add subfolders

This commit is contained in:
Escartem
2024-11-07 11:55:26 +01:00
parent 0d6ce44849
commit b6879def0f
3 changed files with 10 additions and 5 deletions

10
app.py
View File

@@ -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"]

View File

@@ -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")]

View File

@@ -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)