use crate::model::*;
#[derive(PartialEq, Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "python", pyo3::pyclass(get_all, set_all))]
pub struct Player {
#[serde(deserialize_with = "deserialize_number_from_string")]
pub guild_id: GuildId,
pub track: Option<track::TrackData>,
pub volume: u16,
pub paused: bool,
pub state: State,
pub filters: Option<Filters>,
pub voice: ConnectionInfo,
}
#[derive(Hash, PartialEq, Eq, PartialOrd, Ord, Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "python", pyo3::pyclass(get_all, set_all))]
pub struct State {
pub time: u64,
pub position: u64,
pub connected: bool,
#[serde(deserialize_with = "deserialize_option_number")]
pub ping: Option<u32>,
}
#[derive(Hash, PartialEq, Eq, PartialOrd, Ord, Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "python", pyo3::pyclass(get_all, set_all))]
pub struct ConnectionInfo {
pub endpoint: String,
pub token: String,
pub session_id: String,
}
impl ConnectionInfo {
pub fn fix(&mut self) {
self.endpoint = self.endpoint.replace("wss://", "");
}
}
#[cfg(feature = "songbird")]
use songbird_dep::ConnectionInfo as SongbirdConnectionInfo;
#[cfg(feature = "songbird")]
impl From<SongbirdConnectionInfo> for ConnectionInfo {
fn from(connection_info: SongbirdConnectionInfo) -> ConnectionInfo {
ConnectionInfo {
endpoint: connection_info.endpoint,
token: connection_info.token,
session_id: connection_info.session_id,
}
}
}
#[derive(PartialEq, Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "python", pyo3::pyclass)]
pub struct Filters {
#[serde(skip_serializing_if = "Option::is_none")]
pub volume: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub equalizer: Option<Vec<Equalizer>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub karaoke: Option<Karaoke>,
#[serde(skip_serializing_if = "Option::is_none")]
pub timescale: Option<Timescale>,
#[serde(skip_serializing_if = "Option::is_none")]
pub tremolo: Option<TremoloVibrato>,
#[serde(skip_serializing_if = "Option::is_none")]
pub vibrato: Option<TremoloVibrato>,
#[serde(skip_serializing_if = "Option::is_none")]
pub rotation: Option<Rotation>,
#[serde(skip_serializing_if = "Option::is_none")]
pub distortion: Option<Distortion>,
#[serde(skip_serializing_if = "Option::is_none")]
pub channel_mix: Option<ChannelMix>,
#[serde(skip_serializing_if = "Option::is_none")]
pub low_pass: Option<LowPass>,
#[serde(skip_serializing_if = "Option::is_none")]
pub plugin_filters: Option<serde_json::Value>,
}
#[derive(PartialEq, PartialOrd, Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "python", pyo3::pyclass(get_all, set_all))]
pub struct ChannelMix {
#[serde(skip_serializing_if = "Option::is_none")]
pub left_to_left: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub left_to_right: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub right_to_left: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub right_to_right: Option<f64>,
}
#[derive(PartialEq, PartialOrd, Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "python", pyo3::pyclass(get_all, set_all))]
pub struct Distortion {
#[serde(skip_serializing_if = "Option::is_none")]
pub sin_offset: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub sin_scale: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub cos_offset: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub cos_scale: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub tan_offset: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub tan_scale: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub offset: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub scale: Option<f64>,
}
#[derive(PartialEq, PartialOrd, Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "python", pyo3::pyclass(get_all, set_all))]
pub struct Equalizer {
pub band: u8,
pub gain: f64,
}
#[derive(PartialEq, PartialOrd, Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "python", pyo3::pyclass(get_all, set_all))]
pub struct Karaoke {
#[serde(skip_serializing_if = "Option::is_none")]
pub level: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub mono_level: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub filter_band: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub filter_width: Option<f64>,
}
#[derive(PartialEq, PartialOrd, Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "python", pyo3::pyclass(get_all, set_all))]
pub struct LowPass {
#[serde(skip_serializing_if = "Option::is_none")]
pub smoothing: Option<f64>,
}
#[derive(PartialEq, PartialOrd, Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "python", pyo3::pyclass(get_all, set_all))]
pub struct Rotation {
#[serde(skip_serializing_if = "Option::is_none")]
pub rotation_hz: Option<f64>,
}
#[derive(PartialEq, PartialOrd, Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "python", pyo3::pyclass(get_all, set_all))]
pub struct Timescale {
#[serde(skip_serializing_if = "Option::is_none")]
pub speed: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub pitch: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub rate: Option<f64>,
}
#[derive(PartialEq, PartialOrd, Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "python", pyo3::pyclass(get_all, set_all))]
pub struct TremoloVibrato {
#[serde(skip_serializing_if = "Option::is_none")]
pub frequency: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub depth: Option<f64>,
}