mirror of
https://github.com/euzu/tuliprox.git
synced 2026-10-04 23:12:27 +02:00
Integrate local movie file into playlist
This commit is contained in:
@@ -61,10 +61,10 @@ fn to_playlist_item(entry: &MetadataCacheEntry, input_name: &str, group_name: &s
|
||||
let raw = serde_json::to_string(&info).ok()?;
|
||||
RawValue::from_string(raw).ok()
|
||||
});
|
||||
(XtreamCluster::Video, PlaylistItemType::Video, add_props)
|
||||
(XtreamCluster::Video, PlaylistItemType::LocalVideo, add_props)
|
||||
}
|
||||
MediaMetadata::Series(_s) => {
|
||||
(XtreamCluster::Series, PlaylistItemType::SeriesInfo, None)
|
||||
(XtreamCluster::Series, PlaylistItemType::LocalSeriesInfo, None)
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -142,7 +142,14 @@ pub fn metadata_cache_entry_to_xtream_movie_info(
|
||||
backdrop_path: movie
|
||||
.fanart
|
||||
.as_ref()
|
||||
.filter(|s| !s.is_empty())
|
||||
.map(|f| vec![f.clone()])
|
||||
.or_else(|| {
|
||||
movie.poster
|
||||
.as_ref()
|
||||
.filter(|s| !s.is_empty())
|
||||
.map(|p| vec![p.clone()])
|
||||
})
|
||||
.unwrap_or_default(),
|
||||
|
||||
duration_secs: movie.runtime.map(|r| (r * 60).to_string()),
|
||||
@@ -159,7 +166,7 @@ pub fn metadata_cache_entry_to_xtream_movie_info(
|
||||
|
||||
rating: movie.rating.map(|r| format!("{r:.2}")),
|
||||
runtime: movie.runtime.map(|r| (r * 60).to_string()),
|
||||
status: None,
|
||||
status: Some("Released".to_string()),
|
||||
};
|
||||
|
||||
let movie_data = XtreamMovieData {
|
||||
@@ -168,8 +175,8 @@ pub fn metadata_cache_entry_to_xtream_movie_info(
|
||||
|
||||
added: Some(entry.file_modified.to_string()),
|
||||
|
||||
category_id: None,
|
||||
category_ids: Vec::new(),
|
||||
category_id: 0,
|
||||
category_ids: vec![0],
|
||||
|
||||
container_extension,
|
||||
custom_sid: None,
|
||||
|
||||
@@ -46,7 +46,12 @@ fn extract_tmdb_id_from_playlist_item(item: &PlaylistItem) -> Option<u32> {
|
||||
.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));
|
||||
.or_else(|| {
|
||||
props.get("info")
|
||||
.and_then(|info| info.get("tmdb_id"))
|
||||
.and_then(get_u32_from_serde_value)
|
||||
.filter(|&id| id != 0)
|
||||
});
|
||||
}
|
||||
}
|
||||
None
|
||||
|
||||
@@ -67,7 +67,7 @@ async fn playlist_resolve_series_info(cfg: &AppConfig, client: &reqwest::Client,
|
||||
let series_info_count = fpl.playlistgroups.iter()
|
||||
.filter(|&plg| plg.xtream_cluster == XtreamCluster::Series)
|
||||
.flat_map(|plg| &plg.channels)
|
||||
.filter(|&pli| pli.header.item_type == PlaylistItemType::SeriesInfo).count();
|
||||
.filter(|&pli| matches!(pli.header.item_type, PlaylistItemType::SeriesInfo | PlaylistItemType::LocalSeriesInfo)).count();
|
||||
|
||||
|
||||
info!("Found {series_info_count} series info to resolve");
|
||||
@@ -80,7 +80,7 @@ async fn playlist_resolve_series_info(cfg: &AppConfig, client: &reqwest::Client,
|
||||
continue;
|
||||
}
|
||||
for pli in &mut plg.channels {
|
||||
if pli.header.item_type != PlaylistItemType::SeriesInfo {
|
||||
if !matches!(pli.header.item_type, PlaylistItemType::SeriesInfo | PlaylistItemType::LocalSeriesInfo) {
|
||||
continue;
|
||||
}
|
||||
let (should_update, provider_id, ts) = should_update_series_info(pli, &processed_info_ids);
|
||||
@@ -179,7 +179,7 @@ async fn process_series_info(
|
||||
for pli in plg
|
||||
.channels
|
||||
.iter_mut()
|
||||
.filter(|pli| pli.header.item_type == PlaylistItemType::SeriesInfo)
|
||||
.filter(|pli| matches!(pli.header.item_type, PlaylistItemType::SeriesInfo | PlaylistItemType::LocalSeriesInfo))
|
||||
{
|
||||
let Some(provider_id) = pli.header.get_provider_id() else { continue; };
|
||||
let Ok(content) = info_reader.get(&provider_id) else { continue; };
|
||||
|
||||
Reference in New Issue
Block a user