Spaces:
Sleeping
Sleeping
Monteeq CI commited on
Commit Β·
51913a2
1
Parent(s): 5beeefc
π Deploy from GitHub @ d68e85c218a2e847f727d1a8b36d05cd81b68b1a
Browse filesTriggered by: Smasduq
Message: fix(backend): import Session in seo endpoint and use .venv in dev scripts
- src/models.rs +1 -1
- src/transcoder.rs +2 -2
- src/worker.rs +2 -2
src/models.rs
CHANGED
|
@@ -19,7 +19,7 @@ pub struct VideoTask {
|
|
| 19 |
/// "auto" (Rust generates) or "custom" (client already uploaded cover)
|
| 20 |
#[serde(default = "default_cover_source", alias = "coverSource")]
|
| 21 |
pub cover_source: String,
|
| 22 |
-
/// S3 key for a custom cover, e.g.
|
| 23 |
#[serde(default, alias = "coverS3Key")]
|
| 24 |
pub cover_s3_key: Option<String>,
|
| 25 |
}
|
|
|
|
| 19 |
/// "auto" (Rust generates) or "custom" (client already uploaded cover)
|
| 20 |
#[serde(default = "default_cover_source", alias = "coverSource")]
|
| 21 |
pub cover_source: String,
|
| 22 |
+
/// S3 key for a custom cover, e.g. thumbnails/{job_id}.jpg
|
| 23 |
#[serde(default, alias = "coverS3Key")]
|
| 24 |
pub cover_s3_key: Option<String>,
|
| 25 |
}
|
src/transcoder.rs
CHANGED
|
@@ -666,7 +666,7 @@ pub async fn extract_cover_frame(video_path: &str, out_jpg: &str, pct: f64) -> R
|
|
| 666 |
Ok(())
|
| 667 |
}
|
| 668 |
|
| 669 |
-
/// Auto cover: frame at ~10% duration β JPEG β S3 `
|
| 670 |
/// Returns the S3 key for inclusion in the Redis completion payload.
|
| 671 |
pub async fn generate_and_upload_auto_cover(
|
| 672 |
video_path: &str,
|
|
@@ -676,7 +676,7 @@ pub async fn generate_and_upload_auto_cover(
|
|
| 676 |
let cover_local = format!("{}_cover.jpg", video_path);
|
| 677 |
extract_cover_frame(video_path, &cover_local, 0.1).await?;
|
| 678 |
|
| 679 |
-
let cover_key = format!("
|
| 680 |
storage
|
| 681 |
.upload_file(Path::new(&cover_local), &cover_key)
|
| 682 |
.await?;
|
|
|
|
| 666 |
Ok(())
|
| 667 |
}
|
| 668 |
|
| 669 |
+
/// Auto cover: frame at ~10% duration β JPEG β S3 `thumbnails/{task_id}.jpg`.
|
| 670 |
/// Returns the S3 key for inclusion in the Redis completion payload.
|
| 671 |
pub async fn generate_and_upload_auto_cover(
|
| 672 |
video_path: &str,
|
|
|
|
| 676 |
let cover_local = format!("{}_cover.jpg", video_path);
|
| 677 |
extract_cover_frame(video_path, &cover_local, 0.1).await?;
|
| 678 |
|
| 679 |
+
let cover_key = format!("thumbnails/{}.jpg", task_id);
|
| 680 |
storage
|
| 681 |
.upload_file(Path::new(&cover_local), &cover_key)
|
| 682 |
.await?;
|
src/worker.rs
CHANGED
|
@@ -133,12 +133,12 @@ async fn process_video_job(scheduler: WeightedScheduler, task: VideoTask) {
|
|
| 133 |
let cover_url = if is_custom {
|
| 134 |
// Custom: no generation β pass through already-uploaded S3 key
|
| 135 |
let key = cover_s3_key.clone().unwrap_or_else(|| {
|
| 136 |
-
format!("
|
| 137 |
});
|
| 138 |
println!("Using custom cover (skip generation): {}", key);
|
| 139 |
key
|
| 140 |
} else {
|
| 141 |
-
// Auto (or missing): extract ~10% frame, JPEG, upload
|
| 142 |
match transcoder::generate_and_upload_auto_cover(
|
| 143 |
&temp_path,
|
| 144 |
&task_id,
|
|
|
|
| 133 |
let cover_url = if is_custom {
|
| 134 |
// Custom: no generation β pass through already-uploaded S3 key
|
| 135 |
let key = cover_s3_key.clone().unwrap_or_else(|| {
|
| 136 |
+
format!("thumbnails/{}.jpg", task_id)
|
| 137 |
});
|
| 138 |
println!("Using custom cover (skip generation): {}", key);
|
| 139 |
key
|
| 140 |
} else {
|
| 141 |
+
// Auto (or missing): extract ~10% frame, JPEG, upload thumbnails/{task_id}.jpg
|
| 142 |
match transcoder::generate_and_upload_auto_cover(
|
| 143 |
&temp_path,
|
| 144 |
&task_id,
|