reduce vu update frequency, report more sql errors, fix bug with startup show time
This commit is contained in:
+4
-2
@@ -144,6 +144,7 @@ pub struct BandcampQueryArgs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
#[allow(unused)]
|
||||||
pub enum MixxxError {
|
pub enum MixxxError {
|
||||||
Sql(sqlite::Error)
|
Sql(sqlite::Error)
|
||||||
}
|
}
|
||||||
@@ -166,10 +167,11 @@ impl MixxxDB {
|
|||||||
let mut statement = connection.prepare(query)?;
|
let mut statement = connection.prepare(query)?;
|
||||||
statement.bind((1, playlist_name.as_str()))?;
|
statement.bind((1, playlist_name.as_str()))?;
|
||||||
statement.next()?;
|
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";
|
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 title = track.try_read::<&str, _>("title").unwrap_or("Untitled Track");
|
||||||
let artist = track.try_read::<&str, _>("artist").unwrap_or("Unknown Artist");
|
let artist = track.try_read::<&str, _>("artist").unwrap_or("Unknown Artist");
|
||||||
let album = track.try_read::<&str, _>("album").unwrap_or("Unknown Album");
|
let album = track.try_read::<&str, _>("album").unwrap_or("Unknown Album");
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ pub async fn start_audio_input() -> (AudioInputControl, MicStream, TtsOutStream)
|
|||||||
|
|
||||||
volume_sink.send_if_modified(|v| {
|
volume_sink.send_if_modified(|v| {
|
||||||
let next_vu = meter.channel_vu(0).unwrap();
|
let next_vu = meter.channel_vu(0).unwrap();
|
||||||
|
let next_vu = (next_vu * 100.0).round() / 100.0;
|
||||||
if *v != next_vu {
|
if *v != next_vu {
|
||||||
*v = next_vu;
|
*v = next_vu;
|
||||||
true
|
true
|
||||||
|
|||||||
+6
-1
@@ -9,6 +9,7 @@ pub mod conversation;
|
|||||||
pub struct StageDirection {
|
pub struct StageDirection {
|
||||||
pub episode_number: u32,
|
pub episode_number: u32,
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
|
#[serde(default="StageDirection::default_end_time")]
|
||||||
pub end_time: DateTime<Utc>,
|
pub end_time: DateTime<Utc>,
|
||||||
pub narrative: String,
|
pub narrative: String,
|
||||||
}
|
}
|
||||||
@@ -17,13 +18,17 @@ impl StageDirection {
|
|||||||
pub fn time_remaining(&self) -> Duration {
|
pub fn time_remaining(&self) -> Duration {
|
||||||
self.end_time.signed_duration_since(Utc::now())
|
self.end_time.signed_duration_since(Utc::now())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_end_time() -> DateTime<Utc> {
|
||||||
|
Utc::now() + Duration::hours(2)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for StageDirection {
|
impl Default for StageDirection {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
episode_number: 0,
|
episode_number: 0,
|
||||||
end_time: Utc::now() + Duration::hours(2),
|
end_time: Self::default_end_time(),
|
||||||
narrative: Default::default(),
|
narrative: Default::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user