removed legacy code and clippy fixes + fixed ci
Release / Build and Release (push) Failing after 38s
Release / Build and Release (push) Failing after 38s
This commit is contained in:
@@ -26,8 +26,6 @@ pub struct Config {
|
||||
#[serde(default)]
|
||||
pub power: PowerConfig,
|
||||
#[serde(default)]
|
||||
pub buds: BudsConfig,
|
||||
#[serde(default)]
|
||||
pub audio: AudioConfig,
|
||||
#[serde(default)]
|
||||
pub bt: BtConfig,
|
||||
@@ -158,21 +156,6 @@ impl Default for PowerConfig {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct BudsConfig {
|
||||
pub format: String,
|
||||
pub format_disconnected: String,
|
||||
}
|
||||
|
||||
impl Default for BudsConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
format: "{left} | {right} | {anc}".to_string(),
|
||||
format_disconnected: "<span size='large'></span>".to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct AudioConfig {
|
||||
pub format_sink_unmuted: String,
|
||||
@@ -275,7 +258,6 @@ impl Config {
|
||||
validate_format("disk", &self.disk.format, &["mount", "used", "total"]);
|
||||
validate_format("pool", &self.pool.format, &["used", "total"]);
|
||||
validate_format("power", &self.power.format, &["percentage", "icon"]);
|
||||
validate_format("buds", &self.buds.format, &["left", "right", "anc"]);
|
||||
validate_format(
|
||||
"audio.sink_unmuted",
|
||||
&self.audio.format_sink_unmuted,
|
||||
|
||||
+8
-11
@@ -123,15 +123,13 @@ fn main() {
|
||||
let mut items = Vec::new();
|
||||
|
||||
// If connected, show plugin modes and disconnect
|
||||
if let Ok(json_str) = ipc::request_data("bt", &["get_modes"]) {
|
||||
if let Ok(val) = serde_json::from_str::<serde_json::Value>(&json_str) {
|
||||
if let Some(modes_str) = val.get("text").and_then(|t| t.as_str()) {
|
||||
if !modes_str.is_empty() {
|
||||
for mode in modes_str.lines() {
|
||||
items.push(format!("Mode: {}", mode));
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Ok(json_str) = ipc::request_data("bt", &["get_modes"])
|
||||
&& let Ok(val) = serde_json::from_str::<serde_json::Value>(&json_str)
|
||||
&& let Some(modes_str) = val.get("text").and_then(|t| t.as_str())
|
||||
&& !modes_str.is_empty()
|
||||
{
|
||||
for mode in modes_str.lines() {
|
||||
items.push(format!("Mode: {}", mode));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,8 +164,7 @@ fn main() {
|
||||
if let Ok(selected) =
|
||||
utils::show_menu("BT Menu: ", &items, &config.general.menu_command)
|
||||
{
|
||||
if selected.starts_with("Mode: ") {
|
||||
let mode = &selected[6..];
|
||||
if let Some(mode) = selected.strip_prefix("Mode: ") {
|
||||
handle_ipc_response(ipc::request_data("bt", &["set_mode", mode]));
|
||||
} else if selected == "Disconnect" {
|
||||
handle_ipc_response(ipc::request_data("bt", &["disconnect"]));
|
||||
|
||||
@@ -121,7 +121,7 @@ fn fetch_audio_data_sync(context: &mut Context, state: &SharedState) -> Result<(
|
||||
let is_default = item
|
||||
.name
|
||||
.as_ref()
|
||||
.map(|s| s.to_string() == lock.audio.sink.name)
|
||||
.map(|s| s.as_ref() == lock.audio.sink.name)
|
||||
.unwrap_or(false);
|
||||
if is_default {
|
||||
lock.audio.sink.description = item
|
||||
@@ -143,7 +143,7 @@ fn fetch_audio_data_sync(context: &mut Context, state: &SharedState) -> Result<(
|
||||
let is_default = item
|
||||
.name
|
||||
.as_ref()
|
||||
.map(|s| s.to_string() == lock.audio.source.name)
|
||||
.map(|s| s.as_ref() == lock.audio.source.name)
|
||||
.unwrap_or(false);
|
||||
if is_default {
|
||||
lock.audio.source.description = item
|
||||
|
||||
+4
-5
@@ -226,12 +226,11 @@ async fn buds_task(
|
||||
if let Ok(val) = service
|
||||
.read_setting_var(settings::SettingId::CurrentAncrState)
|
||||
.await
|
||||
&& let SettingValue::CurrentAncrState(anc_state) = val
|
||||
{
|
||||
if let SettingValue::CurrentAncrState(anc_state) = val {
|
||||
let mut status = MAESTRO.get_status(mac);
|
||||
status.anc_state = anc_state_to_string(&anc_state);
|
||||
statuses.lock().unwrap().insert(mac.to_string(), status);
|
||||
}
|
||||
let mut status = MAESTRO.get_status(mac);
|
||||
status.anc_state = anc_state_to_string(&anc_state);
|
||||
statuses.lock().unwrap().insert(mac.to_string(), status);
|
||||
}
|
||||
|
||||
// Subscribe to real-time status updates (battery, ANC, wear)
|
||||
|
||||
@@ -175,12 +175,11 @@ fn get_primary_interface() -> Result<String> {
|
||||
fn get_ip_address(interface: &str) -> Option<String> {
|
||||
let addrs = getifaddrs().ok()?;
|
||||
for ifaddr in addrs {
|
||||
if ifaddr.interface_name == interface {
|
||||
if let Some(address) = ifaddr.address {
|
||||
if let Some(sockaddr) = address.as_sockaddr_in() {
|
||||
return Some(sockaddr.ip().to_string());
|
||||
}
|
||||
}
|
||||
if ifaddr.interface_name == interface
|
||||
&& let Some(address) = ifaddr.address
|
||||
&& let Some(sockaddr) = address.as_sockaddr_in()
|
||||
{
|
||||
return Some(sockaddr.ip().to_string());
|
||||
}
|
||||
}
|
||||
None
|
||||
|
||||
+1
-12
@@ -1,6 +1,6 @@
|
||||
use serde::Serialize;
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[derive(Serialize, Default)]
|
||||
pub struct WaybarOutput {
|
||||
pub text: String,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
@@ -11,17 +11,6 @@ pub struct WaybarOutput {
|
||||
pub percentage: Option<u8>,
|
||||
}
|
||||
|
||||
impl Default for WaybarOutput {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
text: String::new(),
|
||||
tooltip: None,
|
||||
class: None,
|
||||
percentage: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
use pbpctrl::Controller;
|
||||
|
||||
fn main() {
|
||||
let _ = Controller::connect("AA:BB:CC:DD:EE:FF");
|
||||
}
|
||||
Reference in New Issue
Block a user