navidrome on this day

I was looking up functionality for the music player that I use on Android when I came across this unrelated post.

So I want to add a smart playlist of albums to my home screen with the condition that albums only show up on it if their release month and day (not year) matches whatever today's date is. I wanted to call it "on this day", mostly stealing a plexamp thing that I like. Is that possible to do on on here? I'm not really sure how to go about it if it is.

It's not possible within the app, natively. I thought this was a fun challenge and wrote a quick bash script that approximates this. The Android app works with a multitude of apps and my solution is specifically for Navidrome running on Linux so I decided not to try to remember my 20-year-old reddit account login and reply, given that it could be useless to this person.

Navidrome has a smart playlist feature where you can create .nsp files and drop them into a folder on your host machine that Navidrome can then use to generate dynamic in-app playlists. You can see they're pretty easy to parse. However, there's no functionality that lets you show all songs with a originaldate tag of whatever the current month/day is, irrespective of year.

My approach was to write a bash script that generates an .nsp file containing a long list of dates, going back however many years I specify (50 in this case), based on whatever the current date is, and then set that up on a cron schedule to run every morning. I have a decent grasp on bash scripting, although cat <<EOF always trips me up, so I did refer to an AI tool to help me build that.

First, we create some variables.

OUTPUT_FILE="OnThisDay.nsp"

CURRENT_YEAR=$(date +%Y)
CURRENT_MONTH=$(date +%m)
CURRENT_DAY=$(date +%d)

Then, build the start of the JSON structure that Navidrome reads:

{
echo "{"
echo ' "name": "On This Day",'
echo ' "comment": "Albums released on this day over the past 50 years.",'
echo ' "any": ['

The bulk of the file is basically a bunch of "show if originaldate = today - 1 year or today - 2 years or today - 3 years, etc. So if I ran it today, I'd have a large file with April 29 dates going back 50 years (or whatever I specify). Finally, finish it with the sorting string. I have the playlist sorted original date descending, then album/tracknumber ascending (so the albums get grouped together correctly).

for i in $(seq 0 50); do
# Calculate the year for this iteration
YEAR=$((CURRENT_YEAR - i))

# Format the date string YYYY-MM-DD
DATE_STRING="${YEAR}-${CURRENT_MONTH}-${CURRENT_DAY}"

# Add comma if it's not the last item
if [ $i -lt 50 ]; then
COMMA=","
else
COMMA=""
fi

cat <<EOF
{
"is": {
"originaldate": "${DATE_STRING}"
}
}${COMMA}
EOF
done
echo " ],"
echo ' "sort": "-originaldate,+album,+tracknumber"'
echo "}"
} > "$OUTPUT_FILE"

echo "Successfully generated $OUTPUT_FILE with 50 years of dates."

This generates a file that looks like this:

{
"name": "On This Day",
"comment": "Albums released on this day over the past 50 years.",
"any": [
{
"is": {
"originaldate": "2026-04-29"
}
},
{
"is": {
"originaldate": "2025-04-29"
}
},
{
"is": {
"originaldate": "2024-04-29"
}
},
{
"is": {
"originaldate": "2023-04-29"
}
},
{
"is": {
"originaldate": "2022-04-29"
}
},

{"snip"}

{
"is": {
"originaldate": "1976-04-29"
}
}
],
"sort": "-originaldate,+album,+tracknumber"
}

Then I add a line to my crontab to run the script every morning at 3 and that's it! It's a pretty simple but fun way to extend Navidrome's smart playlist functionality.

If you want the full script + instructions, I threw it up on my github here.