Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -84,7 +84,7 @@ def create_master_playlist(output_paths, input_filename):
|
|
84 |
# read the .m3u8 file and replace relative links with absolute links
|
85 |
with open(path, 'r') as playlist_file:
|
86 |
content = playlist_file.readlines()
|
87 |
-
|
88 |
content = [f"https://{AWS_S3_BUCKET}.s3.amazonaws.com/{input_filename}/{res}/{line}" if line.endswith('.ts\n') else line for line in content]
|
89 |
f.writelines(content)
|
90 |
return master_playlist_path
|
@@ -134,7 +134,7 @@ def convert_video(video_file, quality, aspect_ratio, video_url):
|
|
134 |
|
135 |
output_links = []
|
136 |
for path in output_paths:
|
137 |
-
res_folder = Path(path).stem.split("_")[1]
|
138 |
s3_path = f"s3://{AWS_S3_BUCKET}/{Path(input_path).stem}/{res_folder}/{Path(path).name}"
|
139 |
upload_file_to_s3(path, s3_path)
|
140 |
output_links.append(f'<a href="https://s3-us-east-1.amazonaws.com/{AWS_S3_BUCKET}/{Path(input_path).stem}/{res_folder}/{Path(path).name}" target="_blank">Download {Path(path).stem}</a>')
|
@@ -144,7 +144,6 @@ def convert_video(video_file, quality, aspect_ratio, video_url):
|
|
144 |
res_folder = Path(path).stem.split("_")[1]
|
145 |
s3_path = f"s3://{AWS_S3_BUCKET}/{Path(input_path).stem}/{res_folder}/{Path(path).name}"
|
146 |
upload_file_to_s3(path, s3_path)
|
147 |
-
output_links.append(f'<a href="https://s3-us-east-1.amazonaws.com/{AWS_S3_BUCKET}/{Path(input_path).stem}/{res_folder}/{Path(path).name}" target="_blank">Download {Path(path).stem}</a>')
|
148 |
|
149 |
output_html = "<br>".join(output_links)
|
150 |
return output_html
|
|
|
84 |
# read the .m3u8 file and replace relative links with absolute links
|
85 |
with open(path, 'r') as playlist_file:
|
86 |
content = playlist_file.readlines()
|
87 |
+
# replace .ts extension with complete URL pointing to the TS segments on S3
|
88 |
content = [f"https://{AWS_S3_BUCKET}.s3.amazonaws.com/{input_filename}/{res}/{line}" if line.endswith('.ts\n') else line for line in content]
|
89 |
f.writelines(content)
|
90 |
return master_playlist_path
|
|
|
134 |
|
135 |
output_links = []
|
136 |
for path in output_paths:
|
137 |
+
res_folder = Path(path).stem.split("_")[1] if "_" in Path(path).stem else ""
|
138 |
s3_path = f"s3://{AWS_S3_BUCKET}/{Path(input_path).stem}/{res_folder}/{Path(path).name}"
|
139 |
upload_file_to_s3(path, s3_path)
|
140 |
output_links.append(f'<a href="https://s3-us-east-1.amazonaws.com/{AWS_S3_BUCKET}/{Path(input_path).stem}/{res_folder}/{Path(path).name}" target="_blank">Download {Path(path).stem}</a>')
|
|
|
144 |
res_folder = Path(path).stem.split("_")[1]
|
145 |
s3_path = f"s3://{AWS_S3_BUCKET}/{Path(input_path).stem}/{res_folder}/{Path(path).name}"
|
146 |
upload_file_to_s3(path, s3_path)
|
|
|
147 |
|
148 |
output_html = "<br>".join(output_links)
|
149 |
return output_html
|