Plex 9 remote API

Hi everybody,



I’m a new Plex user.

I would like to remotely control my Mac using Plex.



Is anybody have an idea on how to launch an application which is in the plex’s favorites, using http command?



Many thanks in advance for your help

Hi guys



Any ideas why this command (when in my list of TV Shows):


http://10.0.1.15:32400/system/players/htpc.local/application/sendKey?code=99



- jumps to a show starting with "C".

But when I press "C" on my keyboard, I get the context menu.

Why does it interpret the "C" in two different ways?

Thanks :)

When using a keyboard the keyboard.xml file causes the c key to open the context menu depending on the current context. The url doesn't get filtered through this xml config file.

You could follow cezar's steps from earlier in the thread:
1. open the favorites.xml file to get the proper command for your application
2. copy this command into your own custom keyboard.xml file
3. send the key your mapped in the keyboard.xml via a url similar to this:

http://10.0.1.15:32400/system/players/htpc.local/application/sendKey?code=99



Thanks for the reply JoToFoSho.

Could you tell me how I can map commands to keys then (through the xml)?

If the url doesn't use the xml config file, then how do the steps you replied to Mieuicikailleurs above work?

Sorry if I'm a bit slow :)

(Ps. I tried to follow cezar's steps too, where in the xml corresponds to sendText "a" but that didn't work for me either.)

Maybe cezar’s tip doesn’t work anymore, I don’t know. I’m just making educated guesses here. I didn’t explain the url commands properly. When you use sendkey, I believe plex interprets it as a global keypress whereas the context menu command is mapped under a specific context in the xml.

Well, figured out that only capital letters works for me, so I’m using ASCII for: “A”, “B”, “C”, etc., and mapping it in my keyboard.xml. Works great :slight_smile:



Now I can use the conditional stuff, like: if on Home screen, “I” goes to Settings, if in fullscreen video, “I” shows CodecInfo - yay! :slight_smile:

Glad you got it working how you wanted! :smiley:




Thanks Martin this was broken a while back. I edit my original post with your new info. I'm currently using iRule to control Plex and other programs with my iPhone and iPad. Thanks again.


You're welcome and thanks for editing your post (guide), it's really easy to follow now.

I've just purchased iRule myself and will start setting it up today, do you have any tips or tricks? Please post them here if you do :)

For example, how do you Sleep and Wake Plex with iRule and HTTP commands?


Hey Martin, you can setup Sleep and Wake in a number of ways on iRule but this is the most efficient way I found so far. iRule does not attempt to reconnect to the Gateway every time you attempt to control Plex.

Irule remote Sleep and Wake on LAN

1. Make sure your mac is setup right

A. Make sure you have the right router with Bonjour services (AirPort express, openwrt, dd-wrt, tomato.....)
B. On 10.6.X go to "System Preferences" > "Energy Saver" > check "Wake for network access"
C. Test sleep function. ( if your Mac stays asleep you are done)
1. Hit option-command-esc close all applications
2. Open Console to find out why Mac will not stay asleep. "Applications" > "Utilities" > "Console" > "Database Searches" > "All Messages" Kill the process keeping Your mac awake.
(In my case it was my ATV2 connected to my router. I had to load Plex 0.8.1 on to my ATV2. Thanks B0bben and the team for the fix.)
D. Setup static IP for your MAC. Go to "System Preferences" > "Network" > click on Location > "edit location" > "+" sign > type "Home" (or what ever you want) > click on "Ethernet no IP address" > click on left side of "Configure IPv4:" > "Using DHCP with manual address" > Type IP Address eg. 192.168.1.2


2. Setup iRule Builder (save often)

