mirror of
https://github.com/euzu/tuliprox.git
synced 2026-10-20 06:42:20 +02:00
Feature/ffprobe piped from reqwest (#734)
* fix: video and audio deserialization for db dump * fix: resolve proivder feature for redirect mode * fix: enable seek feature for ffprobe on large vod and series elements * fix: keep seekable ffprobe probes bounded
This commit is contained in:
@@ -61,6 +61,10 @@ fn requires_provider_connection_for_generic_probe(input_type: InputType) -> bool
|
||||
!matches!(input_type, InputType::Library)
|
||||
}
|
||||
|
||||
fn uses_seekable_remote_probe(item_type: PlaylistItemType, is_remote_probe: bool) -> bool {
|
||||
is_remote_probe && !item_type.is_live()
|
||||
}
|
||||
|
||||
/// Updates metadata (Probing) for a stream URL (M3U, Xtream, Library) and persists it.
|
||||
/// - `unique_id`: For M3U this is the `provider_id` (String). For Library this is the `UUID` string.
|
||||
/// For Xtream this is the numeric provider id as string.
|
||||
@@ -243,7 +247,19 @@ async fn prepare_generic_stream_metadata(
|
||||
acquired_handle.as_ref().and_then(ProbeHandleGuard::handle),
|
||||
active_handle,
|
||||
);
|
||||
let probe_data = if is_remote_probe {
|
||||
let probe_data = if uses_seekable_remote_probe(item_type, is_remote_probe) {
|
||||
FfmpegExecutor::new()
|
||||
.probe_remote_seekable_url_with_cancel(
|
||||
client,
|
||||
&probe_url,
|
||||
user_agent.as_deref(),
|
||||
analyze_duration,
|
||||
probe_size,
|
||||
ffprobe_timeout,
|
||||
cancel_token,
|
||||
)
|
||||
.await
|
||||
} else if is_remote_probe {
|
||||
FfmpegExecutor::new()
|
||||
.probe_remote_url_with_cancel(
|
||||
client,
|
||||
@@ -534,6 +550,15 @@ mod tests {
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn seekable_remote_probe_is_used_only_for_remote_non_live_items() {
|
||||
assert!(!uses_seekable_remote_probe(PlaylistItemType::Live, true));
|
||||
assert!(!uses_seekable_remote_probe(PlaylistItemType::LiveUnknown, true));
|
||||
assert!(uses_seekable_remote_probe(PlaylistItemType::Video, true));
|
||||
assert!(uses_seekable_remote_probe(PlaylistItemType::Series, true));
|
||||
assert!(!uses_seekable_remote_probe(PlaylistItemType::Video, false));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn update_properties_applies_probe_stats_to_video_details() {
|
||||
let mut props_opt = None;
|
||||
|
||||
@@ -990,7 +990,7 @@ pub async fn update_series_metadata(
|
||||
.ok()
|
||||
.is_some_and(|u| matches!(u.scheme(), "http" | "https"));
|
||||
let probe_result = if is_remote_probe {
|
||||
FfmpegExecutor::new().probe_remote_url_with_cancel(
|
||||
FfmpegExecutor::new().probe_remote_seekable_url_with_cancel(
|
||||
client,
|
||||
probe_url.as_ref(),
|
||||
user_agent.as_deref(),
|
||||
|
||||
@@ -880,7 +880,7 @@ pub async fn update_vod_metadata(
|
||||
.ok()
|
||||
.is_some_and(|u| matches!(u.scheme(), "http" | "https"));
|
||||
let probe_result = if is_remote_probe {
|
||||
FfmpegExecutor::new().probe_remote_url_with_cancel(
|
||||
FfmpegExecutor::new().probe_remote_seekable_url_with_cancel(
|
||||
client,
|
||||
probe_url.as_ref(),
|
||||
user_agent.as_deref(),
|
||||
|
||||
Reference in New Issue
Block a user