2022-08-17
word count: 974
approx reading time: 5 mins
a month ago i made albumoftheday, a website that selects a random album every day out of a pool of suggestions made by people (you can suggest your favorite album here!)
i built it because im tired of algorithmic recommendations, i wanna see the obscure albums an algorithm would never recommend! i wanna see that random bandcamp album a friend recommended to you 2 years ago that made you cry at 3am, i want the weird stuff!!
of course, any kind of album is welcome. if you really liked pitbull's latest release, no one is stopping you from adding it. in fact, please do! i've found that albumoftheday is a great way to force myself to listen to albums i normally wouldn't have, and so far in every single case i've found something i enjoy in each of them
remembering to check a website every day is not easy, so i built a twitter and a fediverse bot that posts each day's album at midday in UTC
i try to write my thoughts and opinions as comments under the fediverse posts, and i welcome you to do the same! i think it's cool to see how other people feel about art
albumoftheday is built using axum and muxa, which is the stack i use for basically all of my websites nowadays. i'm using an sqlite database, as it's a pretty light website, and most of the database use is reads. thanks to sqlx, all sql queries are checked at compile time to ensure there are no issues there
the website doesn't use a cronjob to choose the album because i'm prone
to running crontab -r
instead of crontab -e
i like
overengineering i like quantum mechanics i wanted a more reliable
system. instead, albums are chosen the first time someone visits the
site that day. this is done by keeping a history of each album that has
been selected, and checking if one has already been chosen for today
every time someone opens the main page. if it hasn't, one is picked at
random, preferring albums that have never been picked before
if a tree falls in the forest, and there's no one around to listen, does an album get selected?
the bots do run on a cronjob, which is basically 0 12 * * * ./bot
,
where bot
is a small rust binary that gets or generates the day's
album, and then makes post requests to
https://botsin.space/api/v1/statuses
and to
https://api.twitter.com/2/tweets
. i'd normally write things like these
as a node.js script, as it's usually faster and simpler, but writing it
in rust allowed me to reuse code with the rest of the project
the biggest point of difficulty is obtaining an album's name, artist(s),
link, and album art. my first plan was to use the
musicbrainz api, but then i realized it
doesn't have links to streaming sites. i ended up taking two approaches,
one for spotify and one for bandcamp. the former provides an api, which
is nicely wrapped as the
rspotify crate. for
bandcamp links i wrote a scraper that reads json data out of a
<script type="application/ld+json">
tag contained in the page, which
seems to work reliably
obviously, the scraper will fail if bandcamp decides to rework their site, so to sidestep any issues, any links that fail to parse are stored in a table, so that i can re-run the scraper after i fix it. any links that are not spotify or bandcamp are also stored on this table, so you can submit soundcloud or youtube links, but they won't be added as actual album submissions until i write a scraper for them
as of the time of writing, there's been 139 albums submitted, and 34 of them have been selected. genres range wildly, from hyperpop to hip hop to ambient to edm to rap to indie rock to many others
i do not keep page visit analytics, so i don't know how many people are visiting each day, but the fediverse bot has 18 followers and the twitter one has 14. most posts get between 0 and 4 favorites/boosts, but that's not really indicative of how many people actually check out the songs. not like i'd be able to check anyway, since the posts link directly to the albums
sorry if you are a graphs person, i don't have enough data to make any meaningful plots, but here's this cool graph to compensate:
i'd like to add support for youtube and soundcloud albums, since there's some really cool stuff that's only available there. i'll also try to provide links to multiple music streaming services, since there's people who don't use spotify
i've also been toying with the idea of adding webpush notifications, mostly cause im curious to see how they work and how to implement them. the idea would be that you click a button and it asks at what time you'd like to be notified, and then you're set. i don't think many people like when websites send them notifications, so i doubt it'll get much use, but i don't really mind
i've considered making a newsletter-ish kinda thing, that sends an aggregated email once a week, but i think it goes a bit against the point of the website. if you'd like this, send me a dm/email
i'm still not sure if i want to display the names of the people who've suggested an album. it's an optional field on the submission form, but it doesn't say anything about it being displayed, and im uncomfortable making it public without consent/knowledge. lesson learned for next time, add a disclaimer just in case
aside from that, there's not much else i want to do. im really happy with the core of the website, but if you have any feedback or suggestions, please let me know!