mini-player: wip

This commit is contained in:
Agahnim 2026-03-19 19:17:53 +01:00
parent c4c49dee6b
commit 8b0de4bf93
13 changed files with 217 additions and 3 deletions

30
src/domain.rs Normal file
View file

@ -0,0 +1,30 @@
use serde::Deserialize;
pub struct AppState {
pub mp_tracks: Vec<Track>,
pub p_tracks: Vec<Track>,
}
impl AppState {
pub 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"),
}
}
}
#[derive(Deserialize, Clone)]
pub struct Track {
title: String,
artist: String,
src: String,
}