diff --git a/README.md b/README.md index b9c815e..1fd8c99 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ curl --location 'http://localhost:8090/enqueue' \ --form 'channelLayout="mono"' \ --form 'uploadUrl="http://127.0.0.1:8909/upload"' ``` -3. Your `uploadUrl` will receive JSON response with job ID and error in case of failure and the entire transcoded file contents in case of success. Use `Content-Type` header to differentiate between the two data types. +3. Your `uploadUrl` will receive JSON response with job ID and error in case of failure and the entire transcoded file contents in case of success (success request will have `X-Task-Id` header with task ID). Use `Content-Type` header to differentiate between the two data types. You can change configuration using this environment variables: - `LISTEN` - change this environment variable to change TCP listen address. Default is `0.0.0.0:8090`. diff --git a/src/dto.rs b/src/dto.rs index 51102ec..3ba6962 100644 --- a/src/dto.rs +++ b/src/dto.rs @@ -2,11 +2,6 @@ use axum_typed_multipart::{FieldData, TryFromMultipart}; use serde::{Deserialize, Serialize}; use tempfile::NamedTempFile; -#[derive(Serialize, Deserialize)] -pub struct Error { - pub error: String, -} - #[derive(Serialize, Deserialize)] pub struct ConvertResponse { pub id: Option, diff --git a/src/server.rs b/src/server.rs index 698666f..d4fb173 100644 --- a/src/server.rs +++ b/src/server.rs @@ -166,4 +166,4 @@ async fn cleanup_directory(dir_path: &str) -> Result<(), Box>( + id: &str, file_path: P, url: &str, ) -> Result> { @@ -233,6 +238,7 @@ fn upload_file>( "Content-Disposition", &format!("attachment; filename=\"{}\"", file_name), ) + .set("X-Task-Id", id) .send_bytes(&buffer)?; if response.status() == 200 { diff --git a/src/transcoder.rs b/src/transcoder.rs index 3d510e7..73e2fdf 100644 --- a/src/transcoder.rs +++ b/src/transcoder.rs @@ -240,7 +240,7 @@ fn filter_graph( }; filter.add(&abuffersink_filter, "out", "")?; - let mut out = match filter.get("out") { + let mut out = match filter.get("out") { Some(filter) => filter, None => return Err(ffmpeg::Error::Unknown), }; @@ -257,9 +257,7 @@ fn filter_graph( .contains(codec::capabilities::Capabilities::VARIABLE_FRAME_SIZE) { if let Some(mut out_filter) = filter.get("out") { - out_filter - .sink() - .set_frame_size(encoder.frame_size()); + out_filter.sink().set_frame_size(encoder.frame_size()); } } }