, for the cmus track changed
notificationAdd #[cfg_attr(any(feature = "debug", test), derive(Debug))]
to structs for debug and test builds
This commit is contained in:
parent
8226253891
commit
a784a4b9d4
6 changed files with 22 additions and 12 deletions
|
@ -4,7 +4,8 @@ use crate::notification::Action;
|
||||||
use crate::settings::Settings;
|
use crate::settings::Settings;
|
||||||
use crate::{process_template_placeholders, settings};
|
use crate::{process_template_placeholders, settings};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(PartialEq)]
|
||||||
|
#[cfg_attr(any(feature = "debug", test), derive(Debug))]
|
||||||
pub enum CmusEvent {
|
pub enum CmusEvent {
|
||||||
StatusChanged(Track, PlayerSettings),
|
StatusChanged(Track, PlayerSettings),
|
||||||
TrackChanged(Track, PlayerSettings),
|
TrackChanged(Track, PlayerSettings),
|
||||||
|
|
|
@ -41,12 +41,14 @@ pub trait TemplateProcessor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Default, Clone)]
|
#[derive(PartialEq, Default, Clone)]
|
||||||
|
#[cfg_attr(any(feature = "debug", test), derive(Debug))]
|
||||||
pub struct TrackMetadata {
|
pub struct TrackMetadata {
|
||||||
tags: HashMap<String, String>,
|
tags: HashMap<String, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Display, Debug, PartialEq, Default, Clone)]
|
#[derive(Display, PartialEq, Default, Clone)]
|
||||||
|
#[cfg_attr(any(feature = "debug", test), derive(Debug))]
|
||||||
pub enum TrackStatus {
|
pub enum TrackStatus {
|
||||||
Playing,
|
Playing,
|
||||||
Paused,
|
Paused,
|
||||||
|
@ -54,7 +56,8 @@ pub enum TrackStatus {
|
||||||
Stopped,
|
Stopped,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, TypedBuilder, PartialEq, Default, Clone)]
|
#[derive(TypedBuilder, PartialEq, Default, Clone)]
|
||||||
|
#[cfg_attr(any(feature = "debug", test), derive(Debug))]
|
||||||
pub struct Track {
|
pub struct Track {
|
||||||
pub status: TrackStatus,
|
pub status: TrackStatus,
|
||||||
pub path: String,
|
pub path: String,
|
||||||
|
|
|
@ -2,11 +2,11 @@ use crate::cmus::{CmusError, TemplateProcessor};
|
||||||
#[cfg(feature = "debug")]
|
#[cfg(feature = "debug")]
|
||||||
use log::{debug, info};
|
use log::{debug, info};
|
||||||
use parse_display::Display;
|
use parse_display::Display;
|
||||||
use std::fmt::{Display, Formatter};
|
|
||||||
use std::num::ParseIntError;
|
use std::num::ParseIntError;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(PartialEq, Clone)]
|
||||||
|
#[cfg_attr(feature = "debug", derive(Debug))]
|
||||||
pub struct PlayerSettings {
|
pub struct PlayerSettings {
|
||||||
pub repeat: bool,
|
pub repeat: bool,
|
||||||
pub repeat_current: bool,
|
pub repeat_current: bool,
|
||||||
|
@ -15,7 +15,8 @@ pub struct PlayerSettings {
|
||||||
pub volume: Volume,
|
pub volume: Volume,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Display, Debug, PartialEq, Default, Clone)]
|
#[derive(Display, PartialEq, Default, Clone)]
|
||||||
|
#[cfg_attr(feature = "debug", derive(Debug))]
|
||||||
pub enum Shuffle {
|
pub enum Shuffle {
|
||||||
#[default]
|
#[default]
|
||||||
Off,
|
Off,
|
||||||
|
@ -23,13 +24,15 @@ pub enum Shuffle {
|
||||||
Albums,
|
Albums,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Default, Clone)]
|
#[derive(PartialEq, Default, Clone)]
|
||||||
|
#[cfg_attr(feature = "debug", derive(Debug))]
|
||||||
pub struct Volume {
|
pub struct Volume {
|
||||||
pub left: u8,
|
pub left: u8,
|
||||||
pub right: u8,
|
pub right: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Display, Debug, PartialEq, Default, Clone)]
|
#[derive(Display, PartialEq, Default, Clone)]
|
||||||
|
#[cfg_attr(feature = "debug", derive(Debug))]
|
||||||
pub enum AAAMode {
|
pub enum AAAMode {
|
||||||
#[default]
|
#[default]
|
||||||
All,
|
All,
|
||||||
|
|
|
@ -8,7 +8,8 @@ use std::str::FromStr;
|
||||||
/// This struct is used to store the row status response from cmus.
|
/// This struct is used to store the row status response from cmus.
|
||||||
/// So we don't parse it and take the time then we don't need it.
|
/// So we don't parse it and take the time then we don't need it.
|
||||||
/// We only parse it when we need it.
|
/// We only parse it when we need it.
|
||||||
#[derive(Debug, PartialEq, Default)]
|
#[derive(PartialEq, Default)]
|
||||||
|
#[cfg_attr(feature = "debug", derive(Debug))]
|
||||||
pub struct CmusQueryResponse {
|
pub struct CmusQueryResponse {
|
||||||
track_row: String,
|
track_row: String,
|
||||||
player_settings_row: String,
|
player_settings_row: String,
|
||||||
|
|
|
@ -114,7 +114,8 @@ pub fn search_for(
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The cover of a track.
|
/// The cover of a track.
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(PartialEq)]
|
||||||
|
#[cfg_attr(any(feature = "debug", test), derive(Debug))]
|
||||||
pub enum TrackCover {
|
pub enum TrackCover {
|
||||||
/// The cover is embedded in the track.
|
/// The cover is embedded in the track.
|
||||||
/// The `DynamicImage` object contains the contents of the embedded picture.
|
/// The `DynamicImage` object contains the contents of the embedded picture.
|
||||||
|
|
|
@ -32,7 +32,8 @@ const DEFAULT_LYRICS_NOTIFICATION_BODY: &str = "{lyrics}";
|
||||||
#[cfg(feature = "lyrics")]
|
#[cfg(feature = "lyrics")]
|
||||||
const DEFAULT_LYRICS_NOTIFICATION_SUMMARY: &str = "Lyrics";
|
const DEFAULT_LYRICS_NOTIFICATION_SUMMARY: &str = "Lyrics";
|
||||||
|
|
||||||
#[derive(Parser, Debug, Serialize, Deserialize)]
|
#[derive(Parser, Serialize, Deserialize)]
|
||||||
|
#[cfg_attr(feature = "debug", derive(Debug))]
|
||||||
#[command(author, about, version, long_about = None)]
|
#[command(author, about, version, long_about = None)]
|
||||||
pub struct Settings {
|
pub struct Settings {
|
||||||
/// The notification timeout, in seconds
|
/// The notification timeout, in seconds
|
||||||
|
|
Loading…
Reference in a new issue