Files
tuliprox/backend/src/processing/processor/xtream.rs
T

34 lines
1.2 KiB
Rust
Raw Normal View History

use std::sync::Arc;
2025-12-25 12:33:28 +01:00
use shared::error::{info_err};
use shared::error::{TuliproxError};
use crate::model::{AppConfig, ConfigInput, InputSource};
2025-12-25 12:33:28 +01:00
use shared::model::{PlaylistEntry, PlaylistItem, XtreamCluster};
2025-05-04 10:59:08 +02:00
use crate::utils::xtream;
2024-12-19 13:02:10 +01:00
2026-01-20 18:51:46 +01:00
pub(in crate::processing) async fn playlist_resolve_download_playlist_item(
app_config: &Arc<AppConfig>,
2026-01-20 18:51:46 +01:00
client: &reqwest::Client,
pli: &PlaylistItem,
input: &ConfigInput,
errors: &mut Vec<TuliproxError>,
resolve_delay: u16,
cluster: XtreamCluster,
) -> Option<String> {
2024-12-10 23:16:04 +01:00
let mut result = None;
2024-12-28 20:01:28 +01:00
let provider_id = pli.get_provider_id()?;
2025-02-05 20:01:49 +01:00
if let Some(info_url) = xtream::get_xtream_player_api_info_url(input, cluster, provider_id) {
2025-08-13 13:40:41 +02:00
let input_source = InputSource::from(input).with_url(info_url);
result = match xtream::get_xtream_stream_info_content(app_config, client, &input_source, true).await {
2024-12-10 23:16:04 +01:00
Ok(content) => Some(content),
Err(err) => {
errors.push(info_err!("{err}"));
2024-12-10 23:16:04 +01:00
None
}
};
}
if resolve_delay > 0 {
2025-03-11 14:56:10 +01:00
tokio::time::sleep(std::time::Duration::new(u64::from(resolve_delay), 0)).await;
2024-12-10 23:16:04 +01:00
}
result
}