README.md
playy
A music player for the terminal that feels like Spotify: your music folder and all of YouTube Music in one library, played the same way. Songs you have on disk play from disk; everything else streams. Offline, it plays what you have and nothing breaks.
╭ sidebar ────────────╮╭ page ───────────────────────────────────────────────╮
│ ♫ playy ● online ││ [cover] ALBUM │
│ ⌂ Home ││ Hridayam │
│ ⌕ Search ││ Hesham Abdul Wahab · 2022 · 15 songs, 45 min │
│ ≡ Queue 25 ││ ▶ Play ⤮ Shuffle ♡ Save ⬇ Download ◉ Radio │
│ ⬇ Downloads ││ 1 Manasse Manasse Hesham Abdul Wahab ⬇ 3:11 │
│ YOUR LIBRARY ││ ▃▅ Darshana Hesham Abdul Wahab ♥⬇ 3:46 │
│ ♥ Liked Songs 124 ││ 3 Mukilinte Hesham Abdul Wahab 2:56 │
╰─────────────────────╯╰───────────────────────────────────────────────────────╯
[art] Darshana ♥ ⤮ ⏮ ⏸ ⏭ ↻ 🔊 ▮▮▮▮▮▮▯▯ 80%
[art] Hesham Abdul Wahab 1:23 ━━━━━━●──────────── 3:46 ⬇ 2
[art] ⌁ from your files · from Album · Hridayam
Install
Arch Linux (AUR):
yay -S playy # builds from source
yay -S playy-bin # or the prebuilt binary
From source: Go (the version in go.mod), plus mpv, yt-dlp and
ffmpeg:
sudo pacman -S go mpv yt-dlp ffmpeg # Arch / Omarchy
make install # ~/.local/bin/playy + a launcher entry (on Omarchy: a TUI app, Super+Space → playy)
playy
kitty (or ghostty) shows sharp cover art; other terminals get block art.
How it works
- One library.
~/Musicis read in the background (tags, or the file's name and folders when it has none; audio and video). Songs you play, like, add to playlists or download from YouTube Music join it. - Local first. Before streaming, playy looks for the song on disk: a
download of it (by its YouTube id, kept in the file's tags) or the same
song already in your folder (title, artist and length match). It says
which:
⌁ from your filesorstreaming. - Fast. The stream of the song under the cursor and the next songs in the queue are fetched ahead of time, and the next song waits behind the current one in mpv: no gap between songs, skips are instant.
- Endless. When the queue runs out, similar songs keep playing (YouTube Music's radio, or your own library when offline).
- Light. Idle, playy uses about 0.1% CPU and 45 MB; playing, mpv adds about 1% and 100 MB. Nothing redraws unless something on screen moves, and with the window closed nothing is drawn or timed at all (playy itself: under 0.1% CPU while the music plays). If mpv ever dies, a new one carries on where the song was.
- Always on. Like tmux, there's one playy: closing the window (
q) leaves the music playing;playybrings the window back,playy --stopquits. Media keys,playerctland the desktop's now-playing widget work (MPRIS); notifications show each song while the window is closed.
Downloads that work
d on a song (or ⬇ on an album or playlist) keeps it offline:
- the original audio (Opus, no re-encoding; or MP3, M4A, FLAC if you choose), fetched in chunks so YouTube doesn't refuse it (403);
- a square cover embedded (1000 px), clean tags (title, artists,
album, track, year), synced lyrics as a
.lrcfile and in the tags; - filed as
~/Music/Artist/Album/02 Title.opus; - checked: a file with no sound, cut short, or without its cover is
never shown as done; it says what's wrong and
↻ Retry failedfixes it.
A playlist marked ⬇ Keep downloaded stays complete: songs you add are downloaded too. Settings can do the same for Liked Songs.
Keys
? shows them all. The ones to know:
ctrl+p | find a song: your library at once, YouTube Music as you type. enter plays, tab adds to the queue (and stays open for more), shift+tab takes it back out, alt+enter plays next, ctrl+d downloads, ctrl+l likes, ctrl+w watches the video |
ctrl+shift+p (or F1, :) | commands, pages, playlists, artists, albums by name (:q! quits) |
ctrl+, | settings |
/ | search (results from your library first) |
enter | play (the rest of the album/playlist follows) or open |
space n p | play/pause, next, previous |
← → + - | seek, volume |
f a A d P R | like, add to queue, play next, download, add to playlist, radio |
w | watch the song's video in mpv (your file if you have it, else YouTube) |
I | incognito: nothing you play or search is remembered |
. | everything you can do with the song |
z | now playing: big cover and synced lyrics |
Q L | queue / lyrics beside the page |
g h g s g l g m g q g d | go to home, search, liked, music folder, queue, downloads |
tab esc | sidebar ⇄ page, back |
Finding your own music is forgiving, and works offline: every word
you type has to match somewhere in a song (title, artists, album, its
folders, its file name), by the start of a word (hai → Haikyuu),
initials (fma → Fullmetal Alchemist, bol → Better Off Alone), the
inside of a word, or letters in order. So an hai is the Haikyuu song in
your Anime folder. Folders are results too: enter plays one, tab queues
it all.
Lyrics follow the song: the line being sung sits in the middle and
fills with colour as it's sung (z full screen, L beside the page).
Lyrics found for a song you have are kept as an .lrc beside it, and
while online playy quietly finds them for the rest of your folder, so
they're there offline.
Reorder the queue and your playlists by dragging a song with the
right mouse button (or J/K); a right click without dragging opens the
song's menu.
The player bar always shows what the keys do with what's selected, and its ≡ Queue and ♪ Lyrics buttons open them beside the page.
kitty: terminals send ctrl+shift+p and ctrl+, like ctrl+p and
,; add to kitty.conf (only affects playy):
map --when-focus-on var:playy ctrl+shift+p send_text all \e[25~
map --when-focus-on var:playy ctrl+comma send_text all \e[28~
The mouse works too: click anything, double-click plays, right-click for the song's menu, drag any progress bar's knob to seek, scroll over the volume to change it.
From the shell (key bindings, bars): playy toggle, playy next, playy prev,
playy status.
Friends' Spotify playlists (experimental)
Paste a Spotify playlist, album or song link into ctrl+p (or Search, or
ctrl+shift+p → Open a shared link, or Open the link in the
clipboard). It opens at once with Spotify's names; behind it each song
is found in your music folder or on YouTube Music (title, artist and
length agreeing), the ones you look at first, and remembered. Press play
right away: a song not found yet is found when its turn comes. + Save
as my playlist makes it one of yours (rename, reorder, remove, keep
downloaded); it stays under Shared with you in the sidebar (x
removes it). YouTube song and playlist links open the same way. No
Spotify account is needed; Spotify can change its pages, which may break
this.
Your profile, on any machine
Settings → Your profile (or ctrl+shift+p → export / import) saves
everything playy knows about you to one file, playy-profile-DATE.playy:
liked songs, plays and history, playlists (with their order, pins and
kept-downloaded), followed artists, saved albums, searches, matches of
shared songs, lyrics found, and settings. Importing merges it into the
profile you have (twice changes nothing). Music files aren't in it: songs
stream until kept-downloaded playlists download again, and files you copy
into the same places of the music folder reconnect. From the shell:
playy export [file], playy import [file].
Settings
g , (or F1 → Settings) changes them live; they're kept in
~/.config/playy/config.ini: music folder, download format and layout,
lyrics, themes (Rosé Pine, Moon, Dawn, Catppuccin, Tokyo Night, Gruvbox),
loudness levelling, autoplay, offline mode, region. The library is
~/.local/share/playy/library.db; covers and logs are in ~/.cache/playy.
Development
make test runs the tests; PLAYY_LIVE=1 make test also downloads and
streams a real song (silently). PLAYY_MPV_ARGS=--ao=null playy --foreground
runs a silent copy in this terminal.
playy is independent of YouTube and Google. Download only what you may.