PlexDevices - Custom Media Player Component

It is a copy/paste from my configuration.yaml.

It is for the old plugin, not your improved one.

Is it something you want me to check to verify that it is not just my mind telling me it reacts faster? :slight_smile:

/R

You’re right - its built in to the media_player component, not the plex component.

Here’s my config for anyone who care:

  - platform: plexdevices
    entity_namespace: 'plexdevices'
    include_non_clients: true
    use_episode_art: true
    use_dynamic_groups: true
    use_custom_entity_ids: true
    show_all_controls: false
    scan_interval: 1

What does entity_namespace do and what is custom entity ids?

entity_namespace prefixes your entity ids. Ex. your devices probably show as media_player.playroom where mine show as media_player.plexdevices_playroom

custom_entity_ids use the plex machine identifier as the name instead of the friendly name. So instead of media_player.plex_web_safari_2 mine show as media_player.dhjfjsjfh238746. This way I can create automations that will reliably target a specific device, for example my laptop’s safari browser instead of the first person to stream plex from safari (ex. my wife’s laptop safari browser).

Can you test the PlayMedia to your shield (to play music, a playlist, an episode, and a movie)?

Coming soon - frozen detection and remediation:

  • Forces a “playing” device to become “paused” when the playing position hasn’t moved in x time.
  • Forces a “paused” device to become “idle” when the playing position hasn’t moved in y time.

x and y time will have built in defaults which you can override.

This is useful to force correct disconnected sessions - i.e. someone who was streaming and didn’t properly disconnect. Examples:

  • Streaming phone session where the user locks the phone or terminates the app
  • Streaming browser session where the user suspends the computer, closes the browser, or closes the tab

UPDATE POSTED

1 Like

Is it possible to include the home user that is currently playing a media in the media player attribute?

Don’t think so. While I’m able to retrieve all sorts of data, I can only expose the data through predefined media_player attributes

Other systems expose extra information in additional entity_ids. Zwave for example generates a heap of separate sensors for just one switch. I guess you could do something like that.

/R

Sure but that can get messy quick. Even if I did, what entity type would I create? Sensor? What values would it hold? Better to get integrated to the media_player component. If I go that route, what standard data should it expose that isn’t already:

  • username
  • address (i.e. ip)
  • library
  • content rating (ex. R, PG)
  • other?

Sorry it took me so long; I’m doing testing for three or four different projects now!

So Movie worked well; Episode did produce results, but I need to verify the syntax of the episode number;

I used your example in the read me docs because it was Rick & Morty and I knew I had both seasons. All I changed was the library name. But it played a video of the DVD extras, one of the animatics. It would have been in Season 0 as a “Specials”.

Do you call episodes in the standard “S01E10” type format or…? Couldn’t find a reference in the docs and the example just had “15” in the value.

Can’t test music at the moment; I pulled my music libraries from the Shield because the metadata was going to kill the Shield. I will create a small non PlexPass music library for testing though and come back with those results.

Thanks, I see you’re busy on the ring project (I’m waiting patiently for that one).

When it played the season 0, what exactly did you put as your json?

Exactly what you had in the episode example, with the library name adjusted to my library:

{
    "entity_id" : "media_player.plex_shield",
    "media_content_id": "{ \"library_name\" : \"TV Shows\", \"show_name\" : \"Rick and Morty\", \"episode_number\" : 15, \"shuffle\": \"0\" }",
    "media_content_type": "EPISODE"
}

It’s playing the 15th episode not episode 15. Can you confirm? From season 0, count the number of episodes up to and including the one that played. Is that number 15?

Nope. If it’s just going off the position in the library then in Season 0, “Episode 15” would have been the Carl’s Jr Hardees commercial. Here’s a snap of it in the library.

The three animatics in the library are Episodes 22, 23 and 24 respectively.

But the question for me still is how do you call an ep? For as long as I have been using media centers, cataloging was always Season Number Episode. So Season 1, Episode 10 (Close Rick-Counters of the Rick Kind) would be expressed as S01E10. That’s how I would expect to call it in a play media action because that’s the way it’s always worked when comparing it to metadata sites.

Is this not the case? Are you doing absolute numbering from a show Pilot = 1, next episode is number 2 and so on?

1 Like

This part of the code was derived from this discussion:

All I needed at that time was have the ability to play a workout video. These workout videos were added to a Plex library as “TV Shows”. But in the directories they didn’t have season subdirectories and the files had ‘title - s0en.m4v’ format.

So, when you look at the Plex data reported for these titles the parent data structure does not have a season title.

Other TV Shows I have on plex in another libraries do have parent data structures with season titles.

I do agree that this component should support a json language that allows for selecting season (optionally) along with episode number.

1 Like

I think that this is an important part of the play_media action and should be supported. Even Plex conforms to these guidelines when suggesting how to set up libraries for metadata generation:

https://support.plex.tv/hc/en-us/articles/200220687-Naming-Series-Season-Based-TV-Shows

Now if the Plex API isn’t providing that information, that’s another thing entirely. (And this is always a possibility with them.)

But if it does support it, I think it’s kind of mandatory to include it since it’s pretty much how everyone does it.

Update coming to support season number and episode number (instead of episode index), ex.:

{
    "entity_id" : "media_player.plex_7b8c4c63_38ff_417d_ac14_0457796ee1c1",
    "media_content_id": "{ \"library_name\" : \"Adult TV\", \"show_name\" : \"Rick and Morty\", \"season_number\" : 2, \"episode_number\" : 5, \"shuffle\": \"0\" }",
    "media_content_type": "EPISODE"
}
1 Like

UPDATE POSTED

1 Like