Remove dead code and #![allow(dead_code)] blanket suppressions
- Delete src/audio/queue.rs (321 lines, PlayQueue never used) - Remove #![allow(dead_code)] from audio, subsonic, and mpris module roots - Remove unused MpvEvent2 enum, playlist_clear, get_volume, get_path, is_eof, observe_property from mpv.rs - Remove unused DEFAULT_DEVICE_ID, is_available, get_effective_rate from pipewire.rs (and associated dead test) - Remove unused search(), get_cover_art_url() from subsonic client - Remove unused SearchResult3Data, SearchResult3 model structs - Move parse_song_id_from_url into #[cfg(test)] block (only used by tests) - Add targeted #[allow(dead_code)] on deserialization-only fields (MpvEvent, SubsonicResponseInner.version, ArtistIndex.name) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,12 +1,8 @@
|
||||
//! Application actions and message passing
|
||||
|
||||
use crate::subsonic::models::{Album, Artist, Child, Playlist};
|
||||
|
||||
/// Actions that can be sent to the audio backend
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum AudioAction {
|
||||
/// Play a specific song by URL
|
||||
Play { url: String, song: Child },
|
||||
/// Pause playback
|
||||
Pause,
|
||||
/// Resume playback
|
||||
@@ -26,86 +22,3 @@ pub enum AudioAction {
|
||||
/// Set volume (0-100)
|
||||
SetVolume(i32),
|
||||
}
|
||||
|
||||
/// Actions that can be sent to update the UI
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum UiAction {
|
||||
/// Update playback position
|
||||
UpdatePosition { position: f64, duration: f64 },
|
||||
/// Update playback state
|
||||
UpdatePlaybackState(PlaybackStateUpdate),
|
||||
/// Update audio properties
|
||||
UpdateAudioProperties {
|
||||
sample_rate: Option<u32>,
|
||||
bit_depth: Option<u32>,
|
||||
format: Option<String>,
|
||||
},
|
||||
/// Track ended (EOF from MPV)
|
||||
TrackEnded,
|
||||
/// Show notification
|
||||
Notify { message: String, is_error: bool },
|
||||
/// Artists loaded from server
|
||||
ArtistsLoaded(Vec<Artist>),
|
||||
/// Albums loaded for an artist
|
||||
AlbumsLoaded {
|
||||
artist_id: String,
|
||||
albums: Vec<Album>,
|
||||
},
|
||||
/// Songs loaded for an album
|
||||
SongsLoaded { album_id: String, songs: Vec<Child> },
|
||||
/// Playlists loaded from server
|
||||
PlaylistsLoaded(Vec<Playlist>),
|
||||
/// Playlist songs loaded
|
||||
PlaylistSongsLoaded {
|
||||
playlist_id: String,
|
||||
songs: Vec<Child>,
|
||||
},
|
||||
/// Server connection test result
|
||||
ConnectionTestResult { success: bool, message: String },
|
||||
/// Force redraw
|
||||
Redraw,
|
||||
}
|
||||
|
||||
/// Playback state update
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum PlaybackStateUpdate {
|
||||
Playing,
|
||||
Paused,
|
||||
Stopped,
|
||||
}
|
||||
|
||||
/// Actions for the Subsonic client
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum SubsonicAction {
|
||||
/// Fetch all artists
|
||||
FetchArtists,
|
||||
/// Fetch albums for an artist
|
||||
FetchAlbums { artist_id: String },
|
||||
/// Fetch songs for an album
|
||||
FetchAlbum { album_id: String },
|
||||
/// Fetch all playlists
|
||||
FetchPlaylists,
|
||||
/// Fetch songs in a playlist
|
||||
FetchPlaylist { playlist_id: String },
|
||||
/// Test server connection
|
||||
TestConnection,
|
||||
}
|
||||
|
||||
/// Queue manipulation actions
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum QueueAction {
|
||||
/// Append songs to queue
|
||||
Append(Vec<Child>),
|
||||
/// Insert songs after current position
|
||||
InsertNext(Vec<Child>),
|
||||
/// Clear the queue
|
||||
Clear,
|
||||
/// Remove song at index
|
||||
Remove(usize),
|
||||
/// Move song from one index to another
|
||||
Move { from: usize, to: usize },
|
||||
/// Shuffle the queue (keeping current song in place)
|
||||
Shuffle,
|
||||
/// Play song at queue index
|
||||
PlayIndex(usize),
|
||||
}
|
||||
|
||||
@@ -32,16 +32,6 @@ impl Page {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_index(index: usize) -> Self {
|
||||
match index {
|
||||
0 => Page::Artists,
|
||||
1 => Page::Queue,
|
||||
2 => Page::Playlists,
|
||||
3 => Page::Server,
|
||||
4 => Page::Settings,
|
||||
_ => Page::Artists,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn label(&self) -> &'static str {
|
||||
match self {
|
||||
@@ -205,6 +195,8 @@ pub struct SettingsState {
|
||||
pub theme_index: usize,
|
||||
/// Cava visualizer enabled
|
||||
pub cava_enabled: bool,
|
||||
/// Cava visualizer height percentage (10-80, step 5)
|
||||
pub cava_size: u8,
|
||||
}
|
||||
|
||||
impl Default for SettingsState {
|
||||
@@ -214,6 +206,7 @@ impl Default for SettingsState {
|
||||
themes: vec![ThemeData::default_theme()],
|
||||
theme_index: 0,
|
||||
cava_enabled: false,
|
||||
cava_size: 40,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -269,10 +262,8 @@ pub struct Notification {
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct LayoutAreas {
|
||||
pub header: Rect,
|
||||
pub cava: Option<Rect>,
|
||||
pub content: Rect,
|
||||
pub now_playing: Rect,
|
||||
pub footer: Rect,
|
||||
/// Left pane for dual-pane pages (Artists tree, Playlists list)
|
||||
pub content_left: Option<Rect>,
|
||||
/// Right pane for dual-pane pages (Songs list)
|
||||
@@ -349,6 +340,7 @@ impl AppState {
|
||||
state.server_state.password = config.password.clone();
|
||||
// Initialize cava from config
|
||||
state.settings_state.cava_enabled = config.cava;
|
||||
state.settings_state.cava_size = config.cava_size.clamp(10, 80);
|
||||
state
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user