Your terminal, your music, your way. A powerful CLI music player that brings YouTube Music and Spotify to your command line. Stream millions of songs for free, manage playlists, and control everything with simple commands - no GUI needed!
- ๐ต YouTube Music Integration - Search and play music from YouTube Music (completely free!)
- ๐ง Spotify Integration - Access your Spotify playlists and library
- ๐ Playlist Management - Create and manage local playlists
- ๐ Shuffle Mode - Randomize your playlist playback
- โฏ๏ธ Full Playback Controls - Play, pause, next, previous, volume control
- ๐จ Beautiful Terminal UI - Rich formatting with progress bars and real-time updates
- โ๏ธ Customizable Settings - Configure default volume, auto-play, and more
- ๐ Pagination - Browse large playlists with easy page navigation
- ๐ Auto-Play - Automatically plays the next track when current one finishes
- ๐พ Persistent Storage - All settings and playlists are saved locally
- Python 3.8+ - Download Python
- FFmpeg - Required for audio conversion
- Windows: Download from ffmpeg.org and add to PATH
- macOS:
brew install ffmpeg - Linux:
sudo apt install ffmpegorsudo dnf install ffmpeg
-
Clone the repository
git clone https://github.com/yourusername/kaiyafi.git cd kaiyafi -
Install dependencies
pip install -r requirements.txt
-
Run the player
python main.py
search <query> # Search for music
play <number> # Play track from search results
pause # Pause playback
resume # Resume playback
stop # Stop playback
next # Play next track
prev # Play previous trackvol <0-100> # Set volume to specific level
vol+ # Increase volume by 10%
vol- # Decrease volume by 10%playlist create <name> # Create a new playlist
playlist add <name> # Add current track to playlist
playlist show # Show all your playlists
playlist load <name> # Load and play a playlist
shuffle # Shuffle current playlistspotify playlists # Show your Spotify playlists
spotify show <number> # Show tracks in a Spotify playlist
spotify load <number> # Load and play a Spotify playlistpage <number> # Navigate to specific page
settings # Show current settings
set <setting> <value> # Update a setting
now # Show now playing info
help # Show all commands
quit # Exit playerTo access your Spotify playlists:
- Go to Spotify Developer Dashboard
- Create a new app
- In app settings, add Redirect URI:
http://127.0.0.1:8888/callback - Copy your Client ID and Client Secret
- Run the player and use the
configcommand - Enter your credentials when prompted
- Restart the player
Note: Spotify is only used for accessing your playlists. Actual playback uses YouTube Music (free).
See SPOTIFY_SETUP.md for detailed instructions.
Customize your experience with these settings:
set default_volume 80 # Set default volume (0-100)
set auto_play_next true # Enable/disable auto-play next track
set results_per_page 30 # Number of results per page (5-100)Settings are saved in ~/.music_player/config.json
โช > search never gonna give you up
# Shows search results
โช > play 1
# Plays the first resultโช > playlist create favorites
โช > search bohemian rhapsody
โช > play 1
โช > playlist add favorites
โช > playlist load favoritesโช > spotify playlists
# Shows your Spotify playlists
โช > spotify show 1
# Shows tracks in playlist #1
โช > play 5
# Plays track #5 from that playlist
โช > shuffle
# Shuffles and continues playingkaiyafi/
โโโ main.py # Main application entry point
โโโ player.py # Music player logic (pygame-based)
โโโ music_sources.py # YouTube Music & Spotify integration
โโโ ui.py # Terminal UI components
โโโ config.py # Configuration management
โโโ requirements.txt # Python dependencies
โโโ README.md # This file
โโโ SPOTIFY_SETUP.md # Detailed Spotify setup guide
โโโ .gitignore # Git ignore rules
-
YouTube Music - Primary source for free music streaming
- Uses
ytmusicapifor searching - Uses
yt-dlpfor downloading audio streams - No API key required!
- Uses
-
Spotify - Optional integration for playlist access
- Uses
spotipyfor API access - Requires developer credentials
- When playing Spotify tracks, the app searches YouTube Music for the same song
- Uses
-
Audio Playback - Uses pygame mixer
- Downloads audio to temporary files
- Converts to MP3 using FFmpeg
- Supports volume control and seeking
-
Storage - All data stored locally
- Config:
~/.music_player/config.json - Playlists:
~/.music_player/playlists.json - Cache:
~/.music_player/cache/
- Config:
- Ensure FFmpeg is installed and in your PATH
- Check system volume settings
- Try adjusting volume with
vol 50
- Verify Client ID and Client Secret are correct
- Ensure redirect URI is exactly
http://127.0.0.1:8888/callback(not localhost) - Make sure you clicked "Add" and "Save" in Spotify dashboard
- A browser window will open for first-time authentication
- Update yt-dlp:
pip install --upgrade yt-dlp - Some videos may be region-restricted or unavailable
- The app uses temporary files - ensure you have write access to temp directory
- On Windows, try running as administrator if issues persist
Contributions are welcome! Feel free to:
- Report bugs
- Suggest new features
- Submit pull requests
MIT License - Feel free to use and modify!
- rmpc - Repo that inspired me
- Video - Youtube Video that inspired me
- ytmusicapi - YouTube Music API
- yt-dlp - YouTube downloader
- spotipy - Spotify API wrapper
- pygame - Audio playback
- rich - Terminal formatting
If you encounter any issues or have questions, please open an issue on GitHub.
Enjoy your music! ๐ต


