forked from Toxblh/MTMR-presets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
items.json
18 lines (18 loc) · 4.14 KB
/
items.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[
{
"type": "appleScriptTitledButton",
"refreshInterval": 5,
//Load:
"source": {
"inline": "set plexUrl to \"YOUR.PLEX.URL.OR.IP.COM\"\rset plexToken to \"YOUR_PLEX_TOKEN\"\rset playerName to \"PLAYER_ID_FOR_COMPUTER_MTMR_IS_USED_ON\"\rset file_tgt to (POSIX path of (path to temporary items)) & \"currentlyPlaying.xml\"\rdo shell script \"curl -L \" & \"http://\" & plexUrl & \":32400/status/sessions -H 'X-Plex-Token: \" & plexToken & \"'\" & \" -o \" & file_tgt\rtell application \"System Events\"\r tell XML file file_tgt\r tell XML element \"MediaContainer\"\r set trackElements to every XML element whose name = \"Track\"\r --> {XML element 1 of XML element 1 of contents of XML file \"Macintosh HD:Users:YourUserName:Desktop:Book Data.xml\" of application \"System Events\"}\r \r repeat with a from 1 to length of trackElements\r set currentTrackLoop to item a of trackElements\r --> XML element 1 of XML element 1 of contents of XML file \"Macintosh HD:Users:YourUserName:Desktop:Book Data.xml\" of application \"System Events\"\r tell currentTrackLoop\r name of currentTrackLoop\r --> \"Track\"\r name of every XML element\r --> {\"Media\", \"Part\", \"Stream\"}\r name of every XML attribute\r --> {\"grandparentTitle\",\"parentTitle\",\"title\"}\r --> Artist, album, song title\r value of every XML attribute\r --> {\"Belle & Sebastian\", \"If you're feeling sinister\",\"Lucy\"}\r set trackInfo to value of XML attribute \"grandparentTitle\" & \" - \" & value of XML attribute \"title\"\r --> \"Todd Terje - Step By Step (Todd Terje Re-Step)\"\r set playerInfo to XML element \"Player\"\r tell playerInfo\r name of every XML attribute\r set player to value of XML attribute \"title\"\r if (player = playerName) then\r return trackInfo\r else\r set trackInfo to \"No Music\"\r end if\r end tell\r end tell\r end repeat\r end tell\r end tell\rend tell"
},
//On click:
"action": "appleScript",
"actionAppleScript": {
"inline": "tell application \"Plex Media Player\"\ractivate\rend tell"
},
"image": {
"base64": "iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsTAAALEwEAmpwYAAABWWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS40LjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyI+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgpMwidZAAAEW0lEQVRIDcWW32scVRTHv3dmdmZ2k262NjGWtFiltlpbE5IWjfogKiKiIgii+Oyb4o+Xog9Kn0RfqvjjL5Dii6JQRBBFKbUYqatViyjB2GoJNW2aTdLZnR/3+j2zXdPizs5sFbwwm5v5cT7ne8655151/Y5dBv/DcIowszxTRT7OeKcQuGIDHYg4IXPNq5lkWC1wOxMsAItXzEl9hRPSFC+5l5A6zC83ekDIeccpPio8MsE2rbWoaKgEPHgVAZwL2NCREumLLeC380CVFhLxss/RFdxR6zHEvwTA3tsTXH2FQStuW7cJDhOFtw5beH9eYVe5rbwftkTuH0NCJyGU3C6HwBezFnwqX19hBAipuAxzVeOxCQ1D5eJov6K7gsUTi/RGBOypAW8fUjhEuCQzIkHRocAo3LhZY9+0xvfzDDkdk3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