From a101e33be0c814ac7c793addc5482c00e7a7c8d7 Mon Sep 17 00:00:00 2001 From: WillB97 Date: Sat, 18 Feb 2023 11:00:50 +0000 Subject: [PATCH 1/2] Add script to fix animations on windows --- script/fix-animation | 51 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 script/fix-animation diff --git a/script/fix-animation b/script/fix-animation new file mode 100755 index 00000000..82c1ee29 --- /dev/null +++ b/script/fix-animation @@ -0,0 +1,51 @@ +#!/usr/bin/env python3 +import re +import argparse + + +def fix_animation(input: str, output: str) -> None: + with open(input) as f: + data = f.readlines() + + output_data = [] + for line in data: + if 'stylesheet' in line: + match = re.search(r'href="(.*?)"', line) + if match is None: + output_data.append(line) + else: + css_name = match[1].replace('\\', '/').split('/')[-1] + output_data.append(f' \n') + elif '', line) + if match is None: + output_data.append(line) + else: + jpg_name = match[1].replace('\\', '/').split('/')[-1] + x3d_name = match[2].replace('\\', '/').split('/')[-1] + json_name = match[3].replace('\\', '/').split('/')[-1] + output_data.append( + f' \n', + ) + else: + output_data.append(line) + + with open(output, 'w') as f: + f.writelines(output_data) + + +def main() -> None: + parser = argparse.ArgumentParser() + + parser.add_argument('animation') + parser.add_argument('output') + + args = parser.parse_args() + + fix_animation(args.animation, args.output) + + +if __name__ == '__main__': + main() From 55d2984c31b5fb1d442020f93bb8fae5590214a3 Mon Sep 17 00:00:00 2001 From: WillB97 Date: Sat, 18 Feb 2023 11:30:52 +0000 Subject: [PATCH 2/2] Linting --- script/fix-animation | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/fix-animation b/script/fix-animation index 82c1ee29..803c19a5 100755 --- a/script/fix-animation +++ b/script/fix-animation @@ -3,7 +3,7 @@ import re import argparse -def fix_animation(input: str, output: str) -> None: +def fix_animation(input: str, output: str) -> None: # noqa: A002 with open(input) as f: data = f.readlines()