Skip to content
Extraits de code Groupes Projets

AMADEUS: Implementation of lkt-lib

Fusionnées Kubat a demandé de fusionner amadeus-rs vers master
Comparer et Afficher la dernière version
6 fichiers
+ 103
62
Comparer les modifications
  • Côte à côte
  • En ligne
Fichiers
6
#![allow(dead_code)]
use lkt_lib::{query::LektorQuery, response::LektorFormatedResponse};
use lkt_lib::{query::*, response::LektorFormatedResponse};
use log::error;
use std::{
cell::Cell,
@@ -114,13 +114,8 @@ impl Deamon for CommandDeamon {
continue;
}
};
match lkt_lib::response::LektorFormatedResponse::try_from(res) {
Ok(response) => {
if let Err(e) = responses_send.send(response) {
error!("failed to send response to amadeus: {e}")
}
}
Err(e) => error!("failed to format the response: {e}"),
if let Err(e) = responses_send.send(res) {
error!("failed to send response to amadeus: {e}")
}
}
Err(e) => error!("failed to get command from amadeus: {e}"),
@@ -158,33 +153,34 @@ impl Deamon for StatusDeamon {
return_when_flagged!(quit_deamon, joined_deamon);
let status = {
let res = match connexion.send_query(lkt_lib::query::LektorQuery::PlaybackStatus) {
let mut res = match connexion.send_query(LektorQuery::PlaybackStatus) {
Ok(res) => res,
Err(e) => {
error!("failed to send the playback status command to lektor: {e}");
continue;
}
};
match lkt_lib::response::LektorFormatedResponse::try_from(res) {
Err(e) => panic!("{e}"),
Ok(mut response) => lkt_lib::response::PlaybackStatus::consume(&mut response),
match lkt_lib::response::PlaybackStatus::consume(&mut res) {
Err(e) => {
error!("failed to build response from formated response: {e}");
continue;
}
Ok(res) => res,
}
};
let current = if status.state != lkt_lib::types::LektorState::Stopped {
let res = match connexion.send_query(lkt_lib::query::LektorQuery::CurrentKara) {
let mut res = match connexion.send_query(lkt_lib::query::LektorQuery::CurrentKara) {
Ok(res) => res,
Err(e) => {
error!("failed to send the current kara command to lektor: {e}",);
continue;
}
};
match lkt_lib::response::LektorFormatedResponse::try_from(res) {
Ok(mut response) => {
Some(lkt_lib::response::CurrentKara::consume(&mut response))
}
Err(e) => {
error!("failed to format response from lektor: {e}");
match lkt_lib::response::CurrentKara::consume(&mut res) {
Ok(res) => Some(res),
Err(err) => {
error!("failed to build response from formated response: {err}");
None
}
}
@@ -193,7 +189,7 @@ impl Deamon for StatusDeamon {
};
if let Err(e) = responses_send.send((status, current)) {
error!("Failed to send a status response to amadeus: {}", e);
error!("Failed to send a status response to amadeus: {e}");
}
});
Chargement en cours