Spaces:
Running
Running
Upload main.rs
Browse files- src/main.rs +5 -2
src/main.rs
CHANGED
|
@@ -677,6 +677,7 @@ struct StreamParams {
|
|
| 677 |
}
|
| 678 |
|
| 679 |
async fn stream_info(State(state): State<AppState>, Query(q): Query<StreamParams>) -> impl IntoResponse {
|
|
|
|
| 680 |
let formats = match q.format.as_deref().unwrap_or("AUTO") {
|
| 681 |
"FLAC" => vec![Format::FLAC, Format::MP3_320, Format::MP3_128],
|
| 682 |
"MP3_320" => vec![Format::MP3_320, Format::MP3_128],
|
|
@@ -685,7 +686,6 @@ async fn stream_info(State(state): State<AppState>, Query(q): Query<StreamParams
|
|
| 685 |
_ => vec![Format::FLAC, Format::MP3_320, Format::MP3_128],
|
| 686 |
};
|
| 687 |
|
| 688 |
-
|
| 689 |
let requested = q.format.clone().unwrap_or_else(|| "AUTO".to_string());
|
| 690 |
let mut url: String = String::new();
|
| 691 |
let mut used: String = String::new();
|
|
@@ -763,6 +763,8 @@ async fn stream_info(State(state): State<AppState>, Query(q): Query<StreamParams
|
|
| 763 |
((total_bytes as f64) * 8.0 / (duration as f64) / 1000.0).round() as u64
|
| 764 |
} else { 0 };
|
| 765 |
|
|
|
|
|
|
|
| 766 |
(StatusCode::OK, Json(json!({
|
| 767 |
"id": q.id,
|
| 768 |
"requested": requested,
|
|
@@ -770,7 +772,8 @@ async fn stream_info(State(state): State<AppState>, Query(q): Query<StreamParams
|
|
| 770 |
"duration": duration,
|
| 771 |
"bytes": total_bytes,
|
| 772 |
"bitrate_kbps": bitrate_kbps,
|
| 773 |
-
"mime": mime
|
|
|
|
| 774 |
}))).into_response()
|
| 775 |
}
|
| 776 |
|
|
|
|
| 677 |
}
|
| 678 |
|
| 679 |
async fn stream_info(State(state): State<AppState>, Query(q): Query<StreamParams>) -> impl IntoResponse {
|
| 680 |
+
let _ = std::fs::remove_file("debug_dzmedia.log");
|
| 681 |
let formats = match q.format.as_deref().unwrap_or("AUTO") {
|
| 682 |
"FLAC" => vec![Format::FLAC, Format::MP3_320, Format::MP3_128],
|
| 683 |
"MP3_320" => vec![Format::MP3_320, Format::MP3_128],
|
|
|
|
| 686 |
_ => vec![Format::FLAC, Format::MP3_320, Format::MP3_128],
|
| 687 |
};
|
| 688 |
|
|
|
|
| 689 |
let requested = q.format.clone().unwrap_or_else(|| "AUTO".to_string());
|
| 690 |
let mut url: String = String::new();
|
| 691 |
let mut used: String = String::new();
|
|
|
|
| 763 |
((total_bytes as f64) * 8.0 / (duration as f64) / 1000.0).round() as u64
|
| 764 |
} else { 0 };
|
| 765 |
|
| 766 |
+
let log_data = std::fs::read_to_string("debug_dzmedia.log").unwrap_or_default();
|
| 767 |
+
|
| 768 |
(StatusCode::OK, Json(json!({
|
| 769 |
"id": q.id,
|
| 770 |
"requested": requested,
|
|
|
|
| 772 |
"duration": duration,
|
| 773 |
"bytes": total_bytes,
|
| 774 |
"bitrate_kbps": bitrate_kbps,
|
| 775 |
+
"mime": mime,
|
| 776 |
+
"log": log_data
|
| 777 |
}))).into_response()
|
| 778 |
}
|
| 779 |
|