updates to digiserver app server

This commit is contained in:
2026-09-10 21:03:16 +03:00
parent 046f5e5efd
commit 1c5186463a
129 changed files with 33014 additions and 17 deletions
+18
View File
@@ -837,6 +837,24 @@ def receive_edited_media():
with open(metadata_path, 'w') as f:
json.dump(metadata, f, indent=2)
# ── Preserve the original filename ──────────────────────────────
# `content.filename` is (re)pointed at the latest edit below so the
# player downloads the newest version. The pristine original must be
# remembered separately, otherwise the original is lost forever and
# the UI shows the edited image as the "original".
if not content.original_filename:
if not content.filename.startswith('edited_media/'):
# Normal case: current filename is still the pristine upload.
content.original_filename = content.filename
else:
# Re-process: content.filename already points at an edited
# file. Recover the pristine original from the first (v1) edit.
first_edit = PlayerEdit.query.filter_by(content_id=content.id)\
.order_by(PlayerEdit.version.asc(), PlayerEdit.created_at.asc())\
.first()
if first_edit and first_edit.original_name:
content.original_filename = first_edit.original_name
# ── Point Content.filename to the latest edit ────────────────────
# This tells the player to download the latest edited version.
old_filename = content.filename
+6
View File
@@ -829,6 +829,7 @@ def process_file_in_background(app, filepath: str, filename: str, file_ext: str,
page_filename = os.path.basename(page_file)
page_content = Content(
filename=page_filename,
original_filename=page_filename,
content_type='image',
duration=duration,
file_size=os.path.getsize(page_file)
@@ -886,6 +887,7 @@ def process_file_in_background(app, filepath: str, filename: str, file_ext: str,
slide_filename = os.path.basename(slide_file)
slide_content = Content(
filename=slide_filename,
original_filename=slide_filename,
content_type='image',
duration=duration,
file_size=os.path.getsize(slide_file)
@@ -930,6 +932,7 @@ def process_file_in_background(app, filepath: str, filename: str, file_ext: str,
if processing_success and os.path.exists(filepath):
content = Content(
filename=filename,
original_filename=filename,
content_type=detected_type,
duration=duration,
file_size=os.path.getsize(filepath)
@@ -1313,6 +1316,7 @@ def upload_media():
# Create content record for page
page_content = Content(
filename=page_filename,
original_filename=page_filename,
content_type='image',
duration=duration,
file_size=os.path.getsize(page_file)
@@ -1373,6 +1377,7 @@ def upload_media():
# Create content record for slide
slide_content = Content(
filename=slide_filename,
original_filename=slide_filename,
content_type='image',
duration=duration,
file_size=os.path.getsize(slide_file)
@@ -1419,6 +1424,7 @@ def upload_media():
if os.path.exists(filepath):
content = Content(
filename=filename,
original_filename=filename,
content_type=detected_type,
duration=duration,
file_size=os.path.getsize(filepath)