Author Topic: plex integration  (Read 35412 times)

0 Members and 3 Guests are viewing this topic.

vulcanjedi

  • $upporter
  • Sr. Member
  • *****
  • Posts: 213
  • Karma: 8
    • View Profile
Re: plex integration
« Reply #15 on: January 10, 2014, 02:46:39 PM »
If you can show me a working scrape action that will play a media file, then I will see about getting the xml scanning part figured out.  Otherwise it is a waste of time for me.

We messed about with Plex a bit in the last 24h and I am not very impressed.  Especially WRT the api.  We were able to get play/pause and direction keys to work, but even the simple set volume command did not work.  The api also returns no information at all about whether your command was successful, or if an error occurred... it just give me a blank stare no matter what I throw at it.
Thanks James, I will endeavor to do so and as always apprecriate your efforts / help.
I can respect your opinions on Plex.  I too had reservations but its much improved from my previous evaluation.  The server/client aspect of the platform is nice for certain approaches for sure. I only recently discovered the http api but you bring up valid points. Dont recall if the old http calls in XBMC provided feedback or not. I know the JSON stuff does. I have no intention of replacing my XBMC but still remain intersted if Plex / Vox integration is possible.  Will continue to dig regarding that scrape and getting the approrpriate path/key pair generated for the command.

vulcanjedi

  • $upporter
  • Sr. Member
  • *****
  • Posts: 213
  • Karma: 8
    • View Profile
Re: plex integration
« Reply #16 on: March 11, 2014, 12:50:45 PM »
James / friends,
I've made some headway w/ this, still trying to do my part
I know James you're not a big Plex fan at the moment. The documentation is deplorable and I don't know about the API. With regards to the feedback of it, I'd ask did the old HTTP API for xbmc provide feedback either?

Regardless, heres an alternative approach to access the metadata from the Plex Media Server, much easier than directly querying the dbase.
I think I could manage to eventually get this but I'm hoping James could spin it up much faster.
Turns out PMS exposes XML natively already.


http://ip:32400/manage is the old native gui/player/WI to PMS.

http://ip:32400/
shows some existing fields, some others such as /status/sessions arent transparently available w/o knowing they were already there.

In order to Generate XML
I believe one could pull
http://ip:32400/library/sections (this shows the different libaries Plex has vs the singular video / music libraries of XBMC)
This also shows the library type 'movie' vs 'show'
I'm sure if a plugin were developed we could hard code set that in config too if need be.
The ID of the sections needs to be capture
ex: section 2 = movies, section 3=tv

http://ip:32400/library/sections/2
shows some defined views and presorts.  I believe this is essentially what is shown when accessing via UPNP / DLNA
by going to
http://ip:32400/library/sections/2/all
you have essentially "generated xml" for the library that is section 2
We'd need to pare this down from the xmls that i see formated in VC, bu t

But I was able to direct play a movie and basics like stop/pause...etc
The part of that, that is important is the latter 1/2 of the command must be url encoded, the and key is found in this xml much easier than in the base.
https://forums.plex.tv/index.php/topic/15850-plex-9-remote-api/#entry101671
https://forums.plex.tv/index.php/topic/15850-plex-9-remote-api/page-2#entry111620

So for our needs we'd use the path found previously (/library/sections/2/all)
And we'd find the key in that xml  for any specific 'title' which could be used for phrases
http://PMS_IP:32400/system/players/CLIENT_PLEX_IP/application/playMedia?path=http%3A%2F%2FPMS_IPl%3A32400%2F & suffix the following url encoded here

ex
library%2Fsections%2F3%2Fall&key=%2Flibrary%2Fmetadata%2F3435


nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: plex integration
« Reply #17 on: March 11, 2014, 03:10:09 PM »
If you want to attach the xml that you see via your own http://ip:32400/library/sections/2/all , I can probably make you commands that will generate the relevant payload xml files.

You can use a map to store PMS IP and client IP(s), if you like. Or more complete paths if different commands systematically use the same path.

It sounds like you should have no problem creating your VC commands as long as you have all your same-type media stored in one place.

You simply use a scrape action with the URL for the specific command, as you outline above. I assume you have already tested this, since you have said that it works for you. You wouldn't need the payloadXML file to test it, but just the key and correct paths for a few different media files in your collection.

As James has said previously, there is no point in us spending time on figuring out how to generate payloadXML files until Plex users have confirmed that they are able to directly play and interact with media files (rather than simply navigating the UI with up/down play/pause etc.).

Perhaps you can post the VoxCommando command XML that is working for you right now, so that other Plex users can test it on their own systems.

