Make plex media players update position on state change#43759
Closed
shocklateboy92 wants to merge 1 commit intohome-assistant:devfrom
Closed
Make plex media players update position on state change#43759shocklateboy92 wants to merge 1 commit intohome-assistant:devfrom
shocklateboy92 wants to merge 1 commit intohome-assistant:devfrom
Conversation
Contributor
|
Thanks, this is definitely needed. I've addressed this specific gap as part of #42332. Since it seems like you're starting to dig through the code, a sanity check on that PR would be greatly appreciated if you're up for it. |
Contributor
Author
|
@jjlawren Thanks. I've looked through the PR you mentioned and it looks like it will address my needs. However, if you reckon that won't make it to the next release of HA then would prefer that this get merged 😊 |
Contributor
|
The other PR has been merged and is live in the beta. Ok to close this? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed change
Currently, media players for plex do throttled updates for the
media_positionattribute.This means that when a player is paused, it displays the incorrect position and there's no way to work out what the actual position is.
This change changes the throttle logic slightly so that if the player state changed (e.g
pausedtoplaying, or vice-versa), it updates the position anyway.This way, frontend components can always work out the current exact media position with the following logic:
paused, then the current value is correctplaying, then current position ismedia_position+ time delta betweennowandmedia_position_updated_at.This will reduce the throttling slightly, and I hope that's okay. If not, please let me know and we can discuss alternate ways of allowing frontend components to determine the exact position of a plex media player.
Also happy to make any improvements to the proposed code change; just let me know 😄
Type of change
Checklist
black --fast homeassistant tests)To help with the load of incoming pull requests: