Merge branch 'feature/source_editor' into feature/local_media

This commit is contained in:
euzu
2025-12-13 15:34:51 +01:00
22 changed files with 141 additions and 118 deletions
+1 -3
View File
@@ -340,9 +340,7 @@ async fn process_source(client: &reqwest::Client, cfg: Arc<AppConfig>, source_id
errors.append(&mut error_list);
errors.append(&mut tvguide_errors);
let group_count = playlistgroups.len();
let channel_count = playlistgroups.iter()
.map(|group| group.channels.len())
.sum();
let channel_count = playlistgroups.iter().map(|group| group.channels.len()).sum();
let input_name = &input.name;
if playlistgroups.is_empty() {
info!("Source is empty {input_name}");
+7 -8
View File
@@ -40,14 +40,13 @@ fn is_compatible_content_type(cluster: XtreamCluster, content_type: TraktContent
/// Extract TMDB ID from playlist item
fn extract_tmdb_id_from_playlist_item(item: &PlaylistItem) -> Option<u32> {
if let Some(additional_props) = &item.header.additional_properties {
if let Some(props_str) = additional_props.as_str() {
if let Ok(props) = serde_json::from_str::<serde_json::Map<String, serde_json::Value>>(props_str) {
return props
.get("tmdb_id")
.and_then(get_u32_from_serde_value)
.filter(|&id| id != 0)
.or_else(|| props.get("tmdb").and_then(get_u32_from_serde_value));
}
let props_str = additional_props.get();
if let Ok(props) = serde_json::from_str::<serde_json::Map<String, serde_json::Value>>(props_str) {
return props
.get("tmdb_id")
.and_then(get_u32_from_serde_value)
.filter(|&id| id != 0)
.or_else(|| props.get("tmdb").and_then(get_u32_from_serde_value));
}
}
None
@@ -8,11 +8,12 @@ use crate::repository::xtream_repository::{write_vod_info_to_wal_file, xtream_up
use shared::error::{notify_err};
use crate::processing::processor::{handle_error, handle_error_and_return, create_resolve_options_function_for_xtream_target};
use shared::utils::{get_u32_from_serde_value, get_u64_from_serde_value, get_string_from_serde_value};
use serde_json::{from_str, Map, Value};
use serde_json::{Map, Value};
use std::collections::{HashMap, HashSet};
use std::io::{Write};
use std::time::Instant;
use log::{info, log_enabled, Level};
use serde_json::value::RawValue;
use crate::utils;
use crate::processing::processor::xtream::normalize_json_content;
use crate::utils::IO_BUFFER_SIZE;
@@ -123,13 +124,13 @@ pub async fn playlist_resolve_vod(app_config: &AppConfig, client: &reqwest::Clie
// Update in-memory playlist items with the newly fetched vod info.
// This makes the data available for subsequent processing steps like STRM export.
pli.header.additional_properties = from_str::<Map<String, Value>>(normalized_str).ok().and_then(|info_doc| {
info_doc.get("info").cloned().map(|info_content| {
let mut wrapped_info = Map::new();
wrapped_info.insert("info".to_string(), info_content);
Value::Object(wrapped_info)
})
});
if let Ok(value) = serde_json::from_str::<Value>(normalized_str) {
if let Some(info_content) = value.get("info") {
if let Ok(raw_info) = serde_json::to_string(info_content) {
pli.header.additional_properties = serde_json::from_str::<Box<RawValue>>(&raw_info).ok();
}
}
}
}
}
}