Upload 7 files
Browse files- app.py +11 -7
- client-v3.html +4 -1
app.py
CHANGED
|
@@ -88,13 +88,17 @@ def process_video_background(job_id: str, req: VideoRequest):
|
|
| 88 |
|
| 89 |
# 4. UPLOAD
|
| 90 |
JOBS[job_id]["progress"] = "Uploading Transparent Layer..."
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
UPLOAD_PRESET,
|
| 94 |
-
cloud_name=CLOUD_NAME,
|
| 95 |
-
resource_type="video"
|
| 96 |
)
|
| 97 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
|
| 99 |
# 5. CLEANUP
|
| 100 |
try:
|
|
@@ -105,7 +109,7 @@ def process_video_background(job_id: str, req: VideoRequest):
|
|
| 105 |
|
| 106 |
JOBS[job_id]["status"] = "completed"
|
| 107 |
JOBS[job_id]["progress"] = "Done"
|
| 108 |
-
JOBS[job_id]["result"] = [
|
| 109 |
|
| 110 |
except Exception as e:
|
| 111 |
print(f"[{job_id}] FAILED: {str(e)}")
|
|
|
|
| 88 |
|
| 89 |
# 4. UPLOAD
|
| 90 |
JOBS[job_id]["progress"] = "Uploading Transparent Layer..."
|
| 91 |
+
res_vid = cloudinary.uploader.unsigned_upload(
|
| 92 |
+
output_video, UPLOAD_PRESET, cloud_name=CLOUD_NAME, resource_type="video"
|
|
|
|
|
|
|
|
|
|
| 93 |
)
|
| 94 |
+
|
| 95 |
+
# DEBUG: Upload ASS file too
|
| 96 |
+
res_ass = cloudinary.uploader.unsigned_upload(
|
| 97 |
+
ass_file, UPLOAD_PRESET, cloud_name=CLOUD_NAME, resource_type="raw"
|
| 98 |
+
)
|
| 99 |
+
|
| 100 |
+
url_vid = res_vid['secure_url']
|
| 101 |
+
url_ass = res_ass['secure_url']
|
| 102 |
|
| 103 |
# 5. CLEANUP
|
| 104 |
try:
|
|
|
|
| 109 |
|
| 110 |
JOBS[job_id]["status"] = "completed"
|
| 111 |
JOBS[job_id]["progress"] = "Done"
|
| 112 |
+
JOBS[job_id]["result"] = [url_vid, url_ass]
|
| 113 |
|
| 114 |
except Exception as e:
|
| 115 |
print(f"[{job_id}] FAILED: {str(e)}")
|
client-v3.html
CHANGED
|
@@ -140,9 +140,12 @@
|
|
| 140 |
if (job.status === 'completed') {
|
| 141 |
clearInterval(interval);
|
| 142 |
const url = job.result[0];
|
|
|
|
| 143 |
resArea.innerHTML = `
|
| 144 |
<p style="color:#0f0">Success!</p>
|
| 145 |
-
<a href="${url}" target="_blank" style="color:yellow; word-break:break-all;">${url}</a>
|
|
|
|
|
|
|
| 146 |
<br><br>
|
| 147 |
<video src="${url}" controls style="width:100%; background: checkerboard;"></video>
|
| 148 |
`;
|
|
|
|
| 140 |
if (job.status === 'completed') {
|
| 141 |
clearInterval(interval);
|
| 142 |
const url = job.result[0];
|
| 143 |
+
const assUrl = job.result[1];
|
| 144 |
resArea.innerHTML = `
|
| 145 |
<p style="color:#0f0">Success!</p>
|
| 146 |
+
<a href="${url}" target="_blank" style="color:yellow; word-break:break-all;">VIDEO: ${url}</a>
|
| 147 |
+
<br>
|
| 148 |
+
<a href="${assUrl}" target="_blank" style="color:cyan; word-break:break-all;">DEBUG ASS: ${assUrl}</a>
|
| 149 |
<br><br>
|
| 150 |
<video src="${url}" controls style="width:100%; background: checkerboard;"></video>
|
| 151 |
`;
|