VoxCommando

VoxNastics (User Guides and Mods) => XML Exchange => Topic started by: nime5ter on June 28, 2014, 12:34:18 PM

Title: Plex commands -- Getting Started
Post by: nime5ter on June 28, 2014, 12:34:18 PM
Thanks to the hard work and time spent by vulcanjedi, it is now possible for Plex users to get a certain amount of voice control over their Plex systems.

vulcan jedi has already shared his command xml and some information about how to work with his commands (see  http://voxcommando.com/forum/index.php?topic=1136.msg13553#msg13553).

Below, I'm sharing a stripped down version that I think may be easier to set up. If you are trying to control a Plex client on a different machine such as a raspberry pi or whatever, you may also want to look at vulcan jedi's commands and guide. He also has some "Plex Pass"-specific commands that I don't include below.

My commands are not comprehensive, but are meant to give basic control that you can then try to build on if you want to.

----

1. The attached Plex commands image shows what functionality is possible (primarily, navigating through Plex menus).

It also has important instructions for which groups you should download, and what you need to do first once you've imported the command groups.

2. Download desired command groups to your desktop. As always, you simply *drag and drop* the VcGrp xml files into your command tree window. You should NOT open the command xml files, just drag the files themselves into your tree.

3. In the attached command xml, all commands target the client machine "Client01".  When you 1st generate your Plex map, it will capture the information for any client machine that is running a Plex Client app (e.g. Plex Home Theater). If you have more than one running, I don't know what order they will appear in, since I only have one machine. You may have to do some problem solving. If you have more than one Plex client and want to control a different one, the easiest solution is to edit the map after it has been generated so that the correct machine has the key "Client01".

NOTE: 1) plexDirections is a payload xml file, not a command group.

2) Anyone using VC2 should use the VcGrp_PLEX Admin 2.0.0.xml  group posted later in this thread (http://voxcommando.com/forum/index.php?topic=1637.msg14369#msg14369) rather than the VcGrp_PLEX Admin.xml posted here.

[Replaced VcGrp_PLEX Playback.xml 29-Jun-2014 -- fixed bugs.]
Title: Re: Plex commands -- Getting Started
Post by: nime5ter on June 29, 2014, 11:39:51 AM
If generating the song payload xml is freezing VC on your computer for a long time, you can try the following alternative. It may still lock VC for a minute or two, but seems to work better.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 1.9.5.6-->
<command id="428" name="Generate song xml (map version)" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="If you have a large music library, this will freeze VC until it is finished processing.  This should eventually complete, but may take a few minutes.">
  <action>
    <cmdType>Results.SetVar</cmdType>
    <params>
      <param>sectionMusic</param>
      <param>1</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>PayloadXML.Clear</cmdType>
    <params>
      <param>plexPayloads\plexSongs.xml</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Scrape</cmdType>
    <params>
      <param>http://{M:plex.Server}:{M:plex.Port_serv}/library/sections/{Var.sectionMusic}/search?type=10</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.Replace</cmdType>
    <params>
      <param>&amp;apos;</param>
      <param>'</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegEx</cmdType>
    <params>
      <param>ratingKey="(.*?)".*?title="(.*?)"</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Map.CreateTable</cmdType>
    <params>
      <param>plexSongs</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Map.Set</cmdType>
    <params>
      <param>plexSongs</param>
      <param>{Match.{i}.2}</param>
      <param>{Match.{i}.1}</param>
      <param>True</param>
    </params>
    <cmdRepeat>{#M}</cmdRepeat>
  </action>
  <action>
    <cmdType>Map.ExportPayloadXML</cmdType>
    <params>
      <param>plexPayloads\plexSongs.xml</param>
      <param>plexSongs</param>
      <param />
      <param>True</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Map.DropTable</cmdType>
    <params>
      <param>plexSongs</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>Generate song xml </phrase>
</command>
Title: Re: Plex commands -- Getting Started
Post by: nime5ter on June 29, 2014, 11:25:57 PM
I have also figured out "resume playback" for TV shows and films (i.e. if you want to resume watching from where you left off in the middle of a track).

It's not that well stress-tested. If you're interested, let me know, and I'll post the commands.
Title: Re: Plex commands -- Getting Started
Post by: nime5ter on July 06, 2014, 09:31:57 AM
If you upgrade to the latest VC2 (VC 2.0.0 Release Candidate 1), you can use the attached Plex Admin command group instead of the one posted above, and generate your payload xml almost instantly thanks to the amazing new Results.MatchToXML action. http://voxcommando.com/forum/index.php?topic=1443.msg12499#msg12499

New version of the group is attached here. You will again need to enter the IP address and port for your Plex Server in the generate Plex map command, etc.
Title: Re: Plex commands -- Getting Started
Post by: lja on July 08, 2014, 12:26:31 PM
Can this be adapted to work with MediaBrowser Theater?

http://mediabrowser.tv/

Title: Re: Plex commands -- Getting Started
Post by: jitterjames on July 08, 2014, 12:41:19 PM
No.  It might be possible to do something similar, from scratch, if someone wanted to sink countless hours into it.
Title: Re: Plex commands -- Getting Started
Post by: lja on July 08, 2014, 12:55:29 PM
No.  It might be possible to do something similar, from scratch, if someone wanted to sink countless hours into it.

Thanks.
Title: Re: Plex commands -- Getting Started
Post by: Real0rx on March 05, 2018, 04:08:40 PM
Hi guys, thanks for this nice tutorial about the implementation of the plex multimedia server.

i know the last post about is more than 3 years left. But i hope anybody can help me with this implementation.
i have imported nime5ter xml files and had change the parameters about the connection.

But i had an error at the connection. Error 401 Authentication Error.
the connection parameter does not exist some parameters for authentication.

My Plex Media Player is opend and connected to the Server.
I am aware that the plex server versions are newer and mutch komplex.

Does someone have an idear or know the actualy plex api what i can do?
Mutch thanks 4 ur help.

greets Tobias
Title: Re: Plex commands -- Getting Started
Post by: jitterjames on April 12, 2018, 06:39:31 PM
I think the Plex API has changed a lot in the last few years but I personally can't make sense of the "documentation" for it, so unless someone else has figured out how to control Plex remotely and wants to share with us I would say there is currently no way to control Plex from VoxCommando.

Nime5ter and I spent several hours on this today and we were not even able to get a basic command like "pause" to work.