Skip to content

Instantly share code, notes, and snippets.

@fabianmaass
Last active December 17, 2015 02:08
Show Gist options
  • Save fabianmaass/5533458 to your computer and use it in GitHub Desktop.
Save fabianmaass/5533458 to your computer and use it in GitHub Desktop.
Applescript to remotely rate iTunes Songs in a Shared Library credits go to dougs iTunes Scripts esp. dougscripts.com/itunes/itinfo/diy1network17.php
global remUserName, remHostIPAddr, remAddr
my get_login_info()
tell application "iTunes"
set numList to {"0", "1", "2", "3", "4", "5"}
set selectedRating to {choose from list numList}
set selectedRating to (selectedRating * 20)
set sel to selection
if sel is {} then
display dialog "No tracks selected." buttons {"Cancel"} default button 1 with icon 0
return
end if
repeat with t in sel
try
set thePID to get t's persistent ID
my rate_file_by_pid(thePID, selectedRating)
end try
end repeat
end tell
to get_login_info()
set remUserName to "xxx"
set remHostIPAddr to "xxx.xxx.xxx.xxx"
set remAddr to (remUserName & "@" & remHostIPAddr) as text
end get_login_info
to rate_file_by_pid(pid, theRating)
set osaCom to quoted form of ¬
("osascript -e 'tell application \"iTunes\" to set rating of some track of library playlist 1 whose persistent id is \"" & pid & "\" to " & theRating & "' ")
do shell script ("ssh " & remAddr & space & osaCom)
end rate_file_by_pid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment