Skip to content

Instantly share code, notes, and snippets.

@basilhayek
Last active August 2, 2018 01:15
Show Gist options
  • Select an option

  • Save basilhayek/81cff5140ae2e40eb2c39712355cf817 to your computer and use it in GitHub Desktop.

Select an option

Save basilhayek/81cff5140ae2e40eb2c39712355cf817 to your computer and use it in GitHub Desktop.
A simple bookmarklet to make it easy to convert playlists posted on setlist.fm to a service of your choice using www.playlist-converter.net (two great sites!)
var t = document.title;
var b0 = "";
var s = "";
if (window.location.hostname === "www.setlist.fm") {
if (t.includes("Average Setlists")) {
b0 = t.substring(0, t.indexOf(" Average Setlists"));
} else if (t.includes("Concert Setlist")) {
b0 = t.substring(0, t.indexOf(" Concert Setlist"));
}
// Make sure we're on a supported page by checking if we have the band name
if (b0 !== "") {
// Iterate through all the songs
for (a of document.querySelectorAll("a.songLabel")) {
b = b0;
// Sometimes songs in the setlist might be from another artist; so use those instead
for (b2 of a.parentElement.parentElement.querySelectorAll("div.infoPart > small.fontSmall > a")) {
if (b2.textContent.trim() !== "") {
b = b2.textContent;
}
}
// Build the entry for the song
s += b + " - " + a.textContent + "\n";
}
// Jump over to playlist-converter.net
window.open("http://www.playlist-converter.net/#/freetext=" + escape(s));
}
}
javascript:!function(){var t=document.title,e="",n="";if("www.setlist.fm"===window.location.hostname&&(t.includes("Average Setlists")?e=t.substring(0,t.indexOf(" Average Setlists")):t.includes("Concert Setlist")&&(e=t.substring(0,t.indexOf(" Concert Setlist"))),""!==e)){for(a of document.querySelectorAll("a.songLabel")){b=e;for(b2 of a.parentElement.parentElement.querySelectorAll("div.infoPart > small.fontSmall > a"))""!==b2.textContent.trim()&&(b=b2.textContent);n+=b+" - "+a.textContent+"\n"}window.open("http://www.playlist-converter.net/#/freetext="+escape(n))}}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment