Author Topic: plex integration  (Read 31453 times)

0 Members and 2 Guests are viewing this topic.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: plex integration
« Reply #45 on: June 25, 2014, 03:26:47 PM »
I just want to say this:

Even if you really know what you are doing... Even if you are an expert in VoxCommando and in Plex, you are not going to have much fun with this.  The Plex api sucks very badly.  Much of the documentation for the Plex api is either missing or incorrect.  Even if you can figure it out, I think there are major limitations on what is possible.

You are much better off using XBMC or another media program with VoxCommando! (Unless you want to be mad)

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: plex integration
« Reply #46 on: June 25, 2014, 04:01:21 PM »
Ha. Yes, I was also going to say that (along with posting some information).

The Plex API is almost non-existent and is very poorly documented. They don't seem to want people to make useful plugins for their software.

Here are the only things we can currently do with Plex. Some of it is not pretty:

1. Navigate through Plex screens. (This is quite easy)
2. Select media, change volume, display context menus, etc. (Also easy)
3. Play a media file.

We cannot queue more than one media file.

We can accomplish the above using GET http requests (Scrape, in VC) and/or keyboard emulation.

3. is the ugly command that is very complicated. For that particular http URL, you need to know:

A) Your Server IP, Server Port, Server Machine Identifier, Client ID, Client Port, Client Machine Identifier.

B) From the metadata xml, the "rating key" and relative library path of any file that you want to play.

----
Above, vulcan jedi is suggesting that you create a Map Table in VoxCommando to store the (A) values as permanent variables. This is because we need to use them many times for different commands, and some of them are long and unfriendly. In his commands, he then uses those variables.

See: http://voxcommando.com/mediawiki/index.php?title=Maps for information about using maps. There is a video.

For (B), you want to scrape your metadata somehow in order to create payloadXML that associates the rating key with the song or movie you want to play.

I have not yet tried vulcanjedi's python and command xml for this, so I don't know how easy it is to make those work.



« Last Edit: June 25, 2014, 04:26:00 PM by nime5ter »
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

vulcanjedi

  • $upporter
  • Sr. Member
  • *****
  • Posts: 213
  • Karma: 8
    • View Profile
Re: plex integration
« Reply #47 on: June 25, 2014, 04:40:08 PM »
I completely agree on all points, the API/documentation is beyond sucky, its not for the faint of heart.
I have been  a huge fan in VoxCommando (with XBMC)for quite a while
I started to play with Plex and for its flaws some things its does very well, so I plan on a hybrid environment in the future.
Currently I'm plex only atm,
I already have VC, so I just wanted some core things to work and I  think I've accomplished most of those within the limitations of how Plex works and I get value out of it. It gave me an opportunity to be more  invested in learning more about VC so that was a great takeaway.
I do not think there is a ton more investment return potential either. Not that my implementation is terrific but I think the limits of the API /doc restrict what one can do, but my implementation I am sure can certainly be optimized / improved on. So I wouldnt even hope VC to dev any plugin support et al. until Plex improves their platform for more extensibility.
Most plex users dont know about the underpinnings of the platform, and perhaps don't want to and it appears obvious that's the way the plex devs apparently prefer it. :(

Cineman, I'm sorry I don't speak German and Google didn't help much. I think nime5ter clarified nicely but if you still need assistance please try to add more detail to your question and I can certainly try to assist.
Regarding the map table to the system values, some of the API calls require the unique ID for the client machines vs the plex media server and this utilizes their own GUID vs IPs/names.
I have never noticed the GUID change with PMS updates...However with the RasPlex (raspberry Pi port of Plex Home Theatre), its updates will change its GUID so you'll have to manually update the map table and the python script until those are dynamically scraped if using that as a client with VC.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: plex integration
« Reply #48 on: June 25, 2014, 05:00:50 PM »
@vulcanjedi,

Is there a reason that you're using {Var.Server} and {Var.Client} in your various commands, rather than using map variables as you are already for machine identifier, etc.? (I haven't had time to look in detail at your commands, I'm afraid.)

 Is it primarily because map variable names can be long, depending on how we name our map tables?

e.g., in my command below, I dragged my map values into my command directly, rather than creating separate or duplicate {Var.***} variables:


Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 1.9.5.6-->
<command id="257" name="Go {1}{2}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Scrape</cmdType>
    <params>
      <param>http://{M:plexSystem.Server}:32400/system/players/{M:plexSystem.Client01}/navigation/{1}</param>
    </params>
    <cmdRepeat>{2}</cmdRepeat>
  </action>
  <phrase>Go, Move, Scroll</phrase>
  <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\plexDirections.xml</payloadFromXML>
  <payloadRange>1,10</payloadRange>
</command>
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

vulcanjedi

  • $upporter
  • Sr. Member
  • *****
  • Posts: 213
  • Karma: 8
    • View Profile
Re: plex integration
« Reply #49 on: June 25, 2014, 05:21:41 PM »
nime5ter
No, simply was not aware of that aspect of map table values being directly accessible in that manner...which is cool.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: plex integration
« Reply #50 on: June 25, 2014, 05:39:32 PM »
OK, good to know, thanks for clarifying.

I tend to use {var.***} for dynamic variables I'm creating on the fly, and the map tables for sets of more static variables that I want to store long-term.
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: plex integration
« Reply #51 on: June 28, 2014, 12:41:38 PM »
Based on vulcanjedi's work, I have posted some "Getting Started with Plex" command xml.

This may help you if you're having difficulties with the xml posted in this thread.

See: PLEX COMMANDS -- GETTING STARTED : http://voxcommando.com/forum/index.php?topic=1637.msg14283#msg14283
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

batfasturd

  • Jr. Member
  • **
  • Posts: 24
  • Karma: 0
    • View Profile
Re: plex integration
« Reply #52 on: March 16, 2015, 08:55:47 PM »
Sorry to kick a dead horse here but I was also wanting some Plex support so I started tinkering. I want to thank everyone here that has already done so much work and to vulcanjedi's post which got me started. I will post my scripts when I am done for anyone else to modify.

Things I have done so far
1) Added resume support for playback
2) Added the ability to generate and store authentication tokens

Things to do
1) Add support for multiple clients, scrape clients list and store the friendly names EG "Bedroom TV,
Livingroom TV" etc... so you can say "play movie [spaceballs] on [bedroom tv]" maybe the last 2 are
optional and it can default.
2) Automatically populate Plex server data, Machine ID's, IP's, Ports, etc...
3) clean up resume support, on play movie command if a resume point is found it will ask if you would like to resume.
4) Add support for multiple libraries / make them more dynamic. For example I have Kids Movies, Kids tv, and adult movies, adult tv. So far the scripts only bind to one of the sets.
« Last Edit: March 16, 2015, 08:58:18 PM by batfasturd »

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: plex integration
« Reply #53 on: March 16, 2015, 09:05:16 PM »
Wow. All that sounds great. I'm sure Plex users here will be thrilled.
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

batfasturd

  • Jr. Member
  • **
  • Posts: 24
  • Karma: 0
    • View Profile
Re: plex integration
« Reply #54 on: March 18, 2015, 08:36:00 PM »
It took me 2 days but I now have it scraping multiple TV and Movies sections and dumping to XML using (Title + Year) as a unique key as ratingKey didn't seem to be unique across sections.

For example I have Kids movies, Adult movies. Section 3 and 4 respectively. It now queries the library and finds all sections for Movies then parses each one dumping all results to XML. I have authentication tokens working already and have implemented some very basic multi-client support. Are there any features anyone would like? I don't have my music collection on plex so I cannot really test those features, I suppose I can add some just to be thorough.

IKROWNI

  • $upporter
  • Sr. Member
  • *****
  • Posts: 146
  • Karma: 2
    • View Profile
Re: plex integration
« Reply #55 on: March 18, 2015, 08:41:50 PM »
It took me 2 days but I now have it scraping multiple TV and Movies sections and dumping to XML using (Title + Year) as a unique key as ratingKey didn't seem to be unique across sections.

For example I have Kids movies, Adult movies. Section 3 and 4 respectively. It now queries the library and finds all sections for Movies then parses each one dumping all results to XML. I have authentication tokens working already and have implemented some very basic multi-client support. Are there any features anyone would like? I don't have my music collection on plex so I cannot really test those features, I suppose I can add some just to be thorough.

I LOVE YOU!  Just wanted to make that clear. I've been checking back here ritually waiting, hoping, that someday we would have decent plex integration. I love XBMC but I use plex exclusively for library sharing easily with friends and family who just aren't very familiar with streaming media and need an easy quick way to access it. That being said batfasturd I cannot wait to try it all out when you are done and as you said the only thing I would consider to be missing would be music.

Seeing as how this is the 6th highest viewed topic in the feature requests I would imagine there are quite a few here waiting for this type of integration just as I am.

batfasturd

  • Jr. Member
  • **
  • Posts: 24
  • Karma: 0
    • View Profile
Re: plex integration
« Reply #56 on: March 18, 2015, 08:51:47 PM »
I am just glad to help and share, I also want decent integration and use plex exclusively, the API sucks though and makes it difficult.

I had a minor setback when I started with vulcanjedi's post then realized there was another thread with some more advanced work done by nime5ter and a few others. I am now basing all my commands off of the updated references and modifying accordingly.

I will post code as soon as I have cleaned it up, I cannot promise it's the prettiest or the most efficient way to do it but hopefully someone else can assist me if needed.

IKROWNI

  • $upporter
  • Sr. Member
  • *****
  • Posts: 146
  • Karma: 2
    • View Profile
Re: plex integration
« Reply #57 on: March 18, 2015, 10:03:02 PM »
not sure if this would help but ive tried speaking with the person who made this app for voice controlling plex his solution seems to work well.

http://forum.xda-developers.com/showthread.php?t=2585066

Maybe you could draw some info from that to implement into vox?

batfasturd

  • Jr. Member
  • **
  • Posts: 24
  • Karma: 0
    • View Profile
Re: plex integration
« Reply #58 on: March 18, 2015, 11:29:51 PM »
Yeah I did use his app for a while but I also run Openhab for my home automation and wanted to dump using different apps for different things. I was using the Plex voice app, openHab, and some Tasker/Autovoice for other things.

I still might want to use autovoice instead of voxwav but voxwav works pretty well so far. I think the only thing I wish it could do is integrate with google voice like autovoice does, or at least if autovoice could pass the voice data onto voxwav or onto voxcommando.

IKROWNI

  • $upporter
  • Sr. Member
  • *****
  • Posts: 146
  • Karma: 2
    • View Profile
Re: plex integration
« Reply #59 on: March 19, 2015, 06:30:41 PM »
yea i use autovoice as well. I enjoy being able to say multiple commands all at once and multiple commands fire from the phrase. (Not sure if Vox can already do this or not.)

Like right now i just say "ok google" followed by "set the temperature to xx, turn on the tv and light in the office, then turn on the latest episode of the walking dead"

I have eventghost, vocommando, and tasker/plugins all working pretty well together to achieve what i need.

Id love to see a voxcommando tasker plugin but im probably asking too much lol.