Itunes lyrics finder


/ Published in: AppleScript
Save to your folder(s)

uses the currently playing itunes song to query astraweb's lyrics database


Copy this code and paste it in your HTML
  1. tell application "iTunes"
  2. if player state is playing then
  3. set artist_name to artist of current track
  4. set track_name to name of current track
  5. else
  6. set artist_name to the artist of selection of browser window 1
  7. set track_name to the name of selection of browser window 1
  8. end if
  9. end tell
  10.  
  11. set the artist_name to replace_chars(artist_name, " ", "+")
  12. set the track_name to replace_chars(track_name, " ", "+")
  13.  
  14. tell application "Safari"
  15. activate
  16. set the URL of the front document to ¬
  17. "http://search.lyrics.astraweb.com/?word=" & artist_name & "+" & track_name & ""
  18. end tell
  19.  
  20.  
  21. on replace_chars(this_text, search_string, replacement_string)
  22. set AppleScript's text item delimiters to the search_string
  23. set the item_list to every text item of this_text
  24. set AppleScript's text item delimiters to the replacement_string
  25. set this_text to the item_list as string
  26. set AppleScript's text item delimiters to ""
  27. return this_text
  28. end replace_chars

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.