Created
June 19, 2014 16:03
-
-
Save eramdam/16d205f10a0d6ad988fb to your computer and use it in GitHub Desktop.
iTunes 2 Youtube for Alfred
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
currentTune=`osascript itunes.scpt` | |
currentTune="$(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "$currentTune")" | |
open "http://www.youtube.com/results?search_query=${currentTune}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "System Events" | |
tell application "iTunes" | |
if it is running then | |
if player state is stopped then | |
set info to "" | |
else if player state is paused then | |
set info to "" | |
else | |
set seperator to " - " | |
set songname to name of current track | |
set songartist to artist of current track | |
set songalbum to album of current track | |
set songyear to year of current track | |
set songurl to "" | |
if player state is paused then | |
set playerstate to "Playing" | |
end if | |
set info to songartist & " - " & songname | |
return info | |
end if | |
end if | |
end tell | |
-- Uncommont if you use Vox.app | |
--tell application "Vox.app" | |
--if it is running then | |
-- if «class pSta» is 0 then | |
-- set info to "" | |
-- else | |
-- set seperator to " - " | |
-- set songname to «class trNm» | |
-- set songartist to «class trAr» | |
-- set songalbum to «class trAl» | |
-- set songurl to "" | |
-- if «class pSta» is 0 then | |
-- set playerstate to "Playing" | |
-- end if | |
-- set info to songartist & " - " & songname | |
-- return info | |
-- end if | |
--end if | |
--end tell | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment