A simple, command-line application for managing a personal music album queue. Built with Go, this tool helps you organize albums you want to listen to and randomly selects your next listening choice.
- Add Albums: Add single albums manually or import from text files
- Duplicate Detection: Prevents duplicate albums with case-insensitive matching
- Random Selection: Get a random album from your queue and automatically remove it
- Queue Management: List all albums, count queue size, and manage your collection
- File-based Storage: Simple text file storage for portability and simplicity
- Cross-platform: Works on Linux, macOS, and Windows
- Go 1.24.4 or later
- Clone the repository:
git clone <repository-url>
cd music-queue- Build the application:
go build -o queue src/cmd/queue/main.go- (Optional) Install globally:
# Linux/macOS
sudo mv queue /usr/local/bin/
# Or add to your PATH
export PATH=$PATH:$(pwd)go install music-queue/src/cmd/queue@latest- Add your first album:
./queue add "The Beatles - Abbey Road"- Import albums from a file:
# Create a text file with one album per line
echo "Pink Floyd - The Wall" > my-albums.txt
echo "Led Zeppelin - IV" >> my-albums.txt
./queue import my-albums.txt- Get your next album to listen to:
./queue next- View your queue:
./queue list./queue import [--queue /path/to/queue.txt] <import-file>Examples:
./queue import albums.txt
./queue import --queue /custom/path/queue.txt albums.txtThe import file should contain one album per line in "Artist - Album" format:
The Beatles - Abbey Road
Pink Floyd - The Wall
Radiohead - OK Computer
./queue add [--queue /path/to/queue.txt] "Artist - Album"Examples:
./queue add "Daft Punk - Discovery"
./queue add --queue /custom/path/queue.txt "King Gizzard & The Lizard Wizard - PetroDragonic Apocalypse"./queue next [--queue /path/to/queue.txt]Randomly selects an album from your queue, displays it, and removes it from the queue.
./queue list [--queue /path/to/queue.txt]Shows a numbered list of all albums currently in your queue.
./queue count [--queue /path/to/queue.txt]Displays the total number of albums in your queue.
./queue helpAlbums must follow the format: Artist - Album Title
Valid examples:
"The Beatles - Abbey Road""Led Zeppelin - IV""King Gizzard & The Lizard Wizard - PetroDragonic Apocalypse"
Invalid examples:
"Abbey Road"(missing artist)"The Beatles"(missing album)"The Beatles Abbey Road"(missing dash separator)
By default, the queue is stored in:
- Linux/macOS:
~/.local/share/music-queue/queue.txt - Windows:
%APPDATA%/music-queue/queue.txt
You can specify a custom location using the --queue flag with any command.
music-queue/
├── src/
│ ├── cmd/
│ │ └── queue/
│ │ ├── main.go # CLI application entry point
│ │ └── main_test.go # CLI integration tests
│ └── internal/
│ ├── queue/
│ │ ├── queue.go # Core business logic
│ │ └── queue_test.go # Queue service tests
│ └── storage/
│ ├── file.go # File storage implementation
│ └── file_test.go # Storage layer tests
├── docs/ # Project documentation
├── go.mod # Go module definition
└── README.md # This file
The application follows a clean architecture pattern with clear separation of concerns:
- CLI Layer (
src/cmd/queue/): Handles command-line interface, argument parsing, and user interaction - Business Logic (
src/internal/queue/): Core queue operations, validation, and business rules - Storage Layer (
src/internal/storage/): File I/O operations and data persistence
Key Components:
- QueueService: Manages album operations (add, import, get next, list, count)
- FileStorage: Handles reading and writing to text files
- Validation: Ensures album format compliance and prevents duplicates
- Go 1.24.4 or later
- Git
- Clone the repository:
git clone <repository-url>
cd music-queue- Install dependencies:
go mod tidy- Run tests:
go test ./...- Build and test locally:
go build -o queue src/cmd/queue/main.go
./queue help- Package Structure: Follow Go package conventions with clear boundaries
- Error Handling: Comprehensive error handling with descriptive messages
- Testing: Unit tests for all major components
- Documentation: Inline documentation following Go conventions
Run all tests:
go test ./...Run tests with coverage:
go test -cover ./...Run tests for specific package:
go test ./src/internal/queue/
go test ./src/internal/storage/The project includes comprehensive tests for:
- Queue operations (add, import, get next, list, count)
- File storage operations
- CLI command handling
- Error conditions and edge cases
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests for new functionality
- Ensure all tests pass (
go test ./...) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow Go conventions and best practices
- Write tests for new functionality
- Keep functions small and focused
- Use descriptive variable and function names
- Document public APIs
This project is licensed under the terms specified in the LICENSE file.
Happy listening! 🎵
For questions or support, please open an issue in the repository.