Last.fm Playlist and Tag Manager

By Maarten Last update Nov 7, 2010 — Installed 7,335 times.

Script Summary: v1.16: Complete playlist/tag management: create, add, copy, merge, convert and delete. Export tracks to tab-separated text output. Import tracks in one go rather than searching for and adding them one-by-one.



Version: 1.16

—This script is no longer maintained—




Please make sure you've uninstalled any and all old version(s) of this script via Tools->Greasemonkey->Manage User Scripts...
Select Last.fm Playlist and Tag Manager and press the Uninstall button.
Then, if you haven't already, install the latest version of this script.
Last.fm Playlist and Tag Manager, v1.16 (06 Nov 2010) [source]

This script will generate a Last.fm playlist or tag from a user's direct text input, or from an existing playlist or tag. When collecting tracks, it'll favor streamable tracks. If multiple tracks match the user input, it'll pick the first streamable track in the list. If there is no streamable track, it'll pick the first track in the list, unless the "streamable only" box is checked, then it'll skip the track.


History:
  • 2009-11-06: v1.16: fix NaN bug in #tracks display for raw text input option, make v1.15 changes be supported by Firefox 2
  • 2009-11-06: v1.15: export now also exports tagged artists and albums
  • 2009-11-06: v1.14: add exporting banned tracks
  • 2009-05-10: v1.13: fix script due to last.fm site updates
  • 2009-03-27: v1.12: sort playlist/tag dropdowns alphabetically, make labels for radio buttons and checkboxes clickable, make script run on Firefox 2.x
  • 2009-03-24: v1.11: fix display issues on Mac
  • 2009-03-21: v1.10: add delete of playlists and tags, add multi-page support, get closer to JSLint compliance
  • 2009-02-22: v1.9: AJAX request to fetch track ID sometimes returns empty string so just try again in that case, fix regular expression for matching track ID
  • 2009-02-15: v1.8: use encodeURIComponent in stead of encodeURI for URL arguments to avoid errors for +redirect tracks, get closer to JSLint compliance
  • 2008-11-23: v1.7: add export options to group charts, add export options to similar tracks, add export options to tagged tracks, add export options to user charts, add progress indicator for lengthy operations, keep output area scrolled to last line
  • 2008-10-05: v1.6: change script name, make script runnable on localized Last.fm sites too, make script appear on those pages it's needed (rather than only on playlist page), create specific import/export sections, add all playlist options to tags as well including the ability to turn playlist into tag, add export tracks option, add black/red skin support
  • 2008-09-06: v1.5: add option to add tracks from someone else's playlist or tag
  • 2008-09-06: v1.4: add option to add tracks from an existing playlist or tag
  • 2008-09-01: v1.3: add option to add streamable tracks only
  • 2008-09-01: v1.2: remove use of Array.shift(); add option to allow pasting a Yahoo! Music playlist
  • 2008-08-31: v1.1: complete rewrite using singleton pattern
  • 2008-08-29: v1.0: initial version: processes all tracks

Known Issues (also see my to-do list):
  • Only tracks are added, not artists. The script skips artists without warning. As I haven't made up my mind if artists belong in playlists, this may or may not be fixed in a later release.
  • Last.fm has a 200 track limit on playlists. The script will stop as soon as 200 tracks are added to a playlist.
  • Some tracks may not exist in the Last.fm library and/or the user-supplied search term may not return any results.
    Tracks that cannot be found are identified as such in the output area.
  • An unsolved issue exists in the script's regular expression code. Sometimes it does not find any match while there is one. Just having the script try again usually works, and so the script does only one re-try.
    If no match was found after one try, the track will be logged as a parse error in the output area.
  • When adding the tracks from an existing playlist or tag, any tracks that already exist in the target playlist or tag are not added again.
    This is standard Last.fm behaviour.
  • The script is slow. Despite Last.fm policy of not making more than 5 requests per second (see section 4.4 of the TOS), I found that reliable results are only possible if no more than 2 requests per second are made.
    Depending on network latency, I've seen the script taking up to 4 seconds per track. Please be patient. ;-)

Example: merge playlists/tags:
  1. Navigate to the playlist/tag you want to merge other playlists/tags into. At the bottom of the page, choose one of the playlist/tag import options. Follow "Usage instructions" below. Repeat as necessary.

Example: convert a tag into a playlist or vice versa:
  1. Navigate to the playlist/tag you want to convert. At the bottom of the page, choose one of the export options to copy the tracks to. Follow "Usage instructions" below.

Example: copy someone else's playlist/tag:
  1. Navigate to the playlist/tag you want to copy. At the bottom of the page, choose one of the export options to copy the tracks to. Follow "Usage instructions" below.

Example: add some random tracks to a new or existing playlist/tag:
  1. Navigate to one of your playlists/tags. At the bottom of the page, choose the Search import option and enter your artist/song search queries (one per line) in the input area. Follow "Usage instructions" below.

Example: delete a playlist/tag:
  1. Navigate to your playlists/tags page. To remove tags, switch to the list view. Click one of the delete buttons. Once the operation has completed, the page will be reloaded.

Example: re-create a Playlist.com playlist at Last.fm:
  1. Navigate to Playlist.com and log in.
  2. Go to one of your playlists and switch to the "Manage songs" tab.
  3. At the bottom of the page, export the tracks using the Playlist.com Song Exporter script.
  4. Copy the script's output to the clipboard.
  5. Navigate to Last.fm and log in.
  6. At Last.fm, create a new playlist.
  7. Using the Last.fm Playlist and Tag Manager script, select the "Search for and add the following tracks" import option and paste the songs you just copied from the clipboard into the script's input area.
  8. Click the Start button to add the tracks to the Last.fm playlist.

Example: import a playlist from Yahoo! Music:
  1. Start Yahoo! Music
  2. Select a playlist
  3. Right-click in the playlist and select "Select All"
  4. Right-click in the playlist and select "Copy to Clipboard"
  5. Navigate to the playlist/tag you want to add the tracks to.
  6. Follow "Usage instructions" below, with these exceptions:
    - In step 4, paste the clipboard contents into the Last.fm Playlist and Tag Manager
    - Check the "I have pasted a Yahoo! Music playlist" option
    - Continue with step 5

Installation instructions:
  1. Install Greasemonkey: https://addons.mozilla.org/en-US/firefox/addon/748
  2. Restart Firefox.
  3. Load page and click the Install this script button at the top.
  4. Greasemonkey will ask you to install the script. Choose Install.

Usage instructions:
  1. Go to Last.fm and sign in.
  2. Create a new playlist or view any user's playlist or tag.
  3. At bottom of page find the import/export options (import options are only shown for the signed in user).
  4. Select one of the options.
  5. Click the start button
  6. When the script finishes, the status / error area shows the tracks that could not be added. You can try to search for and add those manually.