From 1f919b3da239a8e80b79903f767c70d4dffaf0b3 Mon Sep 17 00:00:00 2001 From: MightyZanark <40352213+MightyZanark@users.noreply.github.com> Date: Fri, 23 Jun 2023 19:47:49 +0900 Subject: [PATCH] temp fix: IndexError for some movie types --- scripts/Movie.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/scripts/Movie.py b/scripts/Movie.py index cba440e..f2741c8 100644 --- a/scripts/Movie.py +++ b/scripts/Movie.py @@ -123,17 +123,21 @@ def extract(usm: pcc.USM, dirname: str = "") -> list[str]: filenames.append(fname) for i, (k, data) in enumerate(usm.output.items()): - if "SFV" in k: - with open(filenames[i+1], "wb") as out: - out.write(data) - - elif "SFA" in k: - audio = pcc.ADX(data) - with open(filenames[i+1], "wb") as out: - out.write(audio.decode()) - - else: - raise NotImplementedError(f'Unknown type of data: {k}\nHeader: {data[:4]}') + try: + if "SFV" in k: + with open(filenames[i+1], "wb") as out: + out.write(data) + + elif "SFA" in k: + audio = pcc.ADX(data) + with open(filenames[i+1], "wb") as out: + out.write(audio.decode()) + + else: + raise NotImplementedError(f'Unknown type of data: {k}\nHeader: {data[:4]}') + + except IndexError: + continue return filenames