pub fn read_file(&mut self, file: PathBuf) {
        if !file.exists() || !file.is_file() {
            return;
        }
        let parent = get_parent_dir(&file);
        if let Ok(f) = File::open(&file) {
            for l in BufReader::new(f).lines() {
                if let Ok(line) = l {
                    let path = PathBuf::from(line);
                    if path.is_absolute() && file.is_absolute() {
                        self.add_relative(path, &parent);
                    } else {
                        self.add(parent.join(&path), get_artist(&path));
                    }
                }
            }
        }
    }
// Read and add files from a file (e.g. playlist)
Read and add files from a file
Read and add files from a file
pub fn read_file(&mut self, file: PathBuf) {
        if !file.exists() || !file.is_file() {
            return;
        }
        let parent = get_parent_dir(&file);
        if let Ok(f) = File::open(&file) {
            for l in BufReader::new(f).lines() {
                if let Ok(line) = l {
                    let path = PathBuf::from(line);
                    if path.is_absolute() && file.is_absolute() {
                        self.add_relative(path, &parent);
                    } else {
                        self.add(parent.join(&path), get_artist(&path));
                    }
                }
            }
        }
    }
pub fn read_file ( & mut self , file : PathBuf ) { if ! file . exists ( ) || ! file . is_file ( ) { return ; } let parent = get_parent_dir ( & file ) ; if let Ok ( f ) = File :: open ( & file ) { for l in BufReader :: new ( f ) . lines ( ) { if let Ok ( line ) = l { let path = PathBuf :: from ( line ) ; if path . is_absolute ( ) && file . is_absolute ( ) { self . add_relative ( path , & parent ) ; } else { self . add ( parent . join ( & path ) , get_artist ( & path ) ) ; } } } } }
Read and add files from a file (e.g.
Read and add files from a file ( e . g .
&mut self
file
PathBuf
&mut self
file
PathBuf