A. Make new Device on Irule Buider. "Devices" > "Actions" tab > "Create item" > name it by clicking "Device (x)" under "Device (x) Properties" I named it Wake on LAN.
B. Make a new Device Code dumby . I chose "Network Codes" > click on green plus sign "add (+)" > if done right you should have a new "Device Code" under Network Codes > click on new "Device Code" and name it "Wake". (leave data section blank)
C. Make new panel and name it "Wake/Sleep Plex" Click on green sign "add (+)" across from "Panels"
D. Make new Page. Click on new panel "Wake/Sleep Plex" > click on "Portrait Pages" > click on green sign "add (+)" across from "Panels"
E. Drag and drop a background onto background layer. Drag and drop a button for Wake and one Sleep on foreground layer.
F. Convert Wake button into a link. Click on wake button > click on second function key > click on "Convert to Link"
G. Make a link back to your Plex panel and page.
H. Add New Network Code for "Sleep" in your Plex device. Insert "system/players/192.168.1.2/application/sendKey?code=83" for data
I. Drag and drop "Sleep" network code onto Sleep button.
J. Drag and drop "Wake" network code from step B above on to wake button link from step F

3. Add "XBMC.SleepSystem()" to custom keyboard under




XBMC.SleepSystem()




VolumeUp
VolumeDown




4. Setup irule on iphone or ipad
A. Acquire IP address: from step 1.D
B. Acquire Ethernet ID: Go to "System Preferences" > "Network" > "Advanced" > "Ethernet"
C. Open IRule app on iSO divice > Gateways >Edit > Add new gateway > Devices Connect devices > Add device > "Wake on LAN" from step 2.A >save
D. Acitivate Wake-on-LAN: Gateways > Wake on LAN > Enable WOL > add Mac Address on from step B above
E. Add IP address to IPv4 address from step A above
F. Add port #32400


Please feel free in letting me know if something is missing or wrong.

Cesar

Thanks cezar :slight_smile:



What data (link) do you use for the Wake button?



The same command (S → XBMC.SleepSystem() )?

Hmm, Lion doesn’t wake the screen from sleep with IR, just read the other thread on the forum.



I guess I’ll leave my Mini running then.




Martin, I updated the guide I hope it helps and makes since. This only works if your Mac is connecte to an ethernet. iRule sends a package to your router and back to your Mac.

Cesar

Hey,



Just thought I would share, I have been messing around with the remote api for awhile, and not sure if I just missed something obvious (probably) but figured I would add, as it might help some one.



My goal was to send a remote play command to my mac mini via a crontab running off my linux box which is running the Plex Media Server. The specific media file is a symbolic link, which I intend to change daily, and randomly, and use it as a morning alarm clock/information video :slight_smile:



So to send the http command I use the linux command curl



From a command line I send:



curl -v --raw --ignore-content-length “http://SERVER:32400/system/players/CLIENT/application/playMedia?path=http%3A%2F%2FSERVER%3A32400%2Flibrary%2Fsections%2F4%2Fall&key=%2Flibrary%2Fmetadata%2F4428



I honestly think the biggest issue I had, was having to put the url in quotes.



One thing to add, and I am sure this is documented elsewhere in the forum but



If you go to:

http://SERVER:32400/library/

You can browse your library via the xml, which is where I got the key above from

http://SERVER:32400/library/sections/1/all



which I think you can get right from the media browser, but its fun to see



anyway maybe this will help some one, if not sorry for wasting your time :slight_smile:

Does anyone have any information on how to retrieve meta-data on currently playing item(like cover art, progress, transport status?) through the HTTP/API?



The only way I am currently aware of is via the XMBC API:
http://127.0.0.1:3000/xbmcCmds/xbmcHttp?command=GetCurrentlyPlaying

I’ve written a Crestron module to control Plex via the remote API. I’m running into an issue with Plex giving unauthorized access because my Crestron processor is on a different subnet from PMS. Is there anyway around this? I would like an option for no authentication if possible.



Also, has an official list of available commands been documented yet?



I think I’ve answered my own question. I have it working by postpending the authentication token myplex issues to the end of each command.




Hi... I have a problem, all commands work fine, But there is no command to stop. The stop command does not stop - it takes it to the main menu. How can I get a stop command? Also when in a movie the menu/back command doesn't work have to press the stop to go back.

Also is there a way to get subtitles command?

Thanks

[sup][/sup]




Thanks it works...

Anyway to get the Library list in iRule or a feedback on whats Playing?