mirror of
https://github.com/euzu/tuliprox.git
synced 2026-10-04 06:52:26 +02:00
Retry request from reverseproxy retry options
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use crate::model::{AppConfig, Config, ConfigFavourites, ConfigInput, ConfigRename, TVGuide};
|
||||
use crate::model::{AppConfig, Config, ConfigFavourites, ConfigInput, ConfigRename, ReverseProxyDisabledHeaderConfig, TVGuide};
|
||||
use crate::utils::m3u;
|
||||
use crate::utils::xtream;
|
||||
use crate::utils::{epg, StepMeasureCallback};
|
||||
@@ -318,7 +318,7 @@ async fn playlist_download_from_input(client: &reqwest::Client, app_config: &Arc
|
||||
|
||||
let (playlist, errors, persisted) = match input.input_type {
|
||||
InputType::M3u => {
|
||||
let (p, e) = m3u::download_m3u_playlist(client, config, input).await;
|
||||
let (p, e) = m3u::download_m3u_playlist(app_config, client, config, input).await;
|
||||
(p, e, false)
|
||||
}
|
||||
InputType::Xtream => xtream::download_xtream_playlist(app_config, client, input, clusters_to_download.as_deref()).await,
|
||||
@@ -458,7 +458,7 @@ async fn download_input_epg(ctx: &PlaylistProcessingContext, input: &Arc<ConfigI
|
||||
// Download epg for input
|
||||
let (tvguide, mut tvguide_errors) = if error_list.is_empty() {
|
||||
let working_dir = &ctx.config.config.load().working_dir;
|
||||
epg::get_xmltv(ctx, input, working_dir).await
|
||||
epg::get_xmltv(ctx, input, None, working_dir).await
|
||||
} else {
|
||||
(None, vec![])
|
||||
};
|
||||
@@ -541,6 +541,7 @@ pub struct PlaylistProcessingContext {
|
||||
pub user_targets: Arc<ProcessTargets>,
|
||||
pub event_manager: Option<Arc<EventManager>>,
|
||||
pub playlist_state: Option<Arc<PlaylistStorageState>>,
|
||||
pub disabled_headers: Option<ReverseProxyDisabledHeaderConfig>,
|
||||
|
||||
// Coordination
|
||||
processed_inputs: Arc<Mutex<HashSet<Arc<str>>>>,
|
||||
@@ -863,7 +864,8 @@ async fn process_watch(cfg: &Config, client: &reqwest::Client, target: &ConfigTa
|
||||
|
||||
pub async fn exec_processing(client: &reqwest::Client, app_config: Arc<AppConfig>, targets: Arc<ProcessTargets>,
|
||||
event_manager: Option<Arc<EventManager>>, playlist_state: Option<Arc<PlaylistStorageState>>,
|
||||
update_guard: Option<UpdateGuard>) {
|
||||
update_guard: Option<UpdateGuard>,
|
||||
disabled_headers: Option<ReverseProxyDisabledHeaderConfig>) {
|
||||
let _guard = if let Some(guard) = update_guard {
|
||||
if let Some(permit) = guard.try_playlist() {
|
||||
Some(permit)
|
||||
@@ -887,6 +889,7 @@ pub async fn exec_processing(client: &reqwest::Client, app_config: Arc<AppConfig
|
||||
playlist_state: playlist_state.clone(),
|
||||
processed_inputs: Arc::new(Mutex::new(HashSet::new())),
|
||||
input_locks: Arc::new(Mutex::new(HashMap::new())),
|
||||
disabled_headers,
|
||||
};
|
||||
|
||||
let start_time = Instant::now();
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
use std::sync::Arc;
|
||||
use shared::error::{info_err};
|
||||
use shared::error::{TuliproxError};
|
||||
use crate::model::{ConfigInput, InputSource};
|
||||
use crate::model::{AppConfig, ConfigInput, InputSource};
|
||||
use shared::model::{PlaylistEntry, PlaylistItem, XtreamCluster};
|
||||
use crate::utils::xtream;
|
||||
|
||||
pub(in crate::processing) async fn playlist_resolve_download_playlist_item(
|
||||
app_config: &Arc<AppConfig>,
|
||||
client: &reqwest::Client,
|
||||
pli: &PlaylistItem,
|
||||
input: &ConfigInput,
|
||||
errors: &mut Vec<TuliproxError>,
|
||||
resolve_delay: u16,
|
||||
cluster: XtreamCluster,
|
||||
default_user_agent: Option<&str>,
|
||||
) -> Option<String> {
|
||||
let mut result = None;
|
||||
let provider_id = pli.get_provider_id()?;
|
||||
if let Some(info_url) = xtream::get_xtream_player_api_info_url(input, cluster, provider_id) {
|
||||
let input_source = InputSource::from(input).with_url(info_url);
|
||||
result = match xtream::get_xtream_stream_info_content(client, &input_source, true, default_user_agent).await {
|
||||
result = match xtream::get_xtream_stream_info_content(app_config, client, &input_source, true).await {
|
||||
Ok(content) => Some(content),
|
||||
Err(err) => {
|
||||
errors.push(info_err!("{err}"));
|
||||
|
||||
@@ -48,7 +48,6 @@ async fn playlist_resolve_series_info(app_config: &Arc<AppConfig>, client: &reqw
|
||||
let mut processed_series_info_count = 0;
|
||||
let mut group_series: HashMap<u32, PlaylistGroup> = HashMap::new();
|
||||
let mut batch = Vec::with_capacity(BATCH_SIZE);
|
||||
let default_user_agent = app_config.config.load().default_user_agent.clone();
|
||||
|
||||
let input = fpl.input;
|
||||
for pli in fpl.items_mut() {
|
||||
@@ -66,13 +65,13 @@ async fn playlist_resolve_series_info(app_config: &Arc<AppConfig>, client: &reqw
|
||||
if should_download {
|
||||
processed_series_info_count += 1;
|
||||
if let Some(content) = playlist_resolve_download_playlist_item(
|
||||
app_config,
|
||||
client,
|
||||
pli,
|
||||
input,
|
||||
errors,
|
||||
resolve_delay,
|
||||
XtreamCluster::Series,
|
||||
default_user_agent.as_deref(),
|
||||
)
|
||||
.await
|
||||
{
|
||||
|
||||
@@ -41,7 +41,6 @@ pub async fn playlist_resolve_vod(app_config: &Arc<AppConfig>,
|
||||
let mut last_log_time = Instant::now();
|
||||
let mut processed_vod_info_count = 0;
|
||||
let mut batch = Vec::with_capacity(BATCH_SIZE);
|
||||
let default_user_agent = app_config.config.load().default_user_agent.clone();
|
||||
|
||||
provider_fpl.source.release_resources(XtreamCluster::Video);
|
||||
|
||||
@@ -56,13 +55,13 @@ pub async fn playlist_resolve_vod(app_config: &Arc<AppConfig>,
|
||||
processed_vod_info_count += 1;
|
||||
if provider_id != 0 {
|
||||
if let Some(content) = playlist_resolve_download_playlist_item(
|
||||
app_config,
|
||||
client,
|
||||
pli,
|
||||
input,
|
||||
errors,
|
||||
resolve_delay,
|
||||
XtreamCluster::Video,
|
||||
default_user_agent.as_deref(),
|
||||
)
|
||||
.await
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user