Skip to content

Commit

Permalink
[preview] when normalizing movie store it first + allow to use file f…
Browse files Browse the repository at this point in the history
…rom config.TMP when renormalizing (if not found in source)
  • Loading branch information
EvanBldy committed Jan 13, 2025
1 parent e976bb1 commit 615f80c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
8 changes: 4 additions & 4 deletions zou/app/services/preview_files_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ def prepare_and_store_movie(
from zou.app import app as current_app

with current_app.app_context():
if add_source_to_file_store:
file_store.add_movie(
"source", preview_file_id, uploaded_movie_path
)
preview_file_raw = files_service.get_preview_file_raw(preview_file_id)
normalized_movie_low_path = None
try:
Expand All @@ -205,10 +209,6 @@ def prepare_and_store_movie(
if normalize:
current_app.logger.info("start normalization")
try:
if add_source_to_file_store:
file_store.add_movie(
"source", preview_file_id, uploaded_movie_path
)
if (
config.ENABLE_JOB_QUEUE_REMOTE
and len(config.JOB_QUEUE_NOMAD_NORMALIZE_JOB) > 0
Expand Down
31 changes: 17 additions & 14 deletions zou/app/utils/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -774,20 +774,23 @@ def renormalize_movie_preview_files(
config.TMP_DIR,
f"{preview_file_id}.{extension}.tmp",
)
if config.FS_BACKEND == "local":
shutil.copyfile(
file_store.get_local_movie_path(
"source", preview_file_id
),
uploaded_movie_path,
)
else:
sync_service.download_file(
uploaded_movie_path,
"source",
file_store.open_movie,
str(preview_file_id),
)
try:
if config.FS_BACKEND == "local":
shutil.copyfile(
file_store.get_local_movie_path(
"source", preview_file_id
),
uploaded_movie_path,
)
else:
sync_service.download_file(
uploaded_movie_path,
"source",
file_store.open_movie,
str(preview_file_id),
)
except:
pass
if config.ENABLE_JOB_QUEUE:
queue_store.job_queue.enqueue(
preview_files_service.prepare_and_store_movie,
Expand Down

0 comments on commit 615f80c

Please sign in to comment.