updated functions

This commit is contained in:
2025-06-27 17:01:30 +03:00
parent 67c9083a6e
commit 1800c9c310
6 changed files with 21 additions and 48 deletions

View File

@@ -40,12 +40,8 @@ def add_image_to_playlist(app, file, filename, duration, target_type, target_id)
# Video conversion functions
def convert_video(input_file, output_folder):
""" Converts a video file to MP4 format with H.264 codec, 720p resolution, and 30 FPS.
Args:
input_file (str): Path to the input video file.
output_folder (str): Path to the folder where the converted video will be saved.
Returns:
str: Path to the converted video file, or None if conversion fails.
"""
Converts a video file to MP4 format with H.264 codec.
"""
if not os.path.exists(output_folder):
os.makedirs(output_folder)
@@ -78,6 +74,9 @@ def convert_video(input_file, output_folder):
return None
def convert_video_and_update_playlist(app, file_path, original_filename, target_type, target_id, duration):
"""
Converts a video and updates the playlist database.
"""
print(f"Starting video conversion for: {file_path}")
converted_file = convert_video(file_path, app.config['UPLOAD_FOLDER'])
if converted_file: