Skip to content

Instantly share code, notes, and snippets.

@spiffin
Created March 2, 2015 19:52
Show Gist options
  • Save spiffin/29062904d4302109b5bd to your computer and use it in GitHub Desktop.
Save spiffin/29062904d4302109b5bd to your computer and use it in GitHub Desktop.
AppleScript for displaying the currently playing track, artist and album in LMS (Logitech Media Server)
--No extra requirements
set serverIP to "192.168.1.80" --change to your server IP
set title to do shell script "printf \"current_title ?\nexit\n\" | nc " & serverIP & " 9090 | cut -d ' ' -f 3 | perl -pe 's/\\%(\\w\\w)/chr hex $1/ge'"
set artist to do shell script "printf \"artist ?\nexit\n\" | nc " & serverIP & " 9090 | cut -d ' ' -f 3 | perl -pe 's/\\%(\\w\\w)/chr hex $1/ge'"
set album to do shell script "printf \"album ?\nexit\n\" | nc " & serverIP & " 9090 | cut -d ' ' -f 3 | perl -pe 's/\\%(\\w\\w)/chr hex $1/ge'"
if album is equal to "" then
return "Playing " & title
else
return "Playing " & title & " by " & artist & " from " & album
end if
--example notification
--display notification "from " & album with title title subtitle "by " & artist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment