mini-player: wip
This commit is contained in:
parent
db3c7657a3
commit
4611980c23
13 changed files with 217 additions and 3 deletions
21
src/state.rs
Normal file
21
src/state.rs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
pub struct AppState {
|
||||
mp_tracks: Vec<Track>,
|
||||
p_tracks: Vec<Track>,
|
||||
}
|
||||
|
||||
impl AppState {
|
||||
async fn try_new() -> Self {
|
||||
Self {
|
||||
mp_tracks: serde_json::from_str(
|
||||
&std::fs::read_to_string("content/mp-tracks.json")
|
||||
.expect("mp-tracks.json non trouvé"),
|
||||
)
|
||||
.expect("JSON invalide"),
|
||||
p_tracks: serde_json::from_str(
|
||||
&std::fs::read_to_string("content/p-tracks.json")
|
||||
.expect("p-tracks.json non trouvé"),
|
||||
)
|
||||
.expect("JSON invalide"),
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue