chore: remove dead code to eliminate all compiler warnings
- Remove unused get_artist() (replaced by get_artist_page()) - Remove unused Format::label(), Format::all() - Remove unused QwsTokenResponse and QwsToken structs - Remove unused PlayerCommand::Seek (seeking uses atomics directly) - Remove unused PlayerState::Stopped, TrackInfo::format - Remove unused PlayerStatus::get_current_track() Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -255,20 +255,6 @@ impl QobuzClient {
|
||||
|
||||
// --- Artist ---
|
||||
|
||||
pub async fn get_artist(&self, artist_id: i64) -> Result<ArtistDto> {
|
||||
let resp = self
|
||||
.get_request("artist/get")
|
||||
.query(&[
|
||||
("artist_id", artist_id.to_string()),
|
||||
("extra", "albums".to_string()),
|
||||
("albums_limit", "200".to_string()),
|
||||
])
|
||||
.send()
|
||||
.await?;
|
||||
let body = Self::check_response(resp).await?;
|
||||
Ok(serde_json::from_value(body)?)
|
||||
}
|
||||
|
||||
pub async fn get_artist_page(&self, artist_id: i64) -> Result<Value> {
|
||||
let resp = self
|
||||
.get_request("artist/page")
|
||||
|
||||
@@ -244,30 +244,5 @@ impl Format {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn label(self) -> &'static str {
|
||||
match self {
|
||||
Format::Mp3 => "MP3 320",
|
||||
Format::Cd => "CD 16-bit",
|
||||
Format::HiRes96 => "Hi-Res 24-bit/96kHz",
|
||||
Format::HiRes192 => "Hi-Res 24-bit/192kHz",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn all() -> &'static [Format] {
|
||||
&[Format::HiRes192, Format::HiRes96, Format::Cd, Format::Mp3]
|
||||
}
|
||||
}
|
||||
|
||||
// --- QWS ---
|
||||
|
||||
#[derive(Debug, Deserialize, Clone, Serialize)]
|
||||
pub struct QwsTokenResponse {
|
||||
pub jwt_qws: Option<QwsToken>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Clone, Serialize)]
|
||||
pub struct QwsToken {
|
||||
pub exp: Option<i64>,
|
||||
pub jwt: Option<String>,
|
||||
pub endpoint: Option<String>,
|
||||
}
|
||||
|
||||
@@ -410,7 +410,7 @@ pub unsafe extern "C" fn qobuz_backend_play_track(
|
||||
if let Some(dur) = track.duration {
|
||||
status.duration_secs.store(dur as u64, std::sync::atomic::Ordering::Relaxed);
|
||||
}
|
||||
let _ = cmd_tx.send(player::PlayerCommand::Play(player::TrackInfo { track, url, format, replaygain_db }));
|
||||
let _ = cmd_tx.send(player::PlayerCommand::Play(player::TrackInfo { track, url, replaygain_db }));
|
||||
|
||||
// 5. State notification
|
||||
call_cb(cb, ud, EV_STATE_CHANGED, r#"{"state":"playing"}"#);
|
||||
|
||||
@@ -195,11 +195,6 @@ pub fn play_track_inline(
|
||||
paused.store(false, Ordering::SeqCst);
|
||||
*status.state.lock().unwrap() = super::PlayerState::Playing;
|
||||
}
|
||||
Ok(PlayerCommand::Seek(s)) => {
|
||||
status.seek_target_secs.store(s, Ordering::Relaxed);
|
||||
status.seek_requested.load(Ordering::SeqCst); // read-side fence
|
||||
status.seek_requested.store(true, Ordering::SeqCst);
|
||||
}
|
||||
Ok(PlayerCommand::SetVolume(v)) => {
|
||||
status.volume.store(v, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ use std::sync::{
|
||||
};
|
||||
use std::time::Duration;
|
||||
|
||||
use crate::api::{Format, TrackDto};
|
||||
use crate::api::TrackDto;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum PlayerCommand {
|
||||
@@ -15,7 +15,6 @@ pub enum PlayerCommand {
|
||||
Pause,
|
||||
Resume,
|
||||
Stop,
|
||||
Seek(u64),
|
||||
SetVolume(u8),
|
||||
}
|
||||
|
||||
@@ -23,7 +22,6 @@ pub enum PlayerCommand {
|
||||
pub struct TrackInfo {
|
||||
pub track: TrackDto,
|
||||
pub url: String,
|
||||
pub format: Format,
|
||||
/// ReplayGain track gain in dB, if enabled and available.
|
||||
pub replaygain_db: Option<f64>,
|
||||
}
|
||||
@@ -33,7 +31,6 @@ pub enum PlayerState {
|
||||
Idle,
|
||||
Playing,
|
||||
Paused,
|
||||
Stopped,
|
||||
Error(String),
|
||||
}
|
||||
|
||||
@@ -87,9 +84,6 @@ impl PlayerStatus {
|
||||
self.volume.load(Ordering::Relaxed)
|
||||
}
|
||||
|
||||
pub fn get_current_track(&self) -> Option<TrackDto> {
|
||||
self.current_track.lock().unwrap().clone()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Player {
|
||||
@@ -169,10 +163,6 @@ fn player_loop(rx: std::sync::mpsc::Receiver<PlayerCommand>, status: PlayerStatu
|
||||
Ok(PlayerCommand::SetVolume(v)) => {
|
||||
status.volume.store(v, Ordering::Relaxed);
|
||||
}
|
||||
Ok(PlayerCommand::Seek(s)) => {
|
||||
status.seek_target_secs.store(s, Ordering::Relaxed);
|
||||
status.seek_requested.store(true, Ordering::SeqCst);
|
||||
}
|
||||
Ok(_) => {} // Pause/Resume ignored when idle
|
||||
Err(RecvTimeoutError::Timeout) => {}
|
||||
Err(RecvTimeoutError::Disconnected) => break 'outer,
|
||||
|
||||
Reference in New Issue
Block a user