mirror of
https://github.com/euzu/tuliprox.git
synced 2026-10-18 13:52:20 +02:00
stream properties refactored
This commit is contained in:
@@ -89,102 +89,6 @@ async fn playlist_resolve_series_info(app_config: &Arc<AppConfig>, client: &reqw
|
||||
info!("resolved {processed_series_info_count}/{series_info_count} series info");
|
||||
result
|
||||
}
|
||||
//
|
||||
// async fn process_series_info(
|
||||
// app_config: &AppConfig,
|
||||
// fpl: &mut FetchedPlaylist<'_>,
|
||||
// errors: &mut Vec<TuliproxError>,
|
||||
// ) -> Vec<PlaylistGroup> {
|
||||
// let mut result: Vec<PlaylistGroup> = vec![];
|
||||
// let input = fpl.input;
|
||||
// let config = app_config.config.load();
|
||||
// let Ok(Some((info_path, idx_path))) = get_input_storage_path(&input.name, &config.working_dir)
|
||||
// .map(|storage_path| xtream_get_info_file_paths(&storage_path, XtreamCluster::Series))
|
||||
// else {
|
||||
// errors.push(notify_err!("Failed to open input info file for series".to_string()));
|
||||
// return result;
|
||||
// };
|
||||
//
|
||||
// let mut write_counter = 0usize;
|
||||
//
|
||||
// let _file_lock = app_config.file_locks.read_lock(&info_path).await;
|
||||
//
|
||||
// // Contains the Series Info with episode listing
|
||||
// let Ok(mut info_reader) = IndexedDocumentReader::<u32, String>::new(&info_path, &idx_path) else { return result; };
|
||||
//
|
||||
// let Some((mut wal_file, wal_path)) = create_resolve_episode_wal_files(&config, input).await else {
|
||||
// errors.push(notify_err!("Could not create wal file for series episodes record".to_string()));
|
||||
// return result;
|
||||
// };
|
||||
// let mut wal_writer = utils::async_file_writer(&mut wal_file);
|
||||
//
|
||||
// for plg in fpl
|
||||
// .playlistgroups
|
||||
// .iter_mut()
|
||||
// .filter(|plg| plg.xtream_cluster == XtreamCluster::Series)
|
||||
// {
|
||||
// let mut group_series = vec![];
|
||||
//
|
||||
// // Resolve does not handle LocalSeriesInfo
|
||||
// for pli in plg
|
||||
// .channels
|
||||
// .iter_mut()
|
||||
// .filter(|pli| pli.header.item_type == PlaylistItemType::SeriesInfo)
|
||||
// {
|
||||
// let Some(provider_id) = pli.header.get_provider_id() else { continue; };
|
||||
// let Ok(content) = info_reader.get(&provider_id) else { continue; };
|
||||
// if content.is_empty() {
|
||||
// warn!("Series info content is empty, skipping series with provider id: {provider_id}");
|
||||
// continue;
|
||||
// }
|
||||
// match serde_json::from_str::<SeriesStreamProperties>(&content) {
|
||||
// Ok(series_content) => {
|
||||
// let (group, series_name) = {
|
||||
// let header = &pli.header;
|
||||
// (header.group.clone(), if header.name.is_empty() { header.title.clone() } else { header.name.clone() })
|
||||
// };
|
||||
// if let Some(mut series) = parse_xtream_series_info(&series_content, &group, &series_name, input) {
|
||||
// for pli_episode in &mut series {
|
||||
// let Some(provider_id) = &pli_episode.header.get_provider_id() else { continue; };
|
||||
// match write_series_episode_record_to_wal_file(&mut wal_writer, *provider_id, pli.header.additional_properties.as_ref()).await {
|
||||
// Ok(written_bytes) => {
|
||||
// write_counter += written_bytes;
|
||||
// // periodic flush to bound BufWriter memory
|
||||
// if write_counter >= IO_BUFFER_SIZE {
|
||||
// write_counter = 0;
|
||||
// if let Err(err) = wal_writer.flush().await {
|
||||
// errors.push(notify_err!(format!("Failed periodic flush of wal content writer {err}")));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// Err(err) => { errors.push(info_err!(format!("Failed to write to series episode wal file: {err}"))) }
|
||||
// }
|
||||
// }
|
||||
// group_series.extend(series.into_iter());
|
||||
// }
|
||||
// }
|
||||
// Err(err) => errors.push(info_err!(format!("Failed to parse JSON: {err}"))),
|
||||
// }
|
||||
// }
|
||||
// if !group_series.is_empty() {
|
||||
// result.push(PlaylistGroup {
|
||||
// id: plg.id,
|
||||
// title: plg.title.clone(),
|
||||
// channels: group_series,
|
||||
// xtream_cluster: XtreamCluster::Series,
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// handle_error!(wal_writer.flush().await, |err| errors.push(notify_err!(format!("Failed to resolve series episodes, could not write to wal file {err}"))));
|
||||
// handle_error!(wal_writer.get_ref().sync_all().await, |err| errors.push(notify_err!(format!("Failed to sync series info to wal file {err}"))));
|
||||
//
|
||||
// drop(wal_writer);
|
||||
// drop(wal_file);
|
||||
// handle_error!(xtream_update_input_series_episodes_record_from_wal_file(app_config, input, &wal_path).await,
|
||||
// |err| errors.push(err));
|
||||
// result
|
||||
// }
|
||||
|
||||
pub async fn playlist_resolve_series(cfg: &Arc<AppConfig>,
|
||||
client: &reqwest::Client,
|
||||
|
||||
Reference in New Issue
Block a user