Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Simple access to your music from the web (github.com/dusteddk)
217 points by dusted 42 days ago | hide | past | favorite | 53 comments

This kind of software made me a web developer and got me into real programming.

My first big project, like 20 years ago, was a streaming interface to my music collection at this point around 7k mp3s.

I had almost no programming knowledge. It took me like 12 month to the first working version (http auth, usermanagement, playlists) which I iterated at least 3 more times. I think this version [1] ran for me and my shared flat people for like 3 years. Used it daily to stream music while being in school and coded my tumbelog.

Later I proceeded to rewrite it in ruby [2]. Much less code. Same features. I think it had even the functionality to not download playlists and stream but also play the music locally on the server.

At some point my goal was a wrapper to play music depending on moods, previous played songs and stuff like that (that was way before spotify existed) but I never came far.

The code is on github only for historical reasons.

[1] https://github.com/entropie/Jamp [2] https://github.com/entropie/bagpipe

Cool project. So little code.

I did the same thing, writing a simple HTTP server which had some magic to auto-generate playlists.

My server was called GNUMP3d, and was originally written in Perl, later rewritten in C:


Not a terribly original project, but it was a little popular for a while.

Interesting. I accomplish something similar with git annex, fzf, and vlc.

https://git-annex.branchable.com/ https://github.com/junegunn/fzf

cool! I like peoples custom solutions! I'm using fzf too, I found out about it here on hackaday, it was quite easy to script a nice little TUI for playing midi files (what I did) with it.

[edit] Ooooh, git annex seems super useful! I'm definitely going to have fun with that, for other things

That sounds like a great setup! Do you have a repo or write-up about it?

