, 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:
Anas Elgarhy 2023-02-23 22:53:08 +02:00
parent 8226253891
commit a784a4b9d4
No known key found for this signature in database
GPG key ID: 0501802A1D496528
6 changed files with 22 additions and 12 deletions

View file

@ -4,7 +4,8 @@ use crate::notification::Action;
use crate::settings::Settings;
use crate::{process_template_placeholders, settings};
#[derive(Debug, PartialEq)]
#[derive(PartialEq)]
#[cfg_attr(any(feature = "debug", test), derive(Debug))]
pub enum CmusEvent {
StatusChanged(Track, PlayerSettings),
TrackChanged(Track, PlayerSettings),

View file

@ -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 {
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 {
Playing,
Paused,
@ -54,7 +56,8 @@ pub enum TrackStatus {
Stopped,
}
#[derive(Debug, TypedBuilder, PartialEq, Default, Clone)]
#[derive(TypedBuilder, PartialEq, Default, Clone)]
#[cfg_attr(any(feature = "debug", test), derive(Debug))]
pub struct Track {
pub status: TrackStatus,
pub path: String,

View file

@ -2,11 +2,11 @@ use crate::cmus::{CmusError, TemplateProcessor};
#[cfg(feature = "debug")]
use log::{debug, info};
use parse_display::Display;
use std::fmt::{Display, Formatter};
use std::num::ParseIntError;
use std::str::FromStr;
#[derive(Debug, PartialEq, Clone)]
#[derive(PartialEq, Clone)]
#[cfg_attr(feature = "debug", derive(Debug))]
pub struct PlayerSettings {
pub repeat: bool,
pub repeat_current: bool,
@ -15,7 +15,8 @@ pub struct PlayerSettings {
pub volume: Volume,
}
#[derive(Display, Debug, PartialEq, Default, Clone)]
#[derive(Display, PartialEq, Default, Clone)]
#[cfg_attr(feature = "debug", derive(Debug))]
pub enum Shuffle {
#[default]
Off,
@ -23,13 +24,15 @@ pub enum Shuffle {
Albums,
}
#[derive(Debug, PartialEq, Default, Clone)]
#[derive(PartialEq, Default, Clone)]
#[cfg_attr(feature = "debug", derive(Debug))]
pub struct Volume {
pub left: u8,
pub right: u8,
}
#[derive(Display, Debug, PartialEq, Default, Clone)]
#[derive(Display, PartialEq, Default, Clone)]
#[cfg_attr(feature = "debug", derive(Debug))]
pub enum AAAMode {
#[default]
All,

View file

@ -8,7 +8,8 @@ use std::str::FromStr;
/// 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.
/// We only parse it when we need it.
#[derive(Debug, PartialEq, Default)]
#[derive(PartialEq, Default)]
#[cfg_attr(feature = "debug", derive(Debug))]
pub struct CmusQueryResponse {
track_row: String,
player_settings_row: String,

View file

@ -114,7 +114,8 @@ pub fn search_for(
}
/// The cover of a track.
#[derive(Debug, PartialEq)]
#[derive(PartialEq)]
#[cfg_attr(any(feature = "debug", test), derive(Debug))]
pub enum TrackCover {
/// The cover is embedded in the track.
/// The `DynamicImage` object contains the contents of the embedded picture.

View file

@ -32,7 +32,8 @@ const DEFAULT_LYRICS_NOTIFICATION_BODY: &str = "{lyrics}";
#[cfg(feature = "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)]
pub struct Settings {
/// The notification timeout, in seconds