Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -72,7 +72,7 @@ def create_master_playlist(output_paths, temp_dir):
|
|
| 72 |
f.write(f"{path.name}\n")
|
| 73 |
return master_playlist_path
|
| 74 |
|
| 75 |
-
def convert_video(video_file, quality, aspect_ratio, video_url, ftp_server, ftp_username, ftp_password, ftp_path, upload):
|
| 76 |
standard_resolutions = [4320, 2160, 1440, 1080, 720, 480, 360, 240, 144] # 8K, 4K, 2K, Full HD, HD, SD in pixels
|
| 77 |
|
| 78 |
with tempfile.TemporaryDirectory() as temp_dir:
|
|
@@ -127,7 +127,13 @@ def convert_video(video_file, quality, aspect_ratio, video_url, ftp_server, ftp_
|
|
| 127 |
for path in [master_playlist_copy_path] + output_copy_paths:
|
| 128 |
source_file = path # This should be the full local path of the file
|
| 129 |
destination_file = ftp_path + "/" + path.name # This should be the desired remote path of the file
|
| 130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
ftp_files.append(destination_file)
|
| 132 |
return ftp_files
|
| 133 |
else:
|
|
|
|
| 72 |
f.write(f"{path.name}\n")
|
| 73 |
return master_playlist_path
|
| 74 |
|
| 75 |
+
def convert_video(video_file, quality, aspect_ratio, video_url, ftp_server, ftp_port, ftp_username, ftp_password, ftp_path, upload):
|
| 76 |
standard_resolutions = [4320, 2160, 1440, 1080, 720, 480, 360, 240, 144] # 8K, 4K, 2K, Full HD, HD, SD in pixels
|
| 77 |
|
| 78 |
with tempfile.TemporaryDirectory() as temp_dir:
|
|
|
|
| 127 |
for path in [master_playlist_copy_path] + output_copy_paths:
|
| 128 |
source_file = path # This should be the full local path of the file
|
| 129 |
destination_file = ftp_path + "/" + path.name # This should be the desired remote path of the file
|
| 130 |
+
|
| 131 |
+
# Distinguish between FTP and SFTP based on the port number
|
| 132 |
+
if ftp_port == 22:
|
| 133 |
+
upload_to_sftp(ftp_server, ftp_port, ftp_username, ftp_password, source_file, destination_file)
|
| 134 |
+
else:
|
| 135 |
+
upload_to_ftp(ftp_server, ftp_port, ftp_username, ftp_password, source_file, destination_file)
|
| 136 |
+
|
| 137 |
ftp_files.append(destination_file)
|
| 138 |
return ftp_files
|
| 139 |
else:
|