Skip to content

Instantly share code, notes, and snippets.

@eramdam
Created June 19, 2014 16:03
Show Gist options
  • Save eramdam/16d205f10a0d6ad988fb to your computer and use it in GitHub Desktop.
Save eramdam/16d205f10a0d6ad988fb to your computer and use it in GitHub Desktop.
iTunes 2 Youtube for Alfred
currentTune=`osascript itunes.scpt`
currentTune="$(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "$currentTune")"
open "http://www.youtube.com/results?search_query=${currentTune}"
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