Skip to content
This repository has been archived by the owner on Jun 28, 2019. It is now read-only.

Commit

Permalink
add Export to CSV option for playlists
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-h committed Jan 18, 2012
1 parent 3915cb6 commit 6ebecb2
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions rdio-enhancer.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,28 @@ function injectedJs() {
return false;
}
});
item.menu_items.splice(play_next_insert + 4, 0,
{
title: "Export to CSV",
visible: function() {
return true;
},
action: function() {
var i = data.tracks.length;
var csv = [["Name", "Artist", "Album", "Track Number"].join(",")];
while(i--) {
csv.push([
'"' + data.tracks[i].name + '"',
'"' + data.tracks[i].artist + '"',
'"' + data.tracks[i].album + '"',
data.tracks[i].trackNum
].join(","));
}
window.location = 'data:text/csv;charset=utf8,' + encodeURIComponent(csv.join("\n"));
R.Notifications.show(data.name + ' downloaded to CSV. You may need to rename the file to include .csv to open it with your spreadsheet application.');
return false;
}
});
}
// if this is a Track
else if(datatype === 't') {
Expand Down

0 comments on commit 6ebecb2

Please sign in to comment.