« Last Edit: March 11, 2014, 03:13:22 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 #18 on: March 11, 2014, 03:29:08 PM »
Hi nime5ter,
Thanks for the reply.  I haven't gotten actually tried the integration w/ VC yet.
It was hard to find all the information for Plex w/ their lack of docs and robust forums like here!
I can affirm I got the http api direct play command to work to direct play a movie.
So at this time, movies would specifically work as XBMC users are accustomed to.
So albeit perhaps a bit presumptuous, I believe that is likely all that VC would need, based on my VC / XBMC experience.

I'll plug my rasp pi w/ Plex back it ( I was missing VC so I put a XBMC image back in to demo to friend) and reaffirm a specific example for you.

I also need to verify but based on a post in that plex thread, I think you could get to  specifc views as well via this command, such as On Deck (next upcoming episode) / Recently Added
Not sure how to deep dive directly to a particular show / Season or unwatched episodes.


nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: plex integration
« Reply #19 on: March 11, 2014, 03:38:47 PM »
OK, thanks.

Once you've had a chance to test all that out and can post your sample XML here for us, I am happy to help with the payload XML side of things.

James is obviously very busy with V2, so is unlikely to be busting his head on Plex anytime soon, but if you can put in the time to deal with the above and report back I will do what I can to assist.
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 #20 on: March 12, 2014, 09:26:19 PM »
Heres my successful command based on the following XML excerpt:
The server name is the same as listed in the PMS settings but its also the hostname
PHTonRasplex is the name listed in the client for 192.168.5.15 and http://PMS_IP:32400/clients
but it doesnt seem to work even though the dev says it should.
I had to use the IP in that case to get it to be successful.

This works for Movies which is the same I think most people know specific movie titles.
I havne't figured how to direct nav the menus like, jumping to a show like Lost or something (plus that show was awful)
Anyways most people don't necessarily know the ep number/name to direct jump to a show. So TV is more about getting to the right view.
But hopefully this a big win and decent start.
Ref info: I have 2 movie sections, sections 1 and 2, so either being able to read xmls to find multiple movie sections or config multiple would be nice
Reading IP for the PMS server, port if different than the default.  Reading the player/client name should work but i had to use the IP...which too could be read by the other xml, the 'key' for this title here is listed as the VIDEO key, not the media / part keys.
Then obviously I used the sections/#/all to get the full xml, but could use some of the other presorts for other functions but for a full generate xml, this seemed to be applicable.
For TV the other views may help.
Again the latter part of the command requires URL encoding

Code: [Select]
http://testVM:32400/system/players/192.168.5.15/application/playMedia?path=http%3A%2F%2FtestVM%3A32400%2Flibrary%2Fsections%2F2%2Fall&key=%2Flibrary%2Fmetadata%2F3737(this is one contiguous line/cmd thats is wrapped in the forum window)


Code: [Select]
<?xml version="1.0" encoding="UTF-8"?>
<MediaContainer size="94" allowSync="1" art="/:/resources/movie-fanart.jpg" identifier="com.plexapp.plugins.library" librarySectionID="2" librarySectionTitle="Movies" librarySectionUUID="7212423c-b421d-422f-933f9-e3d7c33d3d332387" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1387414273" thumb="/:/resources/movie.png" title1="Movies" title2="All Movies" viewGroup="movie" viewMode="65592">
<Video ratingKey="3737" key="/library/metadata/3737" studio=?bleu? type="movie" title=?2013 Mother?s Day SkyDive? summary=?After initial attempt the previous Autumn was progressively delayed, randomly on Mother?s day, successful skydiving with randem instructor? viewOffset="264223" lastViewedAt="1394666130" year="2014" thumb="/library/metadata/3737/thumb/1394582018" art="/library/metadata/3737/art/1394582018" duration="4961044" originallyAvailableAt="2014-03-25" addedAt="1394582003" updatedAt="1394582018">
<Media videoResolution="720" id="3651" duration="4961044" bitrate="4477" width="1280" height="718" aspectRatio="1.78" audioChannels="6" audioCodec="ac3" videoCodec="h264" container="mkv" videoFrameRate="24p">
<Part id="4058" key="/library/parts/4058/file.mkv" duration="4961044" file="/mnt/temp2/_MOVIES/2013_mothers_day_skydive.mkv" size="2776518612" container="mkv"/>
</Media>
<Genre tag=?HomeVid?/>
<Writer tag="Me"/>
<Director tag=?Me?/>
<Country tag="USA"/>
<Role tag=?vulcanjedi"/>
</Video>
</MediaContainer>
« Last Edit: February 21, 2016, 02:34:45 PM by nime5ter »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: plex integration
« Reply #21 on: March 12, 2014, 09:41:22 PM »

(this is one contiguous line/cmd thats is wrapped in the forum window)


That's one of the many reasons to use code blocks on the forum.  :)

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: plex integration
« Reply #22 on: March 12, 2014, 10:51:39 PM »

