added some events for playlist update,

fixed explorer view image display for channels
This commit is contained in:
euzu
2025-12-30 12:31:55 +01:00
parent c0185ed8b9
commit b3a7e6af7c
7 changed files with 65 additions and 12 deletions
+16 -2
View File
@@ -267,6 +267,16 @@ async fn process_source(client: &reqwest::Client, app_config: Arc<AppConfig>, so
let mut target_stats = Vec::<TargetStats>::new();
if let Some(source) = sources.get_source_at(source_idx) {
let mut source_playlists = Vec::with_capacity(128);
let broadcast_step = {
let event_manager = event_manager.clone();
move |context: &str, msg: &str| {
if let Some(events) = &event_manager {
events.send_event(EventMessage::PlaylistUpdateProgress(context.to_owned(), msg.to_owned()));
}
}
};
// Download the sources
let mut source_downloaded = false;
for input in &source.inputs {
@@ -275,9 +285,12 @@ async fn process_source(client: &reqwest::Client, app_config: Arc<AppConfig>, so
let start_time = Instant::now();
// Download playlist for input
let (playlistgroups, mut error_list) = {
broadcast_step("Playlist download", &format!("Downloading input '{}'", input.name));
let (downloaded_playlist, mut download_err) = playlist_download_from_input(client, &app_config, input).await;
broadcast_step("Playlist download", &format!("Persisting input '{}' playlist", input.name));
let (playlist, error) = persist_input_playlist(&app_config, input, downloaded_playlist).await;
if let Some(err) = error {
broadcast_step("Playlist download", &format!("Failed to persist input '{}' playlist", input.name));
error!("Failed to persist input playlist {}", input.name);
download_err.push(err);
}
@@ -286,6 +299,7 @@ async fn process_source(client: &reqwest::Client, app_config: Arc<AppConfig>, so
// Download epg for input
let (tvguide, mut tvguide_errors) = if error_list.is_empty() {
broadcast_step("Playlist download", &format!("Downloading epg for input '{}'", input.name));
let working_dir = &app_config.config.load().working_dir;
epg::get_xmltv(client, input, working_dir).await
} else {
@@ -298,6 +312,7 @@ async fn process_source(client: &reqwest::Client, app_config: Arc<AppConfig>, so
let channel_count = playlistgroups.iter().map(|group| group.channels.len()).sum();
let input_name = &input.name;
if playlistgroups.is_empty() {
broadcast_step("Playlist download", &format!("Input '{}' playlist is empty", input.name));
info!("Source is empty {input_name}");
errors.push(notify_err!(format!("Source is empty {input_name}")));
} else {
@@ -513,7 +528,7 @@ async fn process_playlist_for_target(app_config: &Arc<AppConfig>,
let mut step = StepMeasure::new(&target.name, broadcast_step);
for provider_fpl in playlists.iter_mut() {
let mut processed_fpl = execute_pipe(target, &pipe, provider_fpl, &mut duplicates);
playlist_resolve_series(app_config, client, target, errors, &pipe, provider_fpl, &mut processed_fpl).await;
playlist_resolve_series(app_config, client, target, errors, &pipe, provider_fpl, &mut processed_fpl, &step).await;
playlist_resolve_vod(app_config, client, target, errors, &mut processed_fpl).await;
// stats
let input_stats = stats.get_mut(&processed_fpl.input.name);
@@ -531,7 +546,6 @@ async fn process_playlist_for_target(app_config: &Arc<AppConfig>,
process_favourites(&mut new_playlist, target.favourites.as_deref());
if new_playlist.is_empty() {
step.stop("");
info!("Playlist is empty: {}", &target.name);
@@ -12,6 +12,7 @@ use shared::model::{InputType, PlaylistEntry, SeriesStreamProperties, StreamProp
use shared::model::{PlaylistGroup, PlaylistItemType, XtreamCluster};
use std::sync::Arc;
use std::time::Instant;
use crate::utils::StepMeasure;
create_resolve_options_function_for_xtream_target!(series);
@@ -101,12 +102,15 @@ pub async fn playlist_resolve_series(cfg: &Arc<AppConfig>,
pipe: &ProcessingPipe,
provider_fpl: &mut FetchedPlaylist<'_>,
processed_fpl: &mut FetchedPlaylist<'_>,
step: &StepMeasure,
) {
let (resolve_series, resolve_delay) = get_resolve_series_options(target, processed_fpl);
if !resolve_series { return; }
step.broadcast("Playlist resolve series info", "Resolving series info");
let series_playlist = playlist_resolve_series_info(cfg, client, errors, processed_fpl, resolve_delay).await;
if series_playlist.is_empty() { return; }
step.broadcast("Playlist resolve series info", "Series info resolved, updating playlist");
// original content saved into original list
for plg in &series_playlist {
provider_fpl.update_playlist(plg);
@@ -10,10 +10,14 @@ use shared::model::{InputType, PlaylistEntry, StreamProperties, VideoStreamPrope
use shared::model::{PlaylistItemType, XtreamCluster};
use std::sync::Arc;
use std::time::Instant;
use crate::utils::StepMeasure;
create_resolve_options_function_for_xtream_target!(vod);
pub async fn playlist_resolve_vod(app_config: &Arc<AppConfig>, client: &reqwest::Client, target: &ConfigTarget, errors: &mut Vec<TuliproxError>, fpl: &mut FetchedPlaylist<'_>) {
pub async fn playlist_resolve_vod(app_config: &Arc<AppConfig>, client: &reqwest::Client,
target: &ConfigTarget, errors: &mut Vec<TuliproxError>,
fpl: &mut FetchedPlaylist<'_>,
step: &StepMeasure,) {
let (resolve_movies, resolve_delay) = get_resolve_vod_options(target, fpl);
if !resolve_movies { return; }