blog.oat.zone
λ
cd /you-wouldnt-download-a-car/

You wouldn't create a tool to download cars

· by jill

Listen, I know it might sound like the post title is unrelated at first, but stay with me here...


So, as some of you may know, I'm an audiophile. I know, it's unfortunate, but I am cursed with not being able to listen to music if the hardware isn't overpriced and the filesize of the song isn't over 50MB. So I got myself really high quality headphones, which, you'd expect to be the end of wasting money for the purpose of placebo. But no, turns out there's a bit more.

A Bluetooth Audio Board. Despite the post being about Digital Audio Converters, this is the best stock image I could find..
Photo by Manik Roy / Unsplash. Because what's a blog without irrelevant stock photos.

Every single device that can output sound has a little device in it called a DAC. DAC stands for Digital-Audio Converter, which does what it says on the tin - it converts audio from your computer into something that can be used by a hardware sound output device. Speakers, headphones, whatever it is, it needs a DAC to convert computer sounds to be heard.

My computer also isn't the best. It's this hunk of garbage that has been keeping me afloat for the past 8 (as of writing) years. It barely works, it's very bad by today's standards, but it does me well.

So here's the problem; the DAC in it sucks.

Audio sounds awful (relatively speaking) on this PC. It's sometimes noisy, doesn't capture lower frequencies, and just, has other flaws I can't describe (despite being an audiophile). The DAC in my phone however, works just fine, and is way better, actually.

So I got accustomed to using my phone for music. Often I just, listen to music there whenever possible, as it's just higher quality. And this brings up the problem of getting the music itself; while on my desktop PC I have a pretty sizable collection of music (around 60GB, 4,000 songs), on my phone I have none.

The logical solution anyone would take is just, move some files over from my PC to my phone. However, I'm not smart and I don't make smart decisions, so I overengineered a music downloader for me to use on my phone.

A web interface. There's a textbox at the bottom, containing "eliminate" inside (as in, the music artist). Below it are many entries, one per album, each having a download button and a song list.
Typing in my objectively based music taste into the downloader.

Now, you may think, and should think, "wait, what"? How and where am I getting music from? The logical solution would be, well, from my PC, but I decided to go the extra mile and download music externally.

So, in short, Deezer is a music streaming platform you may or may not have heard of. It's pretty obscure and is used by, practically noone, but most music is put on there as it's just, another Spotify. If an artist is publishing some song or whatever, they're likely to see "Deezer" as an optional platform to publish to and check it because, well, why not, right?

Deezer's DRM sucks.

Its DRM has been reverse-engineered up the ass a long while ago. There was first Deezloader, a program which just reversed the DRM and used it to create a streaming platform, but that got taken down and the project was abandoned (which, like, why not instead of taking down the project as a short-term solution, go ahead and fix the DRM in the first place???). Then came Deemix, another similar downloader, this time as a library for Python and JavaScript, with which the Deemix GUI was made.

The Deemix GUI. It consists of many tabs on the left, currently focused on the Home tab, and in it are listed a bunch of popular playlist, the sort of thing Deezer would recommend an average user. There's also a downloads drawer seen on the right.
The GUI, as presented on the Deemix site

Now, I'm not saying piracy is okay. I'm not saying it should be legal and I'm not saying it's morally okay. But this is kinda sick. You reverse-engineer a DRM system, and then use it to create a song downloader, which can fetch most songs put on streaming services? It's really neat. The problem is, it doesn't run on mobile devices. So that's where the program I made comes in.

So, you remember how I mentioned how Deemix has its own JavaScript and Python libraries? Overnight, I sketched together a system that looks somewhat like this:

A very bad-looking diagram of an old-styled Apple mobile device, connecting to a cloud server labelled "my code", which in turn connects to Deezer. The Deezer logo is stretched and low-quality, and underneath it is cut-off text that says "deezer nutser".
Like, why would you name a platform "Deezer" and not expect "deez nuts" jokes?

The idea is that anyone can self-host this service, and then anyone can access said instance of the service, download songs, and a single Deezer account is shared between everyone on an instance. My original sketch also included an account system, but I never really decided to implement that. (As in, it's "planned for implementation", but I never really got to doing that..)

Of course, the first roadblock I faced was the fact that I uh, didn't know shit about front-end web bullshit? I kind of just winged it and hoped that whatever I threw together worked and, it surprisingly did. I mostly picked random colors that looked nice, and using a design from the first mental image my brain had, I made a simple design. Of course, it was jank, and wasn't without its novice front-end developer bugs.

Album displays, stacked up in a humorous way. They seem to be all intersecting each other, stretching out to infinity, but all text and cover art is still comprehensible as it never goes into where another album displays, only the bounding boxes do.
Tip? Never use float: right. Just, don't even consider it.

But, after a bunch of work, websocket and TypeScript suffering, (I still wish I could instantly learn a better language overnight), I made it all worked. And you can check out the fruit of my labour on the Git page here!

There is no official instance for it. There never will be, out of legal concerns, as I'd rather encourage people to host their own friend group instances of it rather than having everyone flock to one "official" instance and have them be responsible for their legal issues, instead of having the project be at high risk of being taken down. But I'm proud of my work either way, no matter what the legal status of it might be.

I learnt quite a bit making this project, actually. Firstly, I now understand the pains of front-end web development. Secondly, I learnt just how much the web standards actually suck. And thirdly, I learnt that I should never attempt a project of this type again. Don't get me wrong, I like what I've done, but I never wish to endure the pain of HTML, CSS and JavaScript all in the same basket of garbage, garbage and even worse garbage. (Which one is which is left up to reader interpretation.)

And remember, your bestie Jill "oatmealine" Monoids would never commit piracy. The story I wrote as for the reasoning why I made this? All fake. Educational and research purposes. I would never do cybercrime.


published