Last active
December 21, 2015 06:05
-
-
Save spiffin/7c40c5d6a8e205d47ac4 to your computer and use it in GitHub Desktop.
AppleScript for displaying the currently playing track, artist and album in LMS (Logitech media Server)
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
--Note: only displays notification when run, e.g. via an Alfred keyboard shortcut | |
--Requires JSON Helper: http://www.mousedown.net/mouseware/JSONHelper.html | |
-- | |
--Settings | |
set serverIP to "192.168.1.1" -- your server IP | |
set portNo to "9000" | |
set playerID to "xx:xx:xx:xx:xx:xx" -- your player MAC address in Server Settings | |
--get status feed | |
set statusFeed to do shell script "curl --data '{\"id\":1,\"method\":\"slim.request\",\"params\":[" & "\"" & playerID & "\"" & ",[\"status\",\"-\",1]]}' http://" & serverIP & ":" & portNo & "/jsonrpc.js" | |
--parse status feed | |
tell application "q_json.helper" | |
set statusJSON to read JSON from statusFeed | |
set title to title of item 1 of playlist_loop of |result| of statusJSON | |
set artist to artist of item 1 of playlist_loop of |result| of statusJSON | |
set album to album of item 1 of playlist_loop of |result| of statusJSON | |
end tell | |
--Notification output | |
display notification "from " & album with title title subtitle "by " & artist | |
--Title and artist only | |
--display notification "by " & artist with title title |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment