From ff25cfdda949aedfa146b71bcda3c4ee9e3fb780 Mon Sep 17 00:00:00 2001 From: Hzqkii <128440086+Hzqkii@users.noreply.github.com> Date: Fri, 9 Feb 2024 12:45:07 +0000 Subject: [PATCH 1/2] If user is running linux, set "temp_folder" to "/tmp". Checks for whether the user is running linux and uses "/tmp" instead of the env variable "TEMP" as it doesn't exist. --- target/jamba.vpy | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/target/jamba.vpy b/target/jamba.vpy index e7a4e10..6014537 100644 --- a/target/jamba.vpy +++ b/target/jamba.vpy @@ -7,6 +7,9 @@ from vapoursynth import core import os from os import path # filepath handling import sys +import platform + +user_os = platform.system() path_dirname = path.dirname(__file__).replace('\\\\?\\', '') # .replace because windows @@ -55,7 +58,11 @@ verb(f"CONTEXT: __file__: {__file__}") _, input_ext = path.splitext(input_video) base_file_name = path.basename(input_video) -temp_folder = os.environ['TEMP'] + +if user_os == "Linux": + temp_folder = "/tmp" +else: + temp_folder = os.environ['TEMP'] cache_file = path.join(temp_folder, f"{base_file_name}-ffms2_index") if input_ext == '.avi': From bc584788cde691048362e8caa9ccc5fe16334a61 Mon Sep 17 00:00:00 2001 From: Hzqkii <128440086+Hzqkii@users.noreply.github.com> Date: Sat, 10 Feb 2024 02:27:58 +0000 Subject: [PATCH 2/2] Use tempfile.gettempdir() instead of hardcoding path --- target/jamba.vpy | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/target/jamba.vpy b/target/jamba.vpy index 6014537..256a2c1 100644 --- a/target/jamba.vpy +++ b/target/jamba.vpy @@ -7,9 +7,7 @@ from vapoursynth import core import os from os import path # filepath handling import sys -import platform - -user_os = platform.system() +import tempfile path_dirname = path.dirname(__file__).replace('\\\\?\\', '') # .replace because windows @@ -59,10 +57,8 @@ _, input_ext = path.splitext(input_video) base_file_name = path.basename(input_video) -if user_os == "Linux": - temp_folder = "/tmp" -else: - temp_folder = os.environ['TEMP'] + +temp_folder = tempfile.gettempdir() cache_file = path.join(temp_folder, f"{base_file_name}-ffms2_index") if input_ext == '.avi':