diff --git a/src/model/mapping.rs b/src/model/mapping.rs index 0139d9a68..14736a864 100644 --- a/src/model/mapping.rs +++ b/src/model/mapping.rs @@ -289,9 +289,6 @@ impl MappingValueProcessor<'_> { let attr_re = &mapper.t_attre.as_ref().unwrap(); let attributes = &mapper.attributes; for (key, value) in attributes { - if key == "chno" { - println!("chno: {}", value); - } if value.contains('<') { // possible replacement let replaced = attr_re.replace_all(value, |captures: ®ex::Captures| { let capture_name = &captures[1]; diff --git a/src/processing/processor/playlist.rs b/src/processing/processor/playlist.rs index a230cd563..36326ecd5 100644 --- a/src/processing/processor/playlist.rs +++ b/src/processing/processor/playlist.rs @@ -131,11 +131,20 @@ fn sort_playlist(target: &ConfigTarget, new_playlist: &mut [PlaylistGroup]) { } fn channel_no_playlist(new_playlist: &mut [PlaylistGroup]) { + let assigned_chnos: HashSet = new_playlist.iter().flat_map(|g| &g.channels) + .filter(|c| !c.header.chno.is_empty()) + .map(|c|c.header.chno.as_str()).map(str::parse::) + .flatten().collect(); let mut chno = 1; for group in new_playlist { for chan in &mut group.channels { - chan.header.chno = chno.to_string(); - chno += 1; + if chan.header.chno.is_empty() { + while assigned_chnos.contains(&chno) { + chno += 1; + } + chan.header.chno = chno.to_string(); + chno += 1; + } } } }