|
|
Google-is-your-friend-edition :-)
I adapted the script to use Google's "I'm feeling lucky" feature, as my musical taste didn't seem to match the given site. The results are much better for me now, YMMV.
Google-is-your-friend-edition :-)
Tried this version and it went 3 for 3, including a couple songs I figured might not be in anyone's lyric database.
Google-is-your-friend-edition :-)
I like this version. I added one line to mine though. Whenever I got results; Safari would open a blank window and then present the lyrics. I found this annoying, so I made the following change:
on openBrowser(nameOfArtist, nameOfAlbum, nameOfTrack) I'm still trying to figure out the .htm issue mentioned above...
For use with all browsers
For those that don't want to be forced to use Safari, I have modified the script to open the web page in the default browser:
property nameOfTrack : ""
property nameOfAlbum : ""
property nameOfArtist : ""
tell application "iTunes"
copy name of current track to nameOfTrack
copy album of current track to nameOfAlbum
copy artist of current track to nameOfArtist
set nameOfTrack to my parseWord(nameOfTrack)
set nameOfAlbum to my parseWord(nameOfAlbum)
set nameOfArtist to my parseWord(nameOfArtist)
end tell
tell application "Finder"
open location "http://www.google.com/search?hl=en&ie=ISO-8859-1&btnI=I%27m+Feeling+Lucky&q=-site:amazon.com+-site:moviepundit.com+" & nameOfArtist & "+" & nameOfTrack & "+Lyrics"
end tell
on parseWord(myWord)
set myDelims to {"(", ")", "!", "'", "-", "@", "#", "$", "%", ¬
"^", "&", "*", "-", "+", "=", ":", ";", ",", ".", "/", "", "?", "{", "}", "[", "]"}
repeat with currentDelim in myDelims
set AppleScript's text item delimiters to currentDelim
set myWords to every text item of myWord
set AppleScript's text item delimiters to {""}
set myWord to myWords as string
end repeat
-- convert double spaces to single
set AppleScript's text item delimiters to " "
set myWords to every text item of myWord
set AppleScript's text item delimiters to {" "}
set myWord to myWords as string
-- get rid of spaces
set AppleScript's text item delimiters to {" "}
set myWords to every text item of myWord
set AppleScript's text item delimiters to {"+"}
set myWord to myWords as string
return myWord
end parseWord
.htm problem and solution
The problem is not a ".htm" problem per se. As far as I can tell, all the .htm files are returned from the same site: www.musicsonglyrics.com. They appear to have set their server up rather badly, so that content-type is set to That's why Safari downloads it: it doesn't know how to handle it. Compare that with Internet Explorer (Windows version), which tries to guess the format, and therefore happily interprets anything as HTML that looks like it, with predictable, negative consequences for security. Safari behaves correctly, as does Camino. IE:mac doesn't know what to do—it can't handle the page, according to my brief test.
The solution? Add |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.09 seconds |
|