devfake/flox

Plex

devfake opened this issue · 4 comments

A simple Plex API has now been added.

This enables the creation of new items in Flox when playing a video in Plex. Mark a episode as seen if a episode is finished or rate a movie/tv show.

A simple API for this has been added to Flox. The implementation for Plex is available here: https://github.com/devfake/flox/blob/master/backend/app/Services/Api/Plex.php. It can be used for other programs as well.

Is that enough? Or do we also need a sync from Flox to Plex? Is there an API for that?

Could someone use real media to test the Plex implementation in Flox?

If I could use flox to go from plex1 -> flox -> plex1,plex2 then you’d have me for life.

I have a plex installation that needs to be migrated to a new server. But I don’t want to lose my watches status on tv and shows. I can rebuild the plex library easily enough but there is no way other than trakt.tv to sync watched state across plex servers. There is an api that will let you update the watches status, so I guess you’d need to write the synchronization routine that runs every x hours or y days to push mark all content in the subscribed plex servers as watched.

You already have the plex->flox syncing I think.

That's right. Currently I have no real time to learn the API of Plex and test it :/

I would like to see the feature to filter out shared users.
Our Plex server shares some libraries out to other households and when they watch things, they end up in Flox as well. That should be configurable.
A filter on the account ID would probably be easiest to implement. We could add configurable account IDs in settings and then filter in abortRequest() if $this->data['Account']['id'] is not in the configured values.
The server owner account is usually ID 1. Account IDs are received by the API already.

https://support.plex.tv/articles/115002267687-webhooks/

[2020-02-03 22:07:11] local.INFO: api data: {"event":"media.stop","user":false,"owner":true,"Account":{"id":19774186,"thumb":"https://plex.tv/users/d8a0d49f9932517d/avatar?c=1563895582","title":"Username_is_here"}

We must not get confused by "user" and "owner" values here. I believe these refer to the user which the Webhook belongs to. That'd usually be the server owner. But the Account ID is what we want to use here.

To take it one step further, we could even gather all the Accounts that Flox has seen from Plex on the settings page and allow to select which ones to track via a nice selection screen (username is provided as Account->title by the API). Then users wouldn't need to find out from the API data which Account IDs they want to track and which not.
Though a numeric filter as a first start should be enough. :)

I added a simple filter for the server owner to my installation, as that's really easy to do. However the GUI seems to be mostly Javascript and while I understand PHP perfectly well, GUI programming is honestly not my strong suit. :)

protected function abortRequest() { if($this->data['Account']['id'] != 1) { return true; } return !in_array($this->data['Metadata']['type'], ['episode', 'show', 'movie']); }

If I could use flox to go from plex1 -> flox -> plex1,plex2 then you’d have me for life.

I have a plex installation that needs to be migrated to a new server. But I don’t want to lose my watches status on tv and shows. I can rebuild the plex library easily enough but there is no way other than trakt.tv to sync watched state across plex servers. There is an api that will let you update the watches status, so I guess you’d need to write the synchronization routine that runs every x hours or y days to push mark all content in the subscribed plex servers as watched.

You already have the plex->flox syncing I think.

This would be so awesome. I know that trakt.tv can be used for it, but I don't want to give trakt all that information.