reduce vu update frequency, report more sql errors, fix bug with startup show time

This commit is contained in:
2026-06-10 00:23:13 +02:00
parent b1453b3fbc
commit 5aa2631b99
3 changed files with 11 additions and 3 deletions
+4 -2
View File
@@ -144,6 +144,7 @@ pub struct BandcampQueryArgs {
}
#[derive(Debug)]
#[allow(unused)]
pub enum MixxxError {
Sql(sqlite::Error)
}
@@ -166,10 +167,11 @@ impl MixxxDB {
let mut statement = connection.prepare(query)?;
statement.bind((1, playlist_name.as_str()))?;
statement.next()?;
let latest_id = statement.read::<i64, _>("id").unwrap();
let latest_id = statement.read::<i64, _>("id")?;
let query = "SELECT title, artist, album, comment, url, bpm FROM library LEFT JOIN PlaylistTracks ON PlaylistTracks.track_id = library.id WHERE PlaylistTracks.playlist_id = ? ORDER BY position";
for track in connection.prepare(query).unwrap().into_iter().bind((1, latest_id)).unwrap().map(|row| row.unwrap()) {
for track in connection.prepare(query)?.into_iter().bind((1, latest_id))? {
let track = track?;
let title = track.try_read::<&str, _>("title").unwrap_or("Untitled Track");
let artist = track.try_read::<&str, _>("artist").unwrap_or("Unknown Artist");
let album = track.try_read::<&str, _>("album").unwrap_or("Unknown Album");
+1
View File
@@ -148,6 +148,7 @@ pub async fn start_audio_input() -> (AudioInputControl, MicStream, TtsOutStream)
volume_sink.send_if_modified(|v| {
let next_vu = meter.channel_vu(0).unwrap();
let next_vu = (next_vu * 100.0).round() / 100.0;
if *v != next_vu {
*v = next_vu;
true
+6 -1
View File
@@ -9,6 +9,7 @@ pub mod conversation;
pub struct StageDirection {
pub episode_number: u32,
#[serde(skip)]
#[serde(default="StageDirection::default_end_time")]
pub end_time: DateTime<Utc>,
pub narrative: String,
}
@@ -17,13 +18,17 @@ impl StageDirection {
pub fn time_remaining(&self) -> Duration {
self.end_time.signed_duration_since(Utc::now())
}
fn default_end_time() -> DateTime<Utc> {
Utc::now() + Duration::hours(2)
}
}
impl Default for StageDirection {
fn default() -> Self {
Self {
episode_number: 0,
end_time: Utc::now() + Duration::hours(2),
end_time: Self::default_end_time(),
narrative: Default::default(),
}
}