Yeah, so the only custom aspect is this alias in my .bashrc:

  fetchplay() {
      git annex get "$@" && vlc "$@"

Combined with the keybindings that ship with fzf, I can type "fetchplay [CTRL-T]", select some subset of the directory tree, and the files will play. Git annex will locate the files (in this case, on another machine in my apartment) and fetch them before playing only if needed (if they are already present, "git annex get" verifies that and exits silently). I have my music collection backed up on several different forms of removable media, across several machines, and on AWS S3.

Here is a recording of me fetching and playing three tracks:


Thank you for the explanation, I thought it would be way more involved! I was just getting into git-annex yesterday, and now I see how absurdly powerful it is!

Awesome. Is there any way to stream them so they don’t have to be downloaded first?

Interesting question; I'd never bothered because I tend to focus on a few albums at a time and I just keep them locally. Waiting a second or two when I want to listen to an album I haven't listened to in a while is no big deal for me. But it turns out git annex makes it easy to do this:


This makes it even more compelling to try out...

I do wonder what happens with the temp file when the full file is loaded. The quick and dirty way that most people do it is to simply delete/move the temp file as completion, but of course that interrupts the media player as the file is now “missing”. I feel like I’m going to find out shortly when I research or test...

Neat, always great when someone makes minimal software that fits their needs.

Inspiring to see it done in a relatively small amount of code, too! Right now I rely on Google Music for desktop and mobile streaming but it kind of sucks. It's nice to know I could make my own player relatively easily!

Google Music desktop kind of sucks, but works _ok_. The main reason I'm still sticking with it is because I like listening to music on my phone, and I don't want to have to stream everything. I'm very, very vaguely looking at better solutions, and have a few things bookmarked.

Isn’t Google Play music dead? Does this app connect to YT Music or something?

Yeah, I meant YouTube Music. Whatever Google's ADHD cascade has pivoted to as of most recently.

I use emby for Music (and TVshows/Movies too so it fits in my all catch mediacenter), but if you need something simple to do, maybe do something that reads an Mp3 and sets the correct id3 tags :D

Yeah, the browser really does all the lifting, it's just about exposing some files and making an interface that allows you to interact with your collection the way you like.

For anyone who wants to stream music from a server they run, I strongly recommend my setup. I run Navidrome [0] on my media machine, and then connect to it via Jamstash [1] on my desktop browser or play:Sub [2] on my iPhone. Lots of features, few bugs, pretty easy.

[0] https://github.com/navidrome/navidrome

[1] https://jamstash.com

[2] https://apps.apple.com/us/app/play-sub-music-streamer/id9553...

Does this support downloading locally on the phone?

I live in an area where I frequently lose signal for about 45 minutes (a dead zone during my drive), so that's my #1 feature.

I generally download a small subset of my music to the phone, and stream the full library when I have service. But I'm really ready to replace Apple Music--the Android experience is just so bad.

From the iOS app page, yes, it supports manual caching of a song, a folder and a playlist.

Mopidy is also a good option. The iris frontend is quite nice. I’ve been using it with icecast to send streams to my chromecast devices, but it also works well with Snapcast.

I always like minimal software like this.

I've been making and using my own music player for 8 years. And my player still a single html file under 300 loc. I also stick with nginx autoindex_format json so I don't need to run a backend server. For searching I put all music files in one single folder so I can just use the "Find in page" in Chrome. https://github.com/soruly/music/

You may also take a look at MediaSession. You can have media controls with CD covers on mobile lockscreen/notification center in just 20 lines of code. https://developer.mozilla.org/en-US/docs/Web/API/MediaSessio...

That's nice! I didn't consider dumping the database to the browser and searching there, but I tried just dumping all the links on one page, and the browser disagreed a bit with the size of the page (it was over 100 mib)

This is pretty awesome actually. I've been using it for the past few hours and changing it at will: https://github.com/sirodoht/dstream

Vanilla JS helps immensely to jump right into it actually.

Three years ago I wrote a simple web application that could stream audio using liquidsoap & icecast, there was a simple list page where people can select their music "requests" and it will be queued automatically. The main interface is on IRC, there was a DJ bot listening to request commands like !dj https://youtu.be/* and the bot will download and convert that link to mp3 if it's not in the database yet using youtube-dl and it will then be queued for streaming. It was sort of like an automated FM station for our IRC channel.

Cannot wait to get home to try this.

Perhaps I am a complete idiot, but I have off and on tried to get MPD reliable enough to do something like this and I can never make it happen consistently; the killer tends to be the separation between the interface/client and the audio stream. It's just so cumbersome and there doesn't seem to be a good reliable way to unify them easily and consistently.

Hm, ok, I know I am not a typical user today and I am using sailfish on phone, but what is wrong with mounting sftp? I dont need any additional services for streaming and it just works. For music, movies, actually whatever I want to use as long as it only uses the offsets for obtaining the metadata while it doesnt download the whole song/movie/... just to open it.

Tldr; optimized for my specific search intensive and jumpy "music listening flow" using keyboard and mouse on a desktop workstation behind a corpo wall.

There are a few reasons I couldn't live with that (I did samba over openvpn on my phone for quite a while, vlc as the player).

Primary reason is I want it to be https so I can listen to my music at work, on my workstation without needing to poke through their firewall.

Secondary reason is that I listen to music the entire day and want a very quick way to find what I want, browsing lists and picking files is not working for me, I got addicted to the "j" key in winamp many years ago and this is kind of that idea distilled and redined a bit.

I made this after seeing another player here on HN called mstream, I used it for a while but the UI managed to both do too much and not entirely what I wanted.

Having a a temporary music queue you add to and shuffle around while it's playing is sadly under rated in most music players. That's how I listen to music too.

Nice work!

This is why I MusicBee! I instantly drop a music player that cannot do this.

Can you do that with Android?

There’s definitely ways to access an SFTP drive on Android, but I’m not sure how well it’d fare offline.

I do something similar with Samba.

This looks great! I'm a sucker for trying out these front-ends to local collection served up via my Raspberry Pi.

So far my favourite has been zmusic-ng, by the creator of WireGuard: https://git.zx2c4.com/zmusic-ng/about/

Reminds me of the days with a gnump3d server.

I wrote boringstreamer to listen to my collection. I start more instances on different ports in different directories and connect to different ports similar to fm radio frequencies. With tailscale I can listen from anywhere without any explicit access control. github.com/fgergo/boringstreamer

I wish there was some sort of webrtc plugin for MPD, so I could stream my music collection at home from work.

You can. It serves over http. You can control via ssh+mpc (you'll want to turn the local volume at home to zero most likely). There's also android clients.

It's been a while since I've done this, but from what I remember the main weakness is that there's no buffering: you always hear exactly the point the mpd player is at.

I wrote something like this that's Flex (Flash)-based and was backed by Amazon S3. I learned a lot writing it, but it was so niche, and Spotify was growing so fast that I abandoned it.

How simple would this be to adapt to a raspberry pi, where the music played on the pi itself, over the 1/8" jack, instead of in the web client?

I don't know, but you could use mopidy or mpd to accomplish this.

Does this rely on tagged files? The music I'm interested in using is live shows from The Grateful Dead and Phish, and is all labelled in folders and filename. Last time I tried mpd, everything needed to be tagged.

Most clients I've used allow you to browse the library via the filesystem, even allowing you to use that as the default.

Likely not so simple.

You'd have to run the browser on the pi, which is no problem, but then you need a was to access that browser from the outside.

My goal is to use the pi as a car audio player with a USB SSD. Put the pi's wifi in AP mode. Connect a phone to the pi. Now the phone is the UI, but the audio plays through the pi, into the car's aux input.

Not at all what this was made for, but that could be a fun project and also not especially complicated (spawn mplayer on the pi)

Does this maintain any state? Lets say I start playing an album, then leave the page. Does the music restart from the same track/time, when I return, or do I need to reselect the track and start from the beginning?

Nope, the state is all in the audio player component of the browser, this is really nothing but an interface to tell the browser what file to play

This is great! Any recommendations for a similar lightweight implementation of a video/media server?

> totally a halfhearted hack, except for this markup file that I did spend a lot of time making


question: is it possible to cache the music locally somehow so you download/stream the track only once?

The simpliest way is to play (stream) the music file using <audio> tag, the resource would be cached once you have completed the playback once. Then you can go offline and start looping.

I think you could use the CacheStorage[0] framework for this, but IIRC it's not got a great size per domain and is limited by a varying amount of 5MB to 100MB depending on browser.

[0] https://developer.mozilla.org/en-US/docs/Web/API/CacheStorag...

It looks like Firefox may be different in this regard. Chrome[0] and Edge[1] allow `unlimitedStorage` to be specified that removes the 5MB default limit.

[0] https://developer.chrome.com/docs/extensions/reference/stora...

[1] https://docs.microsoft.com/en-us/microsoft-edge/extensions-c...

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact