lyric-karaoke-cli v1.0.0
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-cli
This will make the lyric-karaoke
command available globally on your system.
Local Installation
npm install lyric-karaoke-cli
Then you can run it with:
npx lyric-karaoke
API 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
.env
file in your project directory - Add your API key to the
.env
file:
API_KEY=your_genius_api_key_here
Alternatively, you can set it as an environment variable:
export API_KEY=your_genius_api_key_here
Usage
Basic Usage
Simply run the command to launch the interactive menu:
lyric-karaoke
Search 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 Queen
Controlling the Lyrics Display
When viewing lyrics, you can:
- Press
SPACE
to pause/resume - Press
RIGHT ARROW
to skip to the next line - Press
LEFT ARROW
to go back to the previous line - Press
ESC
orCTRL+C
to 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-cache
Or using npm:
npm run clear-cache
Command Reference
lyric-karaoke [options]
Options:
--help
or-h
: Display help information--version
or-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-cli
Install dependencies:
npm install
Create a
.env
file in the root directory (or copy the example):cp .env.example .env
Get an API key from Genius API and add it to your
.env
file:API_KEY=your_api_key_here
Usage
Running the Application
Start the application with:
npm start
Or run it directly with Node:
node index.js
Search 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 dependencies
Adding 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
4 months ago