lyric-karaoke-cli
v1.0.0
Published
A CLI application for displaying song lyrics in a karaoke-style format
Maintainers
Readme
Lyric Karaoke CLI
A command-line application that displays song lyrics in a karaoke-style format. Search for songs by title or artist, view lyrics with animated displays, and enjoy your favorite songs right in your terminal!
Features
- 🎵 Search for songs by title, artist, or both
- 🎤 Display lyrics in an animated karaoke-style format
- ⏯️ Control playback (start, pause, skip)
- 💾 Cache song data locally to minimize API requests
- 🎨 Colorful and engaging terminal interface
- 🌐 Integration with music lyrics APIs
- 📱 Cross-platform compatibility
Installation
Global Installation (Recommended)
npm install -g lyric-karaoke-cliThis will make the lyric-karaoke command available globally on your system.
Local Installation
npm install lyric-karaoke-cliThen you can run it with:
npx lyric-karaokeAPI Key Setup
This application requires an API key to fetch song data. We use the Genius Lyrics API by default.
- Sign up for a free API key at Genius API
- Create a
.envfile in your project directory - Add your API key to the
.envfile:
API_KEY=your_genius_api_key_hereAlternatively, you can set it as an environment variable:
export API_KEY=your_genius_api_key_hereUsage
Basic Usage
Simply run the command to launch the interactive menu:
lyric-karaokeSearch for Songs
From the main menu, select "Search for a song" and enter the song title, artist, or both.
Example:
? Enter song title or artist: Bohemian Rhapsody QueenControlling the Lyrics Display
When viewing lyrics, you can:
- Press
SPACEto pause/resume - Press
RIGHT ARROWto skip to the next line - Press
LEFT ARROWto go back to the previous line - Press
ESCorCTRL+Cto exit back to the menu
Viewing Recent Songs
Select "View recent songs" from the main menu to see songs you've previously viewed. This uses the local cache to avoid additional API requests.
Clearing the Cache
To clear the local cache:
lyric-karaoke --clear-cacheOr using npm:
npm run clear-cacheCommand Reference
lyric-karaoke [options]Options:
--helpor-h: Display help information--versionor-v: Display the installed version--clear-cache: Clear the local cache--search="song title": Directly search for a song--artist="artist name": Specify an artist when searching--no-color: Disable colored output
Contributing
Contributions are welcome! Here's how you can contribute:
- Fork the repository
- Create a new branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests (
npm test) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please make sure your code follows the existing style and includes appropriate tests.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Thanks to the Genius API for providing lyrics data
- Inspired by karaoke machines and the joy of singing along
Lyric Karaoke CLI
A command-line application that allows you to search for song lyrics and display them in a karaoke-style format.
Features
- Search for songs by title, artist, or genre
- Display lyrics in a line-by-line karaoke style
- Interactive controls to start, pause, or skip sections
- Caching mechanism to minimize API calls
- Colorful and engaging terminal interface
Installation
Prerequisites
- Node.js (v14 or higher)
- npm (v6 or higher)
Steps
Clone the repository:
git clone https://github.com/your-username/lyric-karaoke-cli.git cd lyric-karaoke-cliInstall dependencies:
npm installCreate a
.envfile in the root directory (or copy the example):cp .env.example .envGet an API key from Genius API and add it to your
.envfile:API_KEY=your_api_key_here
Usage
Running the Application
Start the application with:
npm startOr run it directly with Node:
node index.jsSearch for Songs
- Enter a search term (song title, artist name, or lyrics snippet)
- Select from the search results
- Enjoy the karaoke-style display of lyrics
Commands
npm start: Start the applicationnpm run clear-cache: Clear the cached song data
Configuration
You can configure the application through environment variables in the .env file:
| Variable | Description | Default | |----------|-------------|---------| | API_KEY | Your Genius API key | (required) | | API_BASE_URL | Base URL for the API | https://api.genius.com | | CACHE_ENABLED | Enable or disable caching | true | | CACHE_DIRECTORY | Directory for cache storage | ./.cache | | CACHE_TTL | Cache time-to-live in seconds | 86400 (24 hours) | | MAX_SEARCH_RESULTS | Maximum number of search results to display | 10 |
Development
Project Structure
├── index.js # Main entry point
├── src/
│ ├── api/ # API communication module
│ ├── cli/ # Command-line interface module
│ ├── cache/ # Caching module
│ ├── utils/ # Utility functions
│ └── config.js # Configuration module
├── .env # Environment variables
└── package.json # Project metadata and dependenciesAdding Features
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Commit your changes:
git commit -m 'Add some feature' - Push to the branch:
git push origin feature-name - Open a pull request
License
MIT
Acknowledgements
- Genius API for providing lyrics data
- Inquirer.js for the interactive CLI
- Chalk for terminal styling
