VoxCommando

New Features and Feature Requests => Feature Requests => Topic started by: IKROWNI on July 13, 2013, 06:00:53 PM

Title: plex integration
Post by: IKROWNI on July 13, 2013, 06:00:53 PM
Hello everyone been a while since i been on here. i think plex integration would be great with voxcommando. lately i have been working around with this http://forums.plexapp.com/index.php/topic/33696-proof-of-concept-plex-with-kinect/ (http://forums.plexapp.com/index.php/topic/33696-proof-of-concept-plex-with-kinect/) to play around with gesture control of my media through my htpc. so far im really loving plex and as a long time xbmc user i have to say the user friendliness of it and the fast response time really seems to blow xbmc away. now i know xbmc has been around longer and has some cool plugins and other features but plex now has all sorts of new features that xbmc is lacking in. for starters plex allows you to stream over the web to friends and family by just adding them to your friends list in plex. there is a now playing feature that shows what who is watching at the current time and what has been watched on your media server also.

i found a couple of posts at plex where people are using voice control on there macs to control plex. http://forums.plexapp.com/index.php/topic/23932-control-plex-using-speech-recognition/ (http://forums.plexapp.com/index.php/topic/23932-control-plex-using-speech-recognition/)

would there be any possible future having voxcommando running plex for us?
Title: Re: plex integration
Post by: jitterjames on July 13, 2013, 06:26:50 PM
You can create your own voice commands for plex using the existing resources of VoxCommando

using the scrape command you can send http commands to plex the same way that Gergeosson (the guy in your link) is doing.

example VC command to pause plex:
Quote
<?xml version="1.0" encoding="utf-16"?>
<command id="199" name="plex pause" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Scrape</cmdType>
    <cmdString>http://localhost:3000/xbmcCmds/xbmcHttp?command=pause</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>plex pause</phrase>
</command>

Here is a reference of some of the commands you can try, although it looks a bit different from what Gergeosson is using:

http://wiki.plexapp.com/index.php/HTTP_API/Control

the api that is available using this method looks to be somewhat limited though, in comparison to XBMC.

Try it and let us know how it goes.
Title: Re: plex integration
Post by: IKROWNI on July 25, 2013, 06:50:12 PM
How would I go about getting genxml to print off something that would be usable with plex. I cant seem to find any information being generated in the plex database which i assume is this file called MyVideos75.db
Title: Re: plex integration
Post by: jitterjames on July 25, 2013, 06:53:37 PM
If plex uses a similar database to XBMC then you should be able to use the xsql plugin in VC to scan it and generate XML.
Title: Re: plex integration
Post by: IKROWNI on July 25, 2013, 08:45:06 PM
The problem i'm running into is that it seems that there is one file that controls all media on plex. There is no individual .db for music,movies,tv and so on. It's all in one DB so i'm getting errors when trying to scan it. This is the directory I am scanning C:\Users\NAME\AppData\Local\Plex Media Server\Plug-in Support\Databases\com.plexapp.plugins.library.db seems to be the only DB i can find that contains any media information that i have.

Scan Complete

error opening music database C:\Users\NAME\AppData\Local\Plex Media Server\Plug-in Support\Databases\com.plexapp.plugins.library.db
error opening video database C:\Users\NAME\AppData\Local\Plex Media Server\Plug-in Support\Databases\com.plexapp.plugins.library.db
error opening tv database C:\Users\NAME\AppData\Local\Plex Media Server\Plug-in
Support\Databases\com.plexapp.plugins.library.db

Title: Re: plex integration
Post by: jitterjames on July 25, 2013, 08:55:35 PM
If it generates an error just when opening, it probably isn't an sqlite database.
Title: Re: plex integration
Post by: vulcanjedi on January 08, 2014, 09:59:06 PM
https://forums.plex.tv/index.php/topic/31636-howto-query-data-from-plex-on-a-mac/
I've recently rediscovered Plex and like it for companion to XBMC, would love to get integrated with VC as well... mostly just to direct play stuff..vs anything too complicated.

I can open via Sqlite3 on Mac
From portableapps.com
I can open as SQLite db from DatabaseBrowserPortable
But can't open from SQLiteDatabaseBrowserPortable.....weird :/
Title: Re: plex integration
Post by: nime5ter on January 09, 2014, 07:18:10 PM
By "companion to XBMC", do you mean via the PleXBMC addon? There was a thread on that last year, but I don't know whether Clayton's suggested approach worked out or not.

http://voxcommando.com/forum/index.php?topic=1081.0



Title: Re: plex integration
Post by: vulcanjedi on January 09, 2014, 07:37:51 PM
Sorry I'm not a hater, I'll use whatever works for me best. Currently that is XBMC by far in main room.
But I can certainly see the merits of the Plex platform and using both.
Particularly ancillary rooms, vs setting up a bunch of machines you have to micromanage or get a bunch of ugly rasp pis.
Plex on a roku is just crazy easy / cheap.

So I dont think I need an PlexBMC implementation of XBMC with Vox.
Cause I think you could simply add the Plex library via UPNP as an XBMC source and possibly scrape/generate XML that way.
Or regardless I'm completely content w/ my XMBC and its VC setup.

But other less technical folks Plex maybe better platform for them all around
Or Just maybe in a separate room like a bedroom or otherwise w/ Plex and VC.
In a room perhaps w/ smaller TV, harder to read font far away  I'd rather just say play this then spend time trolling menus for it.
The plex http api, allows you to control any player/client connected, so you could in theory, say "Vox, play star trek in my  guest bedroom"
I dont know if it would be good to have xbmc and plex runnning in the same Vox instance but just think getting Vox w/ Plex would be very nice, the Plex interfaces already leave  a lot to be desired vs xbmc.
I think if the xmls are seperated and the commands different you could., the problem with the plex platform for vox is the server client piece so you wouldnt likely have a way to use vox on roku but you could still use voxwav or the amulet remotes or other remote approaches to VC now.
Title: Re: plex integration
Post by: jitterjames on January 09, 2014, 08:17:39 PM
Can you provide some examples of what is actually possible and working with the plex http api?

I don't understand most of what you are saying in this thread, but I think the first thing to establish is... can VC control Plex?  Because if not, or if you can only do very basic stuff like "up, down, select", then it doesn't really matter whether or not you can scan your library.

If plex is storing data in sqlite files then maybe you can use the xSql plugin in VC to grab xml info.  Have you tried that?
Title: Re: plex integration
Post by: vulcanjedi on January 09, 2014, 10:02:15 PM
I ultimately would like  VC to be able to provide commands to a Plex Client.
The Plex forums/doc are underwhelming IMHO.
They reformatted their site and their http api page hasn't been ported but this forum has some stuff about it still.
https://forums.plex.tv/index.php/topic/84037-plex-http-api/

The HTTP API call does provide methodology of direct playing a file amongst other things. Ultimately being able to do some of the core functions like XBMC / VC integration would be nice.
I have managed to do the up/down/select stuff, I haven't had the opportunity yet to figure out the 'key' of the file identifier and documentation is a bit lacking.
I have accessed the Plex DB.
Via the native sqlite3 command that comes w/ my Mac.
From windows I could with DatabaaseBrowser but was unable to via SQLDatabaseBrowser.
From the latter, it says it supports SQL3 dbases.
I personally run the Plex Media Server (which creates/manages the library/dbase) from Ubuntu, but its available on linux/mac/windows...and I'm sure you could share it out..etc
I know obviously VC is windows only so would need a way via windows to access the db in order to get a good xml generated.
The post on the plex forum and the sql commands even say you can export the dbase to csv.

I tried to use the xSQL plugin on VC but got the error unable to open the DB.
The Plex DB is only 1 db for all of its 'libraries', tv/movies/music...etc are all in one central DB unlike XBMC that has a seperate video and music ....etc.
The queries to generate xml would need to be different cause the schemas and db layout is differnt but I think the tablespace is defined.

I dont know if a plugin would be possible or even if I had to otherwise generate XML, but I would think being able to read teh xml payloads to pass into the Http API to direct play stuff or search would be terrific.
"Find Avatar"
"Search Star Trek"
"play movie superman"

I'm optimistic theres some opportunity here.
Hope this was somewhat clearer.

Title: Re: plex integration
Post by: macrho on January 10, 2014, 06:48:49 AM
Sorry I'm not a hater, I'll use whatever works for me best. Currently that is XBMC by far in main room.

For me, I've found that Plex works beautifully for remotely connecting to my library
At home, I always use XBMC
Title: Re: plex integration
Post by: jitterjames on January 10, 2014, 08:48:39 AM
Quote
From windows I could with DatabaaseBrowser but was unable to via SQLDatabaseBrowser.
From the latter, it says it supports SQL3 dbases.

Sqlite3 is not the same as sql3 AFAIK.

If you can export to excel via CSV then you can copy paste from excel into a payload XML but it does you no good until Plex offers a documented method to actually play a file.  If you can figure out how to do this with a scrape action, please let me know.
Title: Re: plex integration
Post by: vulcanjedi on January 10, 2014, 10:33:39 AM
Sqlite3 is not the same as sql3 AFAIK.

If you can export to excel via CSV then you can copy paste from excel into a payload XML but it does you no good until Plex offers a documented method to actually play a file.  If you can figure out how to do this with a scrape action, please let me know.

Sorry that was a typo, that app says it supports sqlite3 dbs.
I recently moved so my setup is in a bit of disarray at the moment, I was able to send http api commands to someones roku.  I hadn't had the time to figure out the 'key' for the command for the file play parts as yes that documentation was a bit lacking for me in my opinion.  But the documentation did clearly seem to support direct playing of media/files via the http api and others in the forums seem to suggest they have done so I believe so maybe I can get some insights there as well...again their forums aren't as productive as Vox.
 Ill continue to work on it hopefully when I get some of my stuff setup that will help.
Title: Re: plex integration
Post by: jitterjames on January 10, 2014, 01:11:05 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.
Title: Re: plex integration
Post by: vulcanjedi 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.
Title: Re: plex integration
Post by: vulcanjedi 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

Title: Re: plex integration
Post by: nime5ter 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.

Title: Re: plex integration
Post by: vulcanjedi 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.

Title: Re: plex integration
Post by: nime5ter 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.
Title: Re: plex integration
Post by: vulcanjedi 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>
Title: Re: plex integration
Post by: jitterjames 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.  :)
Title: Re: plex integration
Post by: jitterjames 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.
Title: Re: plex integration
Post by: nime5ter 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.
Title: Re: plex integration
Post by: vulcanjedi 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.
Title: Re: plex integration
Post by: jitterjames on March 13, 2014, 09:27:03 AM
The team of monkeys is furiously typing it out as we speak.
Title: Re: plex integration
Post by: vulcanjedi 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!
Title: Re: plex integration
Post by: jitterjames 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.
Title: Re: plex integration
Post by: jitterjames 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!
Title: Re: plex integration
Post by: vulcanjedi 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.
Title: Re: plex integration
Post by: jitterjames on March 13, 2014, 12:24:16 PM
I have absolutely no opinion of any kind on whether or not Plex is good, or whether it is better or worse than XBMC or any of the other Media experiences available out there.  I am not interested in where it came from or what style it is (iOs vs Android etc.)

My only question is, is there any point in trying to make it work with VC?  If you can only do one kind of command and everything else must be done using a remote, then what is the point of going to all the trouble of setting it up with VC, just to be able to play movies by name and that is all you can do by voice.  I'm not saying don't try.  If you can find a way to do more that's great.  But until we can figure out how to control the UI in some practical ways, I don't think anyone is going to want to use it with VC.

Correct me if I'm wrong, but the only things that we can currently do with the Plex api is

- emulate keyboard or button presses
- play a specific movie title, or in general a single specific file (I guess it could be music or video)
Title: Re: plex integration
Post by: vulcanjedi on March 13, 2014, 12:37:55 PM
No I'm on board w/ you James.
Just giving a bit of background is all.

At this time I agree completely w/ your last statement.
Whether you can do more w/ the HTTP API or other API, not certain yet. Will continue to dig ...for now.

Just perhaps excited to get the movies from the xml so readily exposed and hoped everything else would just come together ;)
Title: Re: plex integration
Post by: jitterjames on March 13, 2014, 01:24:00 PM
OK.  So here is how you can create a payloadXML file automatically, assuming that you have the xml file from plex.

For this command to work you need to do 2 things first.

1 - create a child folder in your VC folder called PlexPayloads.   This is where the payloadXML file will be created
2 - save the movie xml from plex to this file:  C:\plexdata\movies.xml

The command will scrape this file.  If you are able to directly scrape the xml from the Plex Media Server, even better but I wan't able to test that so I used your file instead.  Here is the command.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="287" name="Generate plex xml" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Scrape</cmdType>
    <cmdString>file://C:\plexdata\movies.xml</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegEx</cmdType>
    <cmdString>ratingKey="(.*?)".*?title=.(.*?)["|"]</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>PayloadXML.AddPair</cmdType>
    <cmdString>PlexPayloads\Movies.xml&amp;&amp;{Match.{i}.1}&amp;&amp;{Match.{i}.2}</cmdString>
    <cmdRepeat>{#M}</cmdRepeat>
  </action>
  <phrase>Generate plex movie xml</phrase>
</command>

This command requires version 2 alpha.  If you don't want to pay the $10 to upgrade from VC1 to VC2, then just install VC2 and use it in trial mode in order to generate the payloadXML.  Then you can use the payloadXML in VC1.

An even better way, especially if you have a large library, is to use this command.  It works in a similar way, but it fills a map table first, and then exports it to a payloadXML file.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="291" name="Generate plex xml using maps" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Map.CreateTable</cmdType>
    <cmdString>plexTemp</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Scrape</cmdType>
    <cmdString>file://C:\plexdata\movies.xml</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegEx</cmdType>
    <cmdString>ratingKey="(.*?)".*?title=.(.*?)["|"]</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Map.Set</cmdType>
    <cmdString>plexTemp&amp;&amp;{Match.{i}.1}&amp;&amp;{Match.{i}.2}&amp;&amp;False</cmdString>
    <cmdRepeat>{#M}</cmdRepeat>
  </action>
  <action>
    <cmdType>Map.ExportPayloadXML</cmdType>
    <cmdString>PlexPayloads\Movies.xml&amp;&amp;plexTemp&amp;&amp;True&amp;&amp;True</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>Generate plex xml using maps</phrase>
</command>

This method is significantly faster (which won't matter for a small library like the sample you sent me) but also lets you customize the phrases in your maps if you want.  When you run it again, any changes you made in the map will be kept, and only new content will be added.  That is because in the Map.Set action, the third parameter (overwrite) is set to False.  Also, when exporting the map to a payloadXML file I am setting subSetMatch to true.  This is optional.
Title: Re: plex integration
Post by: jitterjames on March 13, 2014, 01:28:09 PM
Please note that I edited the xml in my last post so please copy and paste from the forum and not from an email that you may have received if you are subscribed to this topic.
Title: Re: plex integration
Post by: vulcanjedi on April 06, 2014, 09:12:04 PM
Sorry had my hands full, finally testing this V2 Build.
Not following how to implement this command. I saved a unicode xml but can open/import it in the command builder?
I would think based on my reading of the Scrape command and plex exposing the xml via http://ip:port/library/sections/#/all I could just use Scrape to pull down the xml directly via the Srape command but it saves to {Last Result} so not sure how to implement the parser after that.
Did new install of VC v2 in new folder. Activated.
Pasted from forum into new file. Saved unicode.
copied an existing XML and copy from forum into that one as well which was unsuccessful.

Cheers.

Getting:
---------------------------

---------------------------
error:

System.Xml.XmlException: There is no Unicode byte order mark. Cannot switch to Unicode.

   at System.Xml.XmlTextReaderImpl.Throw(Exception e)

   at System.Xml.XmlTextReaderImpl.ThrowWithoutLineInfo(String res)

   at System.Xml.XmlTextReaderImpl.CheckEncoding(String newEncodingName)

   at System.Xml.XmlTextReaderImpl.ParseXmlDeclaration(Boolean isTextDecl)

   at System.Xml.XmlTextReaderImpl.Read()

   at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)

   at System.Xml.XmlDocument.Load(XmlReader reader)

   at System.Xml.XmlDocument.Load(String filename)

   at eval_a.eval_ᜀ(String A_0, TreeNode A_1)
---------------------------
OK  
---------------------------
Title: Re: plex integration
Post by: nime5ter on April 06, 2014, 10:15:21 PM
Sounds like you need to revisit the proper way to copy and paste commands from forum code boxes. http://voxcommando.com/mediawiki/index.php?title=XML_on_the_forum

You should not be saving anything to a new file. You should simply be copying and pasting the xml directly from the code box into your command tree.
Title: Re: plex integration
Post by: vulcanjedi on April 06, 2014, 10:29:23 PM
Much thanks nime5ter!  Man this app/support is awesome.
Just copy/paste directly in the app is amazing too. Wow. Worked perfectly and I was able to just directly scrape via the url to generate w/o precreating the XML from Plex first.
I'll just need to get to work on the playback command to work from these payloads now.
Thanks again!!

Sounds like you need to revisit the proper way to copy and paste commands from forum code boxes. http://voxcommando.com/mediawiki/index.php?title=XML_on_the_forum

You should not be saving anything to a new file. You should simply be copying and pasting the xml directly from the code box into your command tree.
Title: Re: plex integration
Post by: vulcanjedi on May 03, 2014, 11:18:50 PM
Many thanks to xtermin8r, kalle, nime5ter and of course James.
Finally got most of the core things I really wanted to make Vox and Plex be friends.
Got some familiarity with even more neat features about the VC platform.
Utilizing many newer things to me in VC: regex, map tables, xml parsing, python..etc I'm sure theres opportunities to clean up and make more efficient but I'm pretty pleased I got things functional:)
Anyways I felt I would share my progress:

Windows Installation of VoxCommando (I'm on VC2 v1.9.3.1)
Any installation of Plex Media Server
Get the IP of local PMS
http://IP:32400
Note the machineIdentifier / IP
http://IP:32400/clients
Note the machineidentfier / IP / Port for the client you intend to control w/ VoxCommando
http://IP:32400/library/sections
Note the key numbers for the Movies / TV sections

Load the PY Plugin in Options of VoxCommando
Create a .\plexPayloads folder in the root of VoxCommando folder

Copy the pythonPayloads.xml to .\plexPayloads
Copy the plexXML.py to the .\PY folder
Create a Map Table called plexSystem
   Enter the values for the machineIdentifier // IP // Port found above into the Map Table
Edit the .\PY\plexXML.py file with the plex client's machineIdentifier so you can filter currently playing info from any other clients' sessions
   Not sure you can pass this from VC into PY script as not all objects/vars are exposed in the PY script so hard coded for now.
Create a Map Table called plexSections

Actions include:
Plex NAV - Left/right/up/down, page up/down,select….
Plex PLAY - skip, step, toggle OSD, stop, play, pause…
Plex SYS -
These are my adhoc commands:
   Play movie ABC
      Uses payload that is scraped from library to enhance results
   Play the next episode of Mr Wizards World
      This command leverages Plex's OnDeck
   Generate Plex XML,
       this starts up w/ VC and can call as well. This will load the system variables so VC will know for future calls where the Ips/machineIDs…etc are (this is mostly in lieu of a plugin, and some more could probably  be scraped as well)
   Update Libraries
      This sends remote calls to PMS to update libraries for new/clean up content
   Type
      This sends speech to Plex such as in  SEARCH, you can also use to in fields like renaming Device name in PHT
   Dictate
      This is like Type but uses the dictionary payloads for things like spelling out letters/acronyms like SOS
   What movie is this?
      This will leverage sessions XML w/ Python and filter for the plex client VC is controlling to get the right movie name and who's starring in it
   What show is this?
      This will leverage sessions XML w/ Python and filter for the plex client VC is controlling to get the right show name and episode title, season and ep number
   What is the plot?
      This will leverage sessions XML w/ Python and filter for the plex client VC is controlling to get the plot summary
      
   Note any of the commands the call DIRECT PLAYS will always play the content from the beginning w/o asking regardless.  A previous resume point will not be honored.

Still working on: commands to tell how many/who are sharing/transcoding from the PMS...
Title: Re: plex integration
Post by: Kalle on May 04, 2014, 05:57:38 AM
Good job vulcanjedi, thanks for sharing.   ::bow
Title: Re: plex integration
Post by: nime5ter on May 04, 2014, 09:56:26 AM
This is amazing, vulcanjedi. It's fantastic to see how much you've managed to do -- and having wrestled with Plex a bit myself, I do salute you.  ::bow

Thanks for sharing this!

If you ever have time to record a video demo some day, I'm sure that would help folks to really "get the picture" of all you've accomplished. But hopefully they'll just follow your instructions and give it a go.

We shall leave Plex users and their questions in your capable hands. ;)
Title: Re: plex integration
Post by: nime5ter on June 17, 2014, 06:20:35 PM
@vulcanjedi -- I can't bring myself to wrestle with Plex again, but I was wondering whether you've considered adding any keyboard emulation to the mix since posting your commands above?

I'm thinking in particular for functionality such as returning directly to the home screen, turning subtitles on and off, F6 for full movie info, maybe also the context menu and that style of thing.

Curious whether the documentation here is accurate. https://support.plex.tv/hc/en-us/articles/201670487-Keyboard-Shortcuts





Title: Re: plex integration
Post by: vulcanjedi on June 17, 2014, 08:07:43 PM
I dont typically use keyboard emulation, I've never encountered a need before, but I'm happy to investigate. I think that was part of the API that didn't work so well from my original plex forum searches.
I'm more than happy to try.
I also believe with the latest update to the Plex Server, some of the APIs changed, to the newer syntax. I'll have to repost some of the fixes I had to do.
It may have been the navigation controller you mention.
The new syntax I believe more directly engages the clients vs the server and it as much of Plex remains woefully under documented.

Sorry I haven't been as involved, I'm several VC updates behind for sure, finally switched jobs after the last one turned toxic....and then have been studying for MS cert exam (just passed). Still a bit unsettling being at a new place after a long stint.

Also I need to work out some performance improvements after I got my storage up and my library grew significantly I'd like to improve some of the scraping/map tables..etc.
So I need to work on some updates/refinements and such
Title: Re: plex integration
Post by: nime5ter on June 18, 2014, 11:40:21 AM
Congrats on passing your exam, and good luck with the new gig.

It's a lot of work to figure out the Plex craziness. I was impressed with your video demo (at least, I think it's yours), not to mention your perseverence!

No surprise that you've had to put the project on the back burner. If/when you have the time to share some updated commands, hopefully your fellow Plex users can provide some productive feedback ... and even a bit of gratitude if you're lucky.  :biglaugh
Title: Re: plex integration
Post by: Cineman on June 25, 2014, 03:00:01 PM

   Enter the values for the machineIdentifier // IP // Port found above into the Map Table

Wie musst der Map Table aussehen.
Create New Map Table und was muss ich in welcher Spalte eintragen.
Bekomme es nicht hin >:(

Bitte um Hilfe.
Title: Re: plex integration
Post by: nime5ter on June 25, 2014, 03:17:11 PM
Ja, es ist ein bisschen kompliziert.

Ich werde versuchen, mehr einfache Befehle und Klarstellungen zu geben ... aber in Englisch, irgendwann heute
Title: Re: plex integration
Post by: jitterjames 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)
Title: Re: plex integration
Post by: nime5ter 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.



Title: Re: plex integration
Post by: vulcanjedi 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.
Title: Re: plex integration
Post by: nime5ter 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>
Title: Re: plex integration
Post by: vulcanjedi 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.
Title: Re: plex integration
Post by: nime5ter 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.
Title: Re: plex integration
Post by: nime5ter 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
Title: Re: plex integration
Post by: batfasturd 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.
Title: Re: plex integration
Post by: nime5ter on March 16, 2015, 09:05:16 PM
Wow. All that sounds great. I'm sure Plex users here will be thrilled.
Title: Re: plex integration
Post by: batfasturd 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.
Title: Re: plex integration
Post by: IKROWNI 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.
Title: Re: plex integration
Post by: batfasturd 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.
Title: Re: plex integration
Post by: IKROWNI 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?
Title: Re: plex integration
Post by: batfasturd 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.
Title: Re: plex integration
Post by: IKROWNI 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.
Title: Re: plex integration
Post by: nime5ter on March 19, 2015, 06:39:03 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.)

If you mean you're not sure whether VoxWav can do this, yes it can. And much more.
Title: Re: plex integration
Post by: batfasturd on March 19, 2015, 07:11:29 PM
You can combine two or more phrases together? Like separate commands in random order?
Title: Re: plex integration
Post by: nime5ter on March 19, 2015, 10:41:09 PM
You can issue more than one command at a time, yes.

e.g., if you're using the "hold/speak" button, hold the button down then: say a command, pause for a second, say another command, pause for a second, etc. When you're done, release the button.

Or with the tilt: tilt up, say all your commands, then untilt.

I don't think I could say more than 2 commands in a row correctly, though.

If you pause too long, it probably won't work because VW is set to automatically detect a long silence (2 seconds) and will send the command when that is detected.
Title: Re: plex integration
Post by: batfasturd on March 20, 2015, 02:35:53 PM
Sweet Thank you, that did work but it's a little touchy, I wish you could specify a bridge command like and or something to string multiples together. But for now it works just fine. I may eventually switch to tasker instead of voxwav but that is for another day.

On a side note you know you need more caffeine when you troubleshoot your play command for an hour only to realize you had a ? where you needed a &... Making good progress on the scripts for Plex and should need some testers next week sometime.
Title: Re: plex integration
Post by: jitterjames on March 20, 2015, 03:25:38 PM
You can use "and" as a prefix if that helps, but I wouldn't recommend doing that if you are actually using prefix mode with an open mic as well.

Depending on the commands you may only need to pause for about of a quarter of a second between them.  I doubt you would ever need to pause for more than a half a second.  I have always found that it works perfectly, I can give 5 commands in a row with just a brief pause between them, but I can't usually think that fast so I just issue one or two commands at a time.  With VoxWav there is virtually no delay while you wait for it to start listening like you have with Google Now so to be honest, I don't really see what the issue is with giving commands one at a time.

I also find the accuracy with Autovoice/Tasker to be significantly lower than with VoxWav.
Title: Re: plex integration
Post by: IKROWNI on June 15, 2015, 12:26:41 PM
Sweet Thank you, that did work but it's a little touchy, I wish you could specify a bridge command like and or something to string multiples together. But for now it works just fine. I may eventually switch to tasker instead of voxwav but that is for another day.

On a side note you know you need more caffeine when you troubleshoot your play command for an hour only to realize you had a ? where you needed a &... Making good progress on the scripts for Plex and should need some testers next week sometime.

Ever make any further progress with plex integration? I hate using xbmc anymore seems so outdated compared to plex now. I started with xbmc on the original Xbox and have grown up with it. But man is it ever lacking in some really nice features that plex has.

To work around the lack of plex voice control I just use "voice for plex"  Android app to cast media to my theater pc through my phone.
Title: Re: plex integration
Post by: batfasturd on June 15, 2015, 12:33:13 PM
Yeah I made more progress but then got distracted with life as usual. Give me a few days of tinkering to clean it up and I can release what I have so far which is at least functional.
Title: Re: plex integration
Post by: batfasturd on July 23, 2015, 05:20:10 PM
Ok so I think I have it cleaned up enough for someone to test if they want.

First I have installed VoxCommando in the c:\voxcommando folder, you will need to create 2 new folders inside that directory called PY and PlexPayloads. Copy plexAuth.py and getMovieOffset.py into the PY folder and modify using your plex.tv username and password so you can generate an auth token needed to access your server.

Import the VC XML I have attached and you will just need to change the "Generate PLEX map" script inside "PLEX admin 2.0.0" to include your server IP and port.

Once that is done you can run the Generate Auth token script, then "Generate PLEX map", and the "Generate plex xml vc2.0.0" script. By default the script will choose the first client on your network as the default client so you can say "Play movie spaceballs" and it will select the first client. You can also specify client names "Play movie spaceballs on bedroom roku" Or you can run the default client script and you can select a different default client. I haven't used it in a while and I think that resuming was working as well by saying "Resume, film or movie, then the movie title"

It should find your movie libraries and tv libraries automatically and if you have multiples of each like I do it will combine all movies and all tv shows. It will do the same for clients in your house which need to be running when you generate plex map and generate client payloads. once the payloads are saved and as long as the client is accessible you should not have to run generate client payload unless your client names change.

Music payloads are not working as I don't use plex for music at all so I apologize for that, it should be simple using my code as a base for adding that feature.

Many thanks to vulcanjedi and nime5ter for base code snippets and ideas as well as other people in the forums. Let me know if you have questions, comments, or feedback and I would be happy to help modify for fix issues or explain any methods to my madness.
Title: Re: plex integration
Post by: Dominique on August 17, 2015, 11:05:38 AM
Ok so I think I have it cleaned up enough for someone to test if they want.

First I have installed VoxCommando in the c:\voxcommando folder, you will need to create 2 new folders inside that directory called PY and PlexPayloads. Copy plexAuth.py and getMovieOffset.py into the PY folder and modify using your plex.tv username and password so you can generate an auth token needed to access your server.

Import the VC XML I have attached and you will just need to change the "Generate PLEX map" script inside "PLEX admin 2.0.0" to include your server IP and port.

Once that is done you can run the Generate Auth token script, then "Generate PLEX map", and the "Generate plex xml vc2.0.0" script. By default the script will choose the first client on your network as the default client so you can say "Play movie spaceballs" and it will select the first client. You can also specify client names "Play movie spaceballs on bedroom roku" Or you can run the default client script and you can select a different default client. I haven't used it in a while and I think that resuming was working as well by saying "Resume, film or movie, then the movie title"

It should find your movie libraries and tv libraries automatically and if you have multiples of each like I do it will combine all movies and all tv shows. It will do the same for clients in your house which need to be running when you generate plex map and generate client payloads. once the payloads are saved and as long as the client is accessible you should not have to run generate client payload unless your client names change.

Music payloads are not working as I don't use plex for music at all so I apologize for that, it should be simple using my code as a base for adding that feature.

Many thanks to vulcanjedi and nime5ter for base code snippets and ideas as well as other people in the forums. Let me know if you have questions, comments, or feedback and I would be happy to help modify for fix issues or explain any methods to my madness.

Awesome, I am going to try this.  Is there any way we can get VC to send the movie to Chromecast?
Title: Re: plex integration
Post by: vulcanjedi on August 17, 2015, 11:20:45 AM
Awesome, I am going to try this.  Is there any way we can get VC to send the movie to Chromecast?

Chromecast doesn't really have a plex client per se, but it does show up as a castable device so perhaps. Would think it would have to be listed in the plex device list.
A round about way which would be more successful is to have a different plex client ie: plex home theatre running somewhere that had the cast set to chromecast and setting VC to use that PHT instance as a proxy to chromecast. Unelegant but effective Id think.
Title: Re: plex integration
Post by: Dominique on August 17, 2015, 12:28:59 PM
I just tried this.  Granted I have not used VC in a very long time.  So I am somewhat rusty in getting things done/connected.

I followed the instructions and it did not work.  I created the 2 folders in the VC folder.  I added the XML to create the Plex voice commands and it still did not work. 

Any suggestions?
Title: Re: plex integration
Post by: batfasturd on August 17, 2015, 12:35:42 PM
Which part is not working, did you run the main scripts to get a key and get clients and such? Any errors in VC would help as well.
Title: Re: plex integration
Post by: Dominique on August 17, 2015, 02:21:15 PM
Which part is not working, did you run the main scripts to get a key and get clients and such? Any errors in VC would help as well.

Hmmm, I don't seem to know what you are talking about.  I just reinstalled VC after almost a year away so I do not remember much.  I am currently trying to re-familiarize myself with it.  Could you explain a little?  Thanks and sorry.
Title: Re: plex integration
Post by: IKROWNI on August 25, 2015, 10:39:30 PM
Ok so I think I have it cleaned up enough for someone to test if they want.

First I have installed VoxCommando in the c:\voxcommando folder, you will need to create 2 new folders inside that directory called PY and PlexPayloads. Copy plexAuth.py and getMovieOffset.py into the PY folder and modify using your plex.tv username and password so you can generate an auth token needed to access your server.

Import the VC XML I have attached and you will just need to change the "Generate PLEX map" script inside "PLEX admin 2.0.0" to include your server IP and port.

Once that is done you can run the Generate Auth token script, then "Generate PLEX map", and the "Generate plex xml vc2.0.0" script. By default the script will choose the first client on your network as the default client so you can say "Play movie spaceballs" and it will select the first client. You can also specify client names "Play movie spaceballs on bedroom roku" Or you can run the default client script and you can select a different default client. I haven't used it in a while and I think that resuming was working as well by saying "Resume, film or movie, then the movie title"

It should find your movie libraries and tv libraries automatically and if you have multiples of each like I do it will combine all movies and all tv shows. It will do the same for clients in your house which need to be running when you generate plex map and generate client payloads. once the payloads are saved and as long as the client is accessible you should not have to run generate client payload unless your client names change.

Music payloads are not working as I don't use plex for music at all so I apologize for that, it should be simple using my code as a base for adding that feature.

Many thanks to vulcanjedi and nime5ter for base code snippets and ideas as well as other people in the forums. Let me know if you have questions, comments, or feedback and I would be happy to help modify for fix issues or explain any methods to my madness.

Hey whats up man great to see this is still being worked on. i hate XBMC and cant wait to use this with my plex library. Im having some issues getting this running though. It seems like everything is firing properly but its just not starting the shows on my devices.

My client list is being populated and ive chosen different players from PHT to roku to chromecast but none seem to work. Cant wait to hear a reply back on this. This will give me reason to start using voxcommando again for playing my media, i had to resort to voice control for plex for sooo long now and it totally sucks having to use a seperate device to control plex. Again i surely appreciate the hard work put into the project.
Title: Re: plex integration
Post by: batfasturd on November 17, 2015, 02:50:54 AM
Hey whats up man great to see this is still being worked on. i hate XBMC and cant wait to use this with my plex library. Im having some issues getting this running though. It seems like everything is firing properly but its just not starting the shows on my devices.

My client list is being populated and ive chosen different players from PHT to roku to chromecast but none seem to work. Cant wait to hear a reply back on this. This will give me reason to start using voxcommando again for playing my media, i had to resort to voice control for plex for sooo long now and it totally sucks having to use a seperate device to control plex. Again i surely appreciate the hard work put into the project.


Do you have any output in our logs as to why it's not working? What commands are you trying to say?
Title: Re: plex integration
Post by: batfasturd on November 17, 2015, 04:18:34 AM
I also have fixed resume support for movies and need to add support for TV shows as well as fixed the ability to play the next episode of a TV show. For now the TV show is limited to playing the first unwatched episode, if you are all caught up this isn't an issue but if you have any unwatched episodes it will play them. Hopefully I can get that fixed as I would expect it to play the most recent unwatched episode or what Plex considers on deck.

I may tackle music here soon as I am getting back into the swing of home automation with voxcommando.
Along with Plex I want to write a script to better interface with Openhab easily.
Title: Re: plex integration
Post by: IKROWNI on February 05, 2016, 02:51:58 AM
I really wish this would just be baked right into vox commando like xbmc is. Plex is pretty much everywhere and on every device now. Can't see why it wouldn't be packaged in. I use vox for all of my home automation stuff now but I still resort to other apps for Plex control. I'm glad someone is at least working to get this going well for those out there needing it.
Title: Re: plex integration
Post by: jitterjames on April 24, 2018, 08:52:39 AM
I'm just wondering...

How many people are still interested in having a VoxCommando plugin for controlling Plex?

If I did make one it would be primarily tested against Plex Media Player for Windows since there is not much else I can use as a player. Would that still be of interest or does everyone use things like Chromecast etc.?
Title: Re: plex integration
Post by: vulcanjedi on April 24, 2018, 11:00:18 AM
TLDR; Yes?

I think most people in the living room likely use FireTV, Chromecast, xbox1/ps4.  I think Plex Media Player for windows would be very low utilization.  There is also the 'web client' that is bundled with every instance of the PMS install as its also the admin GUI.


Long response;

Personally I still am very hardcore a kodi fan for the living room experience.  That being said, it is far easier, cheaper and simpler to spin up plex for those that want it to proliferate throughout their whole house...etc.

I think it would be great but I'm not a dev.  I also think its going to be not fun as while markedly improved I think the documentation is still severely lacking and between the secure the connections I know other apps have issues connecting sometimes like the homeassistant plugin doesn't work. But again many other apps do support some integration with Plex.
I'm sure there are a lot of Chromecast and FireTV users. The great part about plex is the ubiquity of the client, chromecast and any of the other clients (or the plex app) that aren't on all the time would be a little more annoying as you'd need VC to engage those clients first if they aren't always on like a kodi instance is likely to be.  And not thinking you could remotely cast something that I've been aware of. But users could simply instantiate plex client first before expecting to use VC.
Also not sure how supportable it is for those users that have shared libraries, and if you could access any of those at all via their account...like you may have suggested only for those hosting their own PMS.

Also not sure how many people use the Home feature but that would add more complexity if supported.
I think none of the clients really support the extensibility of kodi clients. so making specials views wouldn't be possible....possibly unneeded as many clients do have the 'recently added' queues...etc.  Also Plex does do a superior job of monitoring the library than kodi so those functions too are kinda unnecessary.

Plex lacks the channels and youtube and the addons that some people really take to on kodi.

However Plex is faster to spin up, and configure and maintain for novices. So I think this want will only grow over time.
All that being said I still think the the pure function of being able to play whatever media would be nice and likely the #1 people do w/ Kodi&VC.  Play 'big buck bunny', play the next ep of blah blah or Symphony #9...etc would be nice but aside from that I'm not sure what other actions I can envision for Plex via VC.  Plex released a skill on Alexa but its not private as it must proxy thru amazon servers so this would be far more reliable, better performing and private.


