notes

Freitag, Oktober 05, 2007

Play all lastfm:// links at once

A nice way to play all the "lastfm://" links in the last.fm player at once.
(applications used: textpad, ruby [windows])
  • copy html sourcecode to textpad, replace all "\n" -> ""
  • copy modified sourcecode to clipboard
  • start cmd.exe, type: irb [ENTER]


  • type following into the ruby shell for putting the sourcecode into a variable
    input = <<EOT
    /* paste the html code here
    important: use the shortkey
    [Shift]+[Insert]
    or it will take hours
    to insert the text */

    EOT
  • now find all "lastfm://" uris:
    uris = input.scan(
    %r|lastfm://play/tracks/[0-9,]+|).join("")
  • join the found uris into one uri:
    uri = 'lastfm://play/tracks/' +
    uris.gsub(%r|lastfm://play/tracks/|, ',')
  • copy the result from the shell into textpad
  • textpad: replace all "\n" -> ""
Now the result string can be entered in the address line of a web browser and when the "lastfm:" protocol-identifier is associated to the last.fm player all the tracks will be played there.

The next step would be to implement all the steps in javascript and put it into a greasemonkey script to automatize them.

Example Results
Here are some results, created by the procedure above:
––––

––––
PS: This Method is useful, when you want to create a playlist for recording the added tracks by e.g. TheLastRipper and hear a preview of the tracks before adding them to the playlist. Also it is useful when you want to play a playlist containing full-length available tracks on last.fm.

Labels: , , ,