20 ms·
Show HN: kew – A Terminal Music Player for Linux
Hi HN,
I created kew, a music player for the Linux terminal.
This started when I asked myself: what if I could just type something like "play nirvana" in the terminal and have the rest taken care of automatically? That got the ball rolling and I kept adding stuff: covers in ascii and then as sixel images, a playlist view, a visualizer, a library view and finally search.
While kew can be used as a commandline tool, it has evolved into a TUI app.
Here are some example commands:
kew nirvana # Plays all of your Nirvana songs, shuffled
kew nevermind # Plays the "Nevermind" album in order
kew spirit # Plays "Smells Like Teen Spirit"
kew all # Plays all your music, shuffled
kew albums # Plays one album after the other in random order
It works best when your music library is organized like this:
Artist/Album(s)/Track(s)
kew is written in C and licensed under GPLv2.
Source and screenshot: https://github.com/ravachol/kew https://github.com/ravachol/kew
- jakobdabo 2y agoI see what you've done there! int randomNumber = getRandomNumber(1, 808); if (randomNumber == 808) printGlimmeringText(text, nerdFontText, lastRowColor); Nice project!
- ravachol 2y agoThat's an easter egg! Gj! You're the first that has mentioned it.
- martinbaun 2y agoThis is exactly what I was looking for! I actually started writing something myself. And I "compiled from source" as I am using Fedora, but it was just one command. Thank you!
- ravachol 2y agoGlad you are liking it!
- martinbaun 2y agoI love it man, this is great! I used to use mocp but I could never get it to work on Fedora. This here is even better, I love the minimal approach.
- ravachol 2y agoThat's great! Get involved if you want and suggest features for instance.
- atrus 2y agoI love the readme, and I wish that every project had one this great. And it player looks awesome as well!
- ravachol 2y agoThanks, yes the readme is really important. A lot of projects would benefit from spending a bit more time on it.
- politelemon 2y agoI agree, the README makes me want to try it tonight when I get home. This project is very interesting and worth trying.
- kopirgan 2y agoRequires Debian 13?
- ravachol 2y agoYou know I'm not sure. I think there was some problem with FFmpeg in earlier versions, but I'm not 100% sure. There shouldn't be a problem trying to install it in earlier versions though.
- BoingBoomTschak 2y agoIt's is pretty cool, I can feel the energy poured into making your personal computing experience more seamless! Though the first thing I wondered when reading your examples is "how is ambiguity resolved?". Like albums, artists and tracks having the same string or sharing a prefix (search in this specific order, I guess?); or artists having the exact same name. The aspect I like the most is using the filesystem as a database, since that's what UNIX people should like (and you can use symlinks for more complex cases). In fact, I myself made a music player with that as central philosophy, though it is much more bare/suckless compared to yours: https://git.sr.ht/~q3cpma/mus https://git.sr.ht/~q3cpma/mus Did you consider implementing a simple event system (maybe even IPC) for track and status change? Possibly MPRIS or something simpler. That was the main feature I kept from cmus when creating mus, so that I can easily interact with it through lemonbar and scripts.
- ravachol 2y agoThank you. To answer your first question, ambiguity isn't resolved unfortunately. When the album has the same name as the artist for instance, I have sometimes resorted to renaming the album name by adding "album" to it. You can however get an exact search by adding -e so that resolves some problems. Yes, MPRIS is supported.
- leapon 2y agobrew install failed on macos % brew install kew ... kew: Linux is required for this software. Error: kew: An unsatisfied requirement failed this build.
- ravachol 2y agoYes, unfortunately it only works on Linux and FreeBSD. I should add that to the readme. EDIT: Added.
- jeffhuys 2y agoWhy, though?
- ravachol 2y agoBecause I'm just one guy with a few people helping me a little bit. I needed a limited scope. But I'm actually thinking of porting it to Mac now.
- jeffhuys 2y agoI don’t think you need to port that much as macOS is based om freeBSD
- deleted 2y ago[deleted]
- jhatemyjob 2y agoCus they like Stallman too much
- VyseofArcadia 2y agoSlick! I love it. It doesn't fit my use-case very well, though. I'm not saying it needs to, but I'm going to put my use-case out there in case someone is looking for project ideas. We have oodles of music players on Linux, GUI and terminal. But we have very few choices that * are optimized for the absurdly, comically large library of someone who has been diligently collecting and organizing music for decades * collect playback statistics and allow user rating of songs * that can be used to create smart playlists I used amarok for years, but it keeps dying and reviving, and I don't trust it to stick around. I then used mpd for years, but while mpd excels at large libraries, the other two requirements have to be implemented client-side, and the experience was always at least a little janky. I currently use Strawberry, but 1) it chugs with a large library, 2) its smart playlists aren't expressive enough, and 3) it is also kind of janky, and I experience frequent crashes. The only player I've found that really fits my use-case like a glove is MediaMonkey, but I walked away from Microsoft years ago, and I'm not about to go back now just to wrangle my music library.
- ravachol 2y agoYes, while a comically large music library is supported in principle (kew offers to cache your library if it takes a long time to search through), it might not be entirely suited for it. As for your other two suggestions those fall outside the scope of kew. kew is supposed to be simple with minimal bloat.
- VyseofArcadia 2y agoI will by trying it out on my laptop which has only a fraction of my library and I don't use often enough to want statistics or smart playlists.
- sandreas 2y agoNice, thanks for sharing your thoughts. Currently, I use navidrome[1], which not really is a player but more a music server, but since it supports the "subsonic" protocol, you can use native apps to connect and manage your stuff (substreamer for android / iOS is all I really need but navidrome also comes with a handy web interface). It also has support for json based smart playlists[2]. 1: https://www.navidrome.org/ https://www.navidrome.org/ 2: https://github.com/navidrome/navidrome/issues/1417 https://github.com/navidrome/navidrome/issues/1417
- cdaringe 2y agoI love the idea. My music is now 50% cloud only, 50% on disk. I mean, its 100% in the cloud, i just have local files for half available. Ive been thinking about self hosting some music provider thingy (or even just supporting ssh via my dyndns-like capability) to my NAS and bringing music back to self owned files. However, it is work to do when the internet is pretty reliable, costs are low, etc. Those who love this conceptually but have/had cloud music, did you act? How/why?
- reverend_gonzo 2y agoI have a airsonic (fork of subsonic, which I used for a long time) server running on a vps. I’ve probably had this for coming on 20 years now. It works phenomenally. At some point I was going to mirror it locally, but never got around to it. It is all backed up in dropbox
- lunchables 2y agoI've also been a long time airsonic (and now airsonic-advanced) user for so long I can't even remember, but a couple years ago I switched to navidrome which is also subsonic compatible and it's sooo much nicer. Use whatever you want! Just wanted to suggest it.
- nvllsvm 2y agoI used various Subsonic clients for a number of years, but the clients were always lacking. Android clients were buggy or didn't prioritize local caching and I preferred to use mpd+ncmpcpp on my laptop. I ended up switching to fully-local media after realizing that my 956GB flac+mp3 would be ~159GB when converted to Opus. I now use https://github.com/nvllsvm/harmonize https://github.com/nvllsvm/harmonize to maintain a 128kbps Opus version of my main library and Syncthing to synchronize it to my phone and laptop. --- side note, Auxio is the client I'm using on Android with my synced library.
- raun1 2y agoI host my music on an Unraid box on my home LAN, use Plex+Plexamp to serve and access it, and 1000% recommended Plex+Plexamp. It is, without a doubt, the best music app I've used on a phone, including other self-hosting solutions, local apps like Poweramp, and commercial streaming apps like Spotify. I really can't speak of it highly enough.
- molticrystal 2y agompv --vo=caca
- edgarvaldes 2y agoRandom album is great. Few players do it right.
- udev4096 2y agoI personally use a self hosted musikcube server [0] for playing songs. It has a great TUI and an android app. Highly recommended! [0] - https://musikcube.com/ https://musikcube.com/
- kunley 2y agoApart from all the audio goodies, that's one of the few projects around that has actually working make uninstall. So much thanks for giving a good example
- ravachol 2y agoYou uninstalled it. :(
- kunley 2y agoNo, I didn't! But I was happy to see such a makefile target exists and one doesn't need to go through console logs to see wtf was installed, or just shrug and think "yet another project made like it's the center of the universe"
- ravachol 2y agoOh ok, my bad! And GOOD. I agree it's important. kew is so small it was pretty trivial to do.
- mass_and_energy 2y agoHmm I wonder how hard this would be to hook into my Jellyfin server, has anybody tried?
- whoomp12342 2y agogreat, now my coworkers will have a new interesting way of rick rolling me -> while I run my build scripts
- smartmic 2y agoI use mpd with various clients, mostly also from terminal. mpd support would be great - and actually the only reason for me to try it out. https://www.musicpd.org/ https://www.musicpd.org/
- n2j3 2y agoCool, but does it scrobble?
- ravachol 2y agokew does not scrobble. It does not track any of your listening habits or anything else for that matter.
- sigmonsays 2y agoTrying to nix run it I get a ton of insecure warnings and it lists the CVEs Is this a nix thing (i'm unsure what freeimage-unstable is) error: Package ‘freeimage-unstable-2021-11-01’ in /nix/store/20yis5w6g397plssim663hqxdiiah2wr-source/pkgs/development/libraries/freeimage/default.nix:72 is marked as insecure, refusing to evaluate. Known issues: - CVE-2021-33367 - CVE-2021-40262 - CVE-2021-40263 - CVE-2021-40264 - CVE-2021-40265 - CVE-2021-40266 - CVE-2023-47992 - CVE-2023-47993 - CVE-2023-47994 - CVE-2023-47995 - CVE-2023-47996
- ravachol 2y agoFreeImage is used by Chafa to display the covers in the terminal. The version of kew packaged for Nix is very old: v1.5.2. We're at version 2.8.2. So it's more than a year old, from very early on in the project.
- ravachol 2y ago"Buffer Overflow vulnerability in Freeimage v3.18.0 allows attacker to cause a denial of service via a crafted JXR file." I don't know how relevant these vulnerabilities are to kew, which isn't run across the network in any way, it just reads your local files. Thank you for bringing this to light. I don't know how feasible it is to use something other than freeimage though, gonna have to investigate.
- joveian 2y agoIt is still relevant because sometimes those local files come from the network and aren't trusted. Looks like a nice project, I like the terminal album art display :).
- cebu_blue 2y agoKekW
- theandrewbailey 2y agosudo bash -c "curl https://raw.githubusercontent.com/ravachol/kew/main/install.sh | bash" Might as well run unsigned binaries straight from the internet. What is this, Windows?
- ravachol 2y agoGood point. Might be better to just have the commands installing the requirements for the different distros, in the readme.
- ravachol 2y agodone.
- shepherdjerred 2y agoSuper weird to bring Windows into this, but, anyway? I actually really like these one liners even if they have greater potential for abuse.
- halJordan 2y agoIt's not weird to mention the other os where downloading and blindly double-clicking a naked exe is the standard.
- shepherdjerred 2y agoUsers do the exact same on macOS, Android, iPhone, and Linux
- ravachol 2y agoHe's right actually the quick-install script is pretty barbaric.
- yarg 2y agoDoes it accept flags to deal with ambiguities? Defaulting to the only result in your library is perfectly reasonable, but it the case of a collision, what does it do? My guess is that it runs through in a loop (I haven't looked at the code) and simply goes with the first result that it finds, but that doesn't cover all possible use cases.
- ravachol 2y agoLike you said, it just takes the first result it finds. There is -e for exact search, which solves some problems, but it's not a full blown solution.
- yarg 2y agoI'm thinking {-s, -l, -a, -p} for {song, album, artist, playlist}. Unlike the -e solution, it wouldn't make the command significantly more verbose than the default option. You could also print a list of commands for the specific options (or allow for index based selection) in cases where there were collisions.
- ravachol 2y agoThat's already mostly in. From the readme: kew dir <album name> (sometimes it's necessary to specify it's a directory you want) kew song <song> (or a song) kew list <playlist> (or a playlist) The directory can be an artist or an album, so there's still ambiguity there. But kew cannot differentiate between the two. It matches against files or against directories.
- yarg 2y agoYeah, to fix that you'd need to add support for media metadata, which I imagine is a little further than you'd want to go.
- fallat 2y agoBut can we make it smaller
- retrodaredevil 2y agoI've been using Plexamp for the past 4 years, and its been great for music on my phone and computer. One thing it lacks is a good offline mode. Recently I started syncing my media to my laptop as a backup, and as a way to locally play 5.1 FLAC audio (Plexamp doesn't support 5.1 audio). I'll have to check this out. I wonder if it can play 5.1 audio correctly?