Title: Re: plex integration
Post by: jitterjames on April 25, 2018, 08:19:24 AM
Thanks for your feedback.

I don't know what TLDR means in this context.  What was too long, and who didn't read it?  Yes I had to google "TLDR" because I had no idea what that meant to begin with.

I was hoping that people would let me know how and if they personally would be interested in a Plex plugin and so far what I'm sensing is that almost nobody is interested.  Certainly not enough to make it worth sinking another 80 hours or more of my time into hacking an undocumented API.

Maybe it's just that anyone who has decided to stick with VoxCommando has already given up on Plex, and anyone who stuck with Plex gave up on VC?

Too bad because I was actually starting to make some progress with Plex (already spent about 20 hours on it) but it seems like a wasted effort.  The API certainly seems to be very "flooby".  Even using only official clients they seem to randomly disappear from the list of players and different things seem to work on different clients.  Even PMP reacts differently to API control depending on whether it is in TV or Desktop modes.  Whacky.

My question of what type of media players people are using, assumes of course that people are already using or expecting to use VoxCommando.  So we already know this person has a Windows PC running so I figured there would be a relatively high number of people using PlexMediaPlayer as a client on the same HTPC they are running VC on.

I don't know what you mean by "engage those clients first".  Do you mean there is no way to launch those apps on external devices using a voice command?

Quote
"And not thinking you could remotely cast something that I've been aware of."
  - I'm not sure what this means.

I would not expect to be able to control content that does not exist on the local server.

If I made a plugin it would hopefully be able to control playback, and volume, launch and or search/navigate content for clients on the local area network accessing content from a local server.  Even if we could do more I don't really see what the point would be in terms of voice control.


Quote
"I think none of the clients really support the extensibility of kodi clients. so making specials views wouldn't be possible...."
- I'm not sure what this has to do with VC.  I certainly was not trying to start a conversation about whether Plex is better than Kodi. I also prefer Kodi (and MediaMonkey for music) and this is what I continue to use personally.  But that is not really important in this context.  If people want to use Plex that's fine.  I was just hoping to see if there was any demand for a plugin.

Yeah, we tried to test the Plex skill for Alexa.  After a few laughs we uninstalled it because we could not get anything to remotely work as expected.  For example asking for a movie to play resulted in music playing instead and the audio came out of the little tinny echo dot speaker instead of playing on our PMP client etc.
Title: Re: plex integration
Post by: vulcanjedi on April 25, 2018, 08:57:26 AM
Quote
I don't know what TLDR means in this context.  What was too long, and who didn't read it?  Yes I had to google "TLDR" because I had no idea what that meant to begin with.
TLDR; I was concerned maybe my response was too verbose.

Quote
I don't know what you mean by "engage those clients first".  Do you mean there is no way to launch those apps on external devices using a voice command?
  - I'm not sure what this means.
What I mean by this is when people use Kodi, typically its always on, always ready to listen.  This is not always the case with every Plex client. Those clients have other apps like Netflix and stuff so if the Plex app is not up, nothing would work.  Chromecast as well.

What I was saying is I've never seen anything that showed custom views in Plex. Maybe using the SEARCH function.  But VC could make those special views via the plugin like Unwatched eps of Show ABC.   


Thanks for your feedback.

I don't know what TLDR means in this context.  What was too long, and who didn't read it?  Yes I had to google "TLDR" because I had no idea what that meant to begin with.

I was hoping that people would let me know how and if they personally would be interested in a Plex plugin and so far what I'm sensing is that almost nobody is interested.  Certainly not enough to make it worth sinking another 80 hours or more of my time into hacking an undocumented API.

Maybe it's just that anyone who has decided to stick with VoxCommando has already given up on Plex, and anyone who stuck with Plex gave up on VC?

Too bad because I was actually starting to make some progress with Plex (already spent about 20 hours on it) but it seems like a wasted effort.  The API certainly seems to be very "flooby".  Even using only official clients they seem to randomly disappear from the list of players and different things seem to work on different clients.  Even PMP reacts differently to API control depending on whether it is in TV or Desktop modes.  Whacky.

My question of what type of media players people are using, assumes of course that people are already using or expecting to use VoxCommando.  So we already know this person has a Windows PC running so I figured there would be a relatively high number of people using PlexMediaPlayer as a client on the same HTPC they are running VC on.

I don't know what you mean by "engage those clients first".  Do you mean there is no way to launch those apps on external devices using a voice command?
  - I'm not sure what this means.

I would not expect to be able to control content that does not exist on the local server.

If I made a plugin it would hopefully be able to control playback, and volume, launch and or search/navigate content for clients on the local area network accessing content from a local server.  Even if we could do more I don't really see what the point would be in terms of voice control.

 - I'm not sure what this has to do with VC.  I certainly was not trying to start a conversation about whether Plex is better than Kodi. I also prefer Kodi (and MediaMonkey for music) and this is what I continue to use personally.  But that is not really important in this context.  If people want to use Plex that's fine.  I was just hoping to see if there was any demand for a plugin.

Yeah, we tried to test the Plex skill for Alexa.  After a few laughs we uninstalled it because we could not get anything to remotely work as expected.  For example asking for a movie to play resulted in music playing instead and the audio came out of the little tinny echo dot speaker instead of playing on our PMP client etc.
Title: Re: plex integration
Post by: vulcanjedi on May 01, 2018, 05:53:23 PM
I do think the Plex momentum is here to stay for a while. So it could help bring more (registered) user$