fn uniqify(media: &mut Vec<ExtXMedia>) {

    let mut hm = HashMap::new();
    let mut idx = 0;
    while idx < media.len() {
        // XXX remove all tracks with "Commentary" in them. There is a main
        // track in the same language, and duplicate tracks with the same
        // language and the same codec confuse many players.
        if media[idx].name.contains("Commentary") {
            media.remove(idx);
            continue;
        }
        let e = hm.entry(media[idx].name.clone()).or_insert(Vec::new());
        e.push(idx);
        idx += 1;
    }
    let dups: Vec<_> = hm.drain().map(|e| e.1).filter(|v| v.len() > 1).collect();

    for indexes in dups {
        let mut n = 1;
        for idx in indexes {
            media[idx].name += &format!(" #{}", n);
            n += 1;
        }
    }
}
// If there are entries with the same name, add #1, #2 etc to the name to make them unique.
If there are entries with the same name, add #1, #2 etc to the name to make them unique.
If there are entries with the same name add #1 #2 etc to the name to make them unique .
fn uniqify(media: &mut Vec<ExtXMedia>) {
    let mut hm = HashMap::new();
    let mut idx = 0;
    while idx < media.len() {
        // XXX remove all tracks with "Commentary" in them. There is a main
        // track in the same language, and duplicate tracks with the same
        // language and the same codec confuse many players.
        if media[idx].name.contains("Commentary") {
            media.remove(idx);
            continue;
        }
        let e = hm.entry(media[idx].name.clone()).or_insert(Vec::new());
        e.push(idx);
        idx += 1;
    }
    let dups: Vec<_> = hm.drain().map(|e| e.1).filter(|v| v.len() > 1).collect();
    for indexes in dups {
        let mut n = 1;
        for idx in indexes {
            media[idx].name += &format!(" #{}", n);
            n += 1;
        }
    }
}
fn uniqify ( media : & mut Vec < ExtXMedia > ) { let mut hm = HashMap :: new ( ) ; let mut idx = 0 ; while idx < media . len ( ) { // XXX remove all tracks with "Commentary" in them. There is a main // track in the same language, and duplicate tracks with the same // language and the same codec confuse many players. if media [ idx ] . name . contains ( " " ) { media . remove ( idx ) ; continue ; } let e = hm . entry ( media [ idx ] . name . clone ( ) ) . or_insert ( Vec :: new ( ) ) ; e . push ( idx ) ; idx += 1 ; } let dups : Vec < _ > = hm . drain ( ) . map ( | e | e . 1 ) . filter ( | v | v . len ( ) > 1 ) . collect ( ) ; for indexes in dups { let mut n = 1 ; for idx in indexes { media [ idx ] . name += & format ! ( " " n ) ; n += 1 ; } } }
If there are entries with the same name, add #1, #2 etc to the name to make them unique.
If there are entries with the same name add #1 #2 etc to the name to make them unique .
media
&mut Vec<ExtXMedia>
media
&mut Vec<ExtXMedia>