# TODO ## Completed ✓ - [x] **Fix SampleRate access in audio.rs:104** - `config.sample_rate().0` is invalid because `cpal::SampleRate` is a type alias for `u32`, not a tuple struct. - [x] **Implement previous track logic** (`src/playback.rs:99`) - Implemented basic previous() that restarts current track if playing/paused. - [x] **Remove unused std::thread import** (`src/playback.rs:2`) - Removed commented out import. - [x] **Run clippy** - All linting checks pass. - [x] **Run tests** - All tests pass (no tests exist yet). - [x] **Check formatting** - Code formatting is correct. - [x] **Implement resume functionality** - Implemented pause/resume using cpal stream pause()/play() methods. - [x] **Fix audio playback speed and buffer underrun** - Implemented proper sample buffering between callbacks to prevent audio skipping and buffer underrun errors. - [x] **Add Resume CLI subcommand** - Added `Resume` subcommand to CLI so users can resume playback after pause. - [x] **Implement shuffle mode** - Added shuffle on/off/album functionality with queue management in daemon. Supports `rsplayer shuffle on/off/album` commands. - [x] **Implement next/previous commands** - Next and previous track commands now work with the queue system. - [x] **Queue entire directory** - When playing a folder, all audio files are now queued instead of just the first one. - [x] **Auto-play next track** - Daemon automatically plays next track when current one ends (using `poll_track_ended()`). - [x] **Queue display with pager** - `rsplayer queue` shows all queued tracks with pager support for long lists. - [x] **Album shuffle mode structure** - `ShuffleMode::Album` added to enum and queue logic (behaves like `All` until database ready). ## Potential Improvements - [ ] **Add error handling for audio playback** - Consider more robust error handling in the audio thread. - [ ] **Add unit tests for Player struct** - The `Player` struct in `playback.rs` has no corresponding tests. - [ ] **Persist queue state** - Save queue to disk so it survives daemon restarts. - [ ] **Album shuffle mode (database)** - Implement proper `ShuffleMode::Album` when database is ready (shuffle tracks within same album/folder). - [ ] **Scrobbling (Last.fm/ListenBrainz)** - Add scrobbling support via configured credentials. - [ ] **Database integration** - Scan music paths, populate SQLite database, use for metadata. - [ ] **Shell completion scripts** - Generate bash/zsh/fish completions using clap. - [ ] **Systemd service unit** - Create systemd service file for auto-start.