This works for Movies which is the same I think most people know specific movie titles.
I havne't figured how to direct nav the menus like, jumping to a show like Lost or something (plus that show was awful)
Anyways most people don't necessarily know the ep number/name to direct jump to a show. So TV is more about getting to the right view.
But hopefully this a big win and decent start.

Sounds like a promising start.  Would you be able to send us a file with the complete listing of all media so we can try to figure out the scrape.  It is a bit difficult with just one item.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: plex integration
« Reply #23 on: March 12, 2014, 10:59:18 PM »
You can email the file to us to maintain privacy if that's a concern. The main thing is that we have a proper view of what a full library looks like, including movies, TV, and music, or whatever the standard categories are that you mentioned earlier in the thread.
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 #24 on: March 12, 2014, 11:41:32 PM »
Thanks team, sent email to a account James emailed me in the past, hope its still good.
Cheers.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: plex integration
« Reply #25 on: March 13, 2014, 09:27:03 AM »
The team of monkeys is furiously typing it out as we speak.

vulcanjedi

  • $upporter
  • Sr. Member
  • *****
  • Posts: 213
  • Karma: 8
    • View Profile
Re: plex integration
« Reply #26 on: March 13, 2014, 10:21:40 AM »
I dont have any music up at the moment, w/ some of stuff still boxed up but that would be nice as well. Particularly since strangely plex lacks any playlist support whatsover at the moment...all the more reason to get VC tapped into it to make it better.
I have asked on the Plex forums but its really  hit/miss there.
But I have managed to get some traction on TV
http://ip:32400/library/sections/3 shows some of the views for TV, but this its geared at mostly the show vs episode level.
The only way i've managed to get at the specific episodes is to use
http://ip:32400/library/sections/3/folder to get show / folder list
http://ip:32400/library/sections/3/folder?parent=787 to get all the sub folders ie the season folders
and then you'd have to interactively go to each folder to get that seasons episodes.  I imagine this would not be the most efficient way but haven't been able to use the other sub urls or find any other hidden api methods that aren't visible or documented yet, but I'll keep playing.

Thanks nime5ter. Thanks james particularly since I know you're not a plex user/fan and busy w/ Vox2. Sorry about the code block debacle!

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: plex integration
« Reply #27 on: March 13, 2014, 10:34:29 AM »
Have you found a way to do any of the following, because without this I don't see the point in trying to create voice control for Plex:

"Go to home screen"

"Browse Movies"

"Browse TV Shows"

"Find episodes of Lost", or "Browse TV Show Lost"

"Browse Music Artists", or "Browse Music Albums", or "Play artist David Bowie" etc.

If the only voice commands that work are:
  "Play movie Avatar"
or "Play Seinfeld Season 5 episode 4"
etc.

 then I really don't see the point.  It is not really usable like this.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: plex integration
« Reply #28 on: March 13, 2014, 10:38:24 AM »
I could be wrong, but it just seems that Plex is simply not suitable for voice control no matter how much information we are able to scrape about our content..  If that is the case, we should just accept it and move on.  I can't control my fridge with voice control either, but I accept it.  Even if I could find a way for VC to generate lists of items in my fridge, it won't help me to prepare and eat the food!

vulcanjedi

  • $upporter
  • Sr. Member
  • *****
  • Posts: 213
  • Karma: 8
    • View Profile
Re: plex integration
« Reply #29 on: March 13, 2014, 11:25:54 AM »
Plex is just a fork of XBMC.
But the database is different and there certainly is a divergence.
I think the movie playback is totally reasonable. Its how I played w/ xbmc and just direct asked to play.
Plex has a different way of organizing, the views in the clients than xbmc.  And all the clients are a bit different.
Its very much like an iOS vs Android type thing IMO.
I agree that being able to better access certain navigation/views would help, I am not certain if you can or can not due to the lack of documentation they provide.
The way Plex handles this is a more iOS kind of way and providing the On Deck view which tries to determine the next ep you havent watched etc.
I believe Plex has less views and you have to apply more filtering, whether one can do that via the HTTP API is anyones guess atm.
I just came across the XML exposure from the HTTP API after trolling random threads and thought this was a much better approach then trying to access the even less documented database in addition to being platform agnostic.
I'll try to get some more on these nav/view pieces first.
You can get back on Vox2  :D

I just thought at least the movie bit would help and maybe get some others to help dig in ;)
And I just missed my VoxCommando as I've been playing w/ Plex.  I'm not going to get into the philosophical debate of XBMC vs Plex. I think they both both are great and why I'll use both. If this turns into a crazy rabbit hole I'd agree maybe the divergence of the two make voice commands impractical w/ the directions Plex has taken but for now I'll hold out a little hope.