Skip to content

Commit

Permalink
[remote] fix redis access while getting temp dir from config
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanBldy committed Sep 26, 2023
1 parent 546e466 commit 7cd89d2
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions zou/utils/movie.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import ffmpeg
import opentimelineio as otio

from zou.app import config

logger = logging.getLogger(__name__)
loghandler = logging.StreamHandler()
Expand Down Expand Up @@ -58,7 +57,7 @@ def generate_thumbnail(movie_path):
"""
file_source_name = os.path.basename(movie_path)
file_target_name = "%s.png" % file_source_name[:-4]
file_target_path = os.path.join(config.TMP_DIR, file_target_name)
file_target_path = os.path.join(tempfile.gettempdir(), file_target_name)

try:
ffmpeg.input(movie_path, ss="00:00:00").output(
Expand All @@ -77,7 +76,7 @@ def extract_frame_from_movie(movie_path, frame_number, movie_fps):
"""
file_source_name = os.path.basename(movie_path)
file_target_name = f"{file_source_name[:-4]}_{frame_number}.png"
file_target_path = os.path.join(config.TMP_DIR, file_target_name)
file_target_path = os.path.join(tempfile.gettempdir(), file_target_name)

frame_time = otio.opentime.RationalTime(
frame_number - 1, float(movie_fps)
Expand All @@ -100,7 +99,7 @@ def generate_tile(movie_path, movie_fps):
"""
file_source_name = os.path.basename(movie_path)
file_target_name = f"{file_source_name[:-4]}_tile.png"
file_target_path = os.path.join(config.TMP_DIR, file_target_name)
file_target_path = os.path.join(tempfile.gettempdir(), file_target_name)
probe = ffmpeg.probe(movie_path)
duration_in_seconds = float(probe["streams"][0]["duration"])
float_movie_fps = float(movie_fps)
Expand Down Expand Up @@ -191,9 +190,11 @@ def normalize_movie(movie_path, fps, width, height):
"""
file_source_name = os.path.basename(movie_path)
file_target_name = "%s.mp4" % file_source_name[:-8]
file_target_path = os.path.join(config.TMP_DIR, file_target_name)
file_target_path = os.path.join(tempfile.gettempdir(), file_target_name)
low_file_target_name = "%s_low.mp4" % file_source_name[:-8]
low_file_target_path = os.path.join(config.TMP_DIR, low_file_target_name)
low_file_target_path = os.path.join(
tempfile.gettempdir(), low_file_target_name
)

(w, h) = get_movie_size(movie_path)
resize_factor = w / h
Expand Down

0 comments on commit 7cd89d2

Please sign in to comment.