Created
August 16, 2012 21:05
-
-
Save kaylarose/3373664 to your computer and use it in GitHub Desktop.
Bookmarklet to Export Rdio Playlist (Artist=>Track) in csv format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function() { | |
var bookmarklet = { | |
bootstrap: function() { | |
var self = this; | |
if (!window.jQuery) { | |
var script = document.createElement("script"); | |
script.src = "http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"; | |
script.async = true; | |
script.type = "text/javascript"; | |
script.onload = function() { self.parse(); }; | |
document.body.appendChild(script); | |
} else { | |
self.parse(); | |
} | |
}, | |
parse: function() { | |
var playlist = ""; | |
$(".PlaylistPage:visible") | |
.children(".TrackList .Track .info") | |
.each(function() { | |
var song = []; | |
var processingName = true; | |
var $track = $(this); | |
function addData() { | |
song.push('"' + $(this).text() + '"'); | |
return processingName; | |
} | |
$track.children(".name").children("a").each(addData); | |
processingName = false; | |
$track.children(".metadata").children("a").each(addData); | |
// Export as Artist=>Track for ivyishere.org copy/paste compat | |
song.reverse(); | |
playlist += song.join(",") + "\r\n"; | |
}); | |
this.export(playlist); | |
}, | |
export: function(playlist) { | |
window.open("data:text/plain;charset=utf-8," + encodeURIComponent(playlist), ""); | |
} | |
}; | |
bookmarklet.bootstrap(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cribbed from: https://gist.github.com/3001053
Altered to support Copy/Paste mode of http://www.ivyishere.org