Tracking Concerts with setlist.fm for Obsidian
This year, in my pursuit of Digital Zen, I have been downloaded and setup Obsidian. In addition to using some existing plugins, I wrote my own. These have been relatively simple plugins which lets my sync data from other apps into Obsidian in order for me to keep track of everything in one place, offline and accessible.
This plugin is for setlist.fm, a website that keeps tracks of band tours and their setlists. I’ve found this to be useful for figuring out what songs they play. There’s also a social aspect of it. Logged-in users can say they attended a given concert. So I decided to create a plugin that would download could download that list.
It’s a relatively straightforward integration. First you need to get an API key, which is easy to get.
Once you have an API key, you can make queries for any user on the platform. In particular you can make a GET
request to /user/${username}/attended
.
async function fetchPage(username: string, page: number, apiKey: string): Promise<SetlistAttended> {
const res = await requestUrl({
url: `https://api.setlist.fm/rest/1.0/user/${username}/attended?p=${page}`,
headers: {
'X-Api-Key': apiKey,
Accept: 'application/json',
'Accept-Language': 'en',
}
})
return res.json
}
This request is paginated starting from page 1, so you may need to call it a few times:
const setlists: Concert[] = []
let page = 1
while (true) {
const concerts = await fetchPage(this.settings.username!, page++, this.settings.apiKey!)
setlists.push(…concerts.setlist)
if (concerts.setlist.length < concerts.itemsPerPage) {
break;
}
}
I take this raw JSON data and turn it into a list in Markdown with some rich formatting and internal links to help you keep track of cities you visit.
const syncedContents = setlists.map(c => {
// go from 16–08–2024 to 2024–08–16
const ed = c.eventDate.split('-')
const journalDate = `${ed[2]}-${ed[1]}-${ed[0]}`
return `- Saw **${c.artist.name}** play at *${c.venue.name}* in [[${c.venue.city.name}]] on [[${journalDate}]]`
})
So you end up with a file called Setlist.fm Concerts Attended.md
with a list like:
- Saw **Carbon Leaf** play at *Racket* in [[New York]] on [[2024–11–08]]
- Saw **Andrew Bird** play at *The Rooftop at Pier 17* in [[New York]] on [[2024–08–16]]
- Saw **San Fermin** play at *Racket* in [[New York]] on [[2024–04–05]]
- Saw **Darlingside** play at *Music Hall of Williamsburg* in [[Brooklyn]] on [[2022–05–08]]
- Saw **Valley** play at *Irving Plaza* in [[New York]] on [[2022–02–18]]
I haven’t put a lot of concerts into Setlist, but now that I have more access to my data, I think I may start to use it more.
All the code is available on GitHub for anyone who wants to take a look. Or you can install it to your Obsidian vault.