Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -93,13 +93,20 @@ def create_master_playlist(output_paths, input_filename):
|
|
| 93 |
f.writelines(content)
|
| 94 |
return master_playlist_path
|
| 95 |
|
| 96 |
-
def upload_file_to_s3(
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
|
|
|
|
|
|
|
|
|
| 100 |
|
| 101 |
-
|
| 102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
|
| 105 |
def convert_video(video_file, quality, aspect_ratio, video_url):
|
|
|
|
| 93 |
f.writelines(content)
|
| 94 |
return master_playlist_path
|
| 95 |
|
| 96 |
+
def upload_file_to_s3(local_path, s3_key):
|
| 97 |
+
s3 = boto3.client(
|
| 98 |
+
"s3",
|
| 99 |
+
aws_access_key_id=st.secrets["AWS_ACCESS_KEY_ID"],
|
| 100 |
+
aws_secret_access_key=st.secrets["AWS_SECRET_ACCESS_KEY"],
|
| 101 |
+
region_name=st.secrets["AWS_REGION"],
|
| 102 |
+
)
|
| 103 |
|
| 104 |
+
bucket_name = st.secrets["AWS_S3_BUCKET"]
|
| 105 |
+
|
| 106 |
+
with open(local_path, "rb") as file:
|
| 107 |
+
s3.upload_fileobj(file, bucket_name, s3_key)
|
| 108 |
+
|
| 109 |
+
return f"https://{bucket_name}.s3.amazonaws.com/{s3_key}"
|
| 110 |
|
| 111 |
|
| 112 |
def convert_video(video_file, quality, aspect_ratio, video_url):
|