mirror of
https://github.com/euzu/tuliprox.git
synced 2026-10-09 01:12:23 +02:00
user editor form
This commit is contained in:
@@ -38,7 +38,7 @@ fn get_value(stack: &mut String, it: &mut std::str::Chars) -> String {
|
||||
stack.push(c);
|
||||
}
|
||||
|
||||
let result = (*stack).to_string();
|
||||
let result = (*stack).clone();
|
||||
stack.clear();
|
||||
result
|
||||
}
|
||||
@@ -67,7 +67,7 @@ fn token_till(stack: &mut String, it: &mut std::str::Chars, stop_char: char, sta
|
||||
if stack.is_empty() {
|
||||
None
|
||||
} else {
|
||||
let result = (*stack).to_string();
|
||||
let result = (*stack).clone();
|
||||
stack.clear();
|
||||
Some(result)
|
||||
}
|
||||
@@ -161,7 +161,7 @@ fn process_header(input_name: &str, video_suffixes: &[&str], content: &str, url:
|
||||
plih.id = chanid;
|
||||
}
|
||||
} else {
|
||||
plih.epg_channel_id = Some(plih.id.to_string());
|
||||
plih.epg_channel_id = Some(plih.id.clone());
|
||||
if let Some(pid) = provider_id {
|
||||
plih.id = pid;
|
||||
}
|
||||
@@ -266,7 +266,7 @@ where
|
||||
if let Some((cluster, group_title)) = channel.map(|pli|
|
||||
(pli.header.xtream_cluster, &pli.header.group)) {
|
||||
grp_id += 1;
|
||||
Some(PlaylistGroup { id: grp_id, xtream_cluster: cluster, title: group_title.to_string(), channels })
|
||||
Some(PlaylistGroup { id: grp_id, xtream_cluster: cluster, title: group_title.clone(), channels })
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ impl TVGuide {
|
||||
EPG_TAG_ICON => {
|
||||
if let Some(src) = child.get_attribute_value("src") {
|
||||
if !src.is_empty() {
|
||||
tag.icon = XmlTagIcon::Src(src.to_string());
|
||||
tag.icon = XmlTagIcon::Src(src.clone());
|
||||
child.icon = XmlTagIcon::Exists;
|
||||
}
|
||||
}
|
||||
@@ -207,7 +207,7 @@ impl TVGuide {
|
||||
let score = min(100, (jw * 100.0).round() as u16);
|
||||
score >= best_match_threshold
|
||||
}) {
|
||||
return (true, Some(good_enough.to_string()));
|
||||
return (true, Some(good_enough.clone()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -436,7 +436,7 @@ fn collect_tag_attributes(e: &BytesStart, is_channel: bool, is_program: bool) ->
|
||||
if value.is_empty() {
|
||||
None
|
||||
} else if (is_channel && key == EPG_ATTRIB_ID) || (is_program && key == EPG_ATTRIB_CHANNEL) {
|
||||
Some((key, value.to_lowercase().to_string()))
|
||||
Some((key, value.to_lowercase().clone()))
|
||||
} else {
|
||||
Some((key, value.to_string()))
|
||||
}
|
||||
|
||||
@@ -49,10 +49,10 @@ pub fn parse_xtream_series_info(info: &Value, group_title: &str, series_name: &s
|
||||
(episode.clone(),
|
||||
PlaylistItem {
|
||||
header: PlaylistItemHeader {
|
||||
id: episode.id.to_string(),
|
||||
id: episode.id.clone(),
|
||||
uuid: generate_playlist_uuid(&input.name, &episode.id, PlaylistItemType::Series, &episode_url),
|
||||
name: series_name.to_string(),
|
||||
logo: episode.info.as_ref().map_or_else(String::new, |info| info.movie_image.to_string()),
|
||||
logo: episode.info.as_ref().map_or_else(String::new, |info| info.movie_image.clone()),
|
||||
group: group_title.to_string(),
|
||||
title: episode.title.clone(),
|
||||
url: episode_url.to_string(),
|
||||
@@ -60,7 +60,7 @@ pub fn parse_xtream_series_info(info: &Value, group_title: &str, series_name: &s
|
||||
xtream_cluster: XtreamCluster::Series,
|
||||
additional_properties: episode.get_additional_properties(&series_info),
|
||||
category_id: 0,
|
||||
input_name: input.name.to_string(),
|
||||
input_name: input.name.clone(),
|
||||
..Default::default()
|
||||
}
|
||||
})
|
||||
@@ -104,7 +104,7 @@ pub fn create_xtream_url(xtream_cluster: XtreamCluster, url: &str, username: &st
|
||||
stream.container_extension.as_ref().map(std::string::ToString::to_string).as_ref(),
|
||||
live_stream_use_prefix, live_stream_without_extension)
|
||||
} else {
|
||||
stream.direct_source.to_string()
|
||||
stream.direct_source.clone()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ pub fn parse_xtream(input: &ConfigInput,
|
||||
streams: &Value) -> Result<Option<Vec<PlaylistGroup>>, TuliproxError> {
|
||||
match map_to_xtream_category(categories) {
|
||||
Ok(xtream_categories) => {
|
||||
let input_name = Arc::new(input.name.to_string());
|
||||
let input_name = Arc::new(input.name.clone());
|
||||
let url = input.url.as_str();
|
||||
let username = input.username.as_ref().map_or("", |v| v);
|
||||
let password = input.password.as_ref().map_or("", |v| v);
|
||||
@@ -123,7 +123,7 @@ pub fn parse_xtream(input: &ConfigInput,
|
||||
Ok(mut xtream_streams) => {
|
||||
let mut group_map: HashMap<String, XtreamCategory> =
|
||||
xtream_categories.into_iter().map(|category|
|
||||
(category.category_id.to_string(), category)
|
||||
(category.category_id.clone(), category)
|
||||
).collect();
|
||||
let mut unknown_grp = XtreamCategory {
|
||||
category_id: "0".to_string(),
|
||||
@@ -152,11 +152,11 @@ pub fn parse_xtream(input: &ConfigInput,
|
||||
header: PlaylistItemHeader {
|
||||
id: stream.get_stream_id().to_string(),
|
||||
uuid: generate_playlist_uuid(&input_name, &stream.get_stream_id().to_string(), item_type, &stream_url),
|
||||
name: stream.name.to_string(),
|
||||
logo: stream.stream_icon.to_string(),
|
||||
group: category_name.to_string(),
|
||||
title: stream.name.to_string(),
|
||||
url: stream_url.to_string(),
|
||||
name: stream.name.clone(),
|
||||
logo: stream.stream_icon.clone(),
|
||||
group: category_name.clone(),
|
||||
title: stream.name.clone(),
|
||||
url: stream_url.clone(),
|
||||
epg_channel_id: stream.epg_channel_id.clone(),
|
||||
item_type,
|
||||
xtream_cluster,
|
||||
@@ -178,7 +178,7 @@ pub fn parse_xtream(input: &ConfigInput,
|
||||
PlaylistGroup {
|
||||
id: category.category_id.parse::<u32>().unwrap_or(0),
|
||||
xtream_cluster,
|
||||
title: category.category_name.to_string(),
|
||||
title: category.category_name.clone(),
|
||||
channels: category.channels.clone(),
|
||||
}
|
||||
}).collect()))
|
||||
|
||||
@@ -12,7 +12,7 @@ pub fn process_group_watch(client: &Arc<reqwest::Client>, cfg: &Config, target_n
|
||||
let mut new_tree = BTreeSet::new();
|
||||
pl.channels.iter().for_each(|chan| {
|
||||
let header = &chan.header;
|
||||
let title = if header.title.is_empty() { header.title.to_string() } else { header.name.to_string() };
|
||||
let title = if header.title.is_empty() { header.title.clone() } else { header.name.clone() };
|
||||
new_tree.insert(title);
|
||||
});
|
||||
|
||||
|
||||
@@ -75,9 +75,9 @@ impl EpgIdCache<'_> {
|
||||
let normalized = self.normalize(key);
|
||||
let phonetic = self.phonetic(&normalized);
|
||||
|
||||
self.normalized.insert(normalized.to_string(), None);
|
||||
self.normalized.insert(normalized.clone(), None);
|
||||
self.phonetics
|
||||
.entry(phonetic.to_string())
|
||||
.entry(phonetic.clone())
|
||||
.or_default()
|
||||
.insert(normalized);
|
||||
}
|
||||
@@ -196,13 +196,13 @@ fn assign_channel_epg(new_epg: &mut Vec<Epg>, fp: &mut FetchedPlaylist, id_cache
|
||||
(epg_source.logo_override || chan.header.logo.is_empty() || chan.header.logo_small.is_empty()) {
|
||||
if let Some(icon_tag) = icon_tags.get(epg_channel_id) {
|
||||
if let XmlTagIcon::Src(icon) = &icon_tag.icon {
|
||||
icon_assigned.insert(epg_channel_id.to_string());
|
||||
icon_assigned.insert(epg_channel_id.clone());
|
||||
if epg_source.logo_override || chan.header.logo.is_empty() {
|
||||
trace!("Matched channel {} to epg icon {icon}", chan.header.name);
|
||||
chan.header.logo = (*icon).to_string();
|
||||
chan.header.logo = (*icon).clone();
|
||||
}
|
||||
if epg_source.logo_override || chan.header.logo_small.is_empty() {
|
||||
chan.header.logo_small = (*icon).to_string();
|
||||
chan.header.logo_small = (*icon).clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ fn map_channel(mut channel: PlaylistItem, mapping: &Mapping) -> PlaylistItem {
|
||||
if let Some(mapper) = &mapping.mapper {
|
||||
if !mapper.is_empty() {
|
||||
let header = &channel.header;
|
||||
let channel_name = if mapping.match_as_ascii { deunicode(&header.name) } else { header.name.to_string() };
|
||||
let channel_name = if mapping.match_as_ascii { deunicode(&header.name) } else { header.name.clone() };
|
||||
if mapping.match_as_ascii && log_enabled!(Level::Trace) { trace!("Decoded {} for matching to {}", &header.name, &channel_name); }
|
||||
let ref_chan = &mut channel;
|
||||
let templates = mapping.templates.as_ref();
|
||||
@@ -172,7 +172,7 @@ fn map_playlist(playlist: &mut [PlaylistGroup], target: &ConfigTarget) -> Option
|
||||
grp_id += 1;
|
||||
new_groups.push(PlaylistGroup {
|
||||
id: grp_id,
|
||||
title: title.to_string(),
|
||||
title: title.clone(),
|
||||
channels: vec![channel.clone()],
|
||||
xtream_cluster: *cluster,
|
||||
});
|
||||
@@ -287,7 +287,7 @@ async fn process_source(client: Arc<reqwest::Client>, cfg: Arc<AppConfig>, sourc
|
||||
);
|
||||
}
|
||||
let elapsed = start_time.elapsed().as_secs();
|
||||
input_stats.insert(input_name.to_string(), create_input_stat(group_count, channel_count, error_list.len(),
|
||||
input_stats.insert(input_name.clone(), create_input_stat(group_count, channel_count, error_list.len(),
|
||||
input.input_type, input_name, elapsed));
|
||||
}
|
||||
}
|
||||
@@ -443,7 +443,7 @@ fn flatten_groups(playlistgroups: Vec<PlaylistGroup>) -> Vec<PlaylistGroup> {
|
||||
let mut idx: usize = 0;
|
||||
let mut group_map: HashMap<(String, XtreamCluster), usize> = HashMap::new();
|
||||
for group in playlistgroups {
|
||||
let key = (group.title.to_string(), group.xtream_cluster);
|
||||
let key = (group.title.clone(), group.xtream_cluster);
|
||||
match group_map.entry(key) {
|
||||
std::collections::hash_map::Entry::Vacant(v) => {
|
||||
v.insert(idx);
|
||||
|
||||
@@ -95,8 +95,8 @@ fn playlist_comparator(
|
||||
}
|
||||
|
||||
fn playlistgroup_comparator(a: &PlaylistGroup, b: &PlaylistGroup, group_sort: &ConfigSortGroup, match_as_ascii: bool) -> Ordering {
|
||||
let value_a = if match_as_ascii { deunicode(&a.title) } else { a.title.to_string() };
|
||||
let value_b = if match_as_ascii { deunicode(&b.title) } else { b.title.to_string() };
|
||||
let value_a = if match_as_ascii { deunicode(&a.title) } else { a.title.clone() };
|
||||
let value_b = if match_as_ascii { deunicode(&b.title) } else { b.title.clone() };
|
||||
|
||||
playlist_comparator(group_sort.sequence.as_ref(), group_sort.order, &value_a, &value_b)
|
||||
}
|
||||
@@ -125,7 +125,7 @@ pub(in crate::processing::processor) fn sort_playlist(target: &ConfigTarget, new
|
||||
for channel_sort in channel_sorts {
|
||||
let regexp = &channel_sort.group_pattern;
|
||||
for group in new_playlist.iter_mut() {
|
||||
let group_title = if match_as_ascii { deunicode(&group.title) } else { group.title.to_string() };
|
||||
let group_title = if match_as_ascii { deunicode(&group.title) } else { group.title.clone() };
|
||||
if regexp.is_match(group_title.as_str()) {
|
||||
group.channels.sort_by(|chan1, chan2| playlistitem_comparator(chan1, chan2, channel_sort, match_as_ascii));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user