set correct playlist plath, get playlist in read mode

This commit is contained in:
jb-alvarado 2022-04-02 22:02:09 +02:00
parent e184003e67
commit f023445d60

View File

@ -62,6 +62,7 @@ pub fn read_json(
let mut current_file: String = playlist_path.as_path().display().to_string(); let mut current_file: String = playlist_path.as_path().display().to_string();
if let Some(p) = path { if let Some(p) = path {
playlist_path = Path::new(&p).to_owned();
current_file = p current_file = p
} }
@ -73,7 +74,11 @@ pub fn read_json(
info!("Read Playlist: <b><magenta>{}</></b>", &current_file); info!("Read Playlist: <b><magenta>{}</></b>", &current_file);
let f = File::open(&current_file).expect("Could not open json playlist file."); let f = File::options()
.read(true)
.write(false)
.open(&current_file)
.expect("Could not open json playlist file.");
let mut playlist: Playlist = let mut playlist: Playlist =
serde_json::from_reader(f).expect("Could not read json playlist file."); serde_json::from_reader(f).expect("Could not read json playlist file.");