Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't forcibly send timeline updates every second #137

Closed
Uncloak2 opened this issue Aug 23, 2024 · 5 comments
Closed

Don't forcibly send timeline updates every second #137

Uncloak2 opened this issue Aug 23, 2024 · 5 comments
Labels
enhancement New feature or request good first issue Good for newcomers Solved in next beta

Comments

@Uncloak2
Copy link

Uncloak2 commented Aug 23, 2024

Description: UpdateNowPlaying forces PMS updates every 1 second during playback events. Important events are already reported due to prior work done so updating every 1s is no longer required.

Potentially affected code: https://github.com/pannal/plex-for-kodi/blob/develop_kodi21/lib/player.py#L762

Details:

  • Add-on version: 0.7.9-rev2
  • Kodi version: 21.0
  • OS Platform: Any
  • Hardware: Any
2024-08-23 11:02:20.505 T:6203892    info <general>: script.plex: Notification: xbmc Player.OnAVChange {"item":{"title":"The Mask","type":"movie","year":1994},"player":{"playerid":-1,"speed":1}}
2024-08-23 11:02:20.550 T:6203897    info <general>: script.plex: UpdateNowPlaying: 27897, force: True refreshQueue: False state: None (player: playing) overrideChecks: False time: None (player: 0.099)
2024-08-23 11:02:21.654 T:6203897    info <general>: script.plex: UpdateNowPlaying: 27897, force: True refreshQueue: False state: None (player: playing) overrideChecks: False time: None (player: 1.133)
2024-08-23 11:02:22.750 T:6203897    info <general>: script.plex: UpdateNowPlaying: 27897, force: True refreshQueue: False state: None (player: playing) overrideChecks: False time: None (player: 2.362)
2024-08-23 11:02:23.833 T:6203897    info <general>: script.plex: UpdateNowPlaying: 27897, force: True refreshQueue: False state: None (player: playing) overrideChecks: False time: None (player: 3.395)
2024-08-23 11:02:24.918 T:6203897    info <general>: script.plex: UpdateNowPlaying: 27897, force: True refreshQueue: False state: None (player: playing) overrideChecks: False time: None (player: 4.421)
2024-08-23 11:02:25.999 T:6203897    info <general>: script.plex: UpdateNowPlaying: 27897, force: True refreshQueue: False state: None (player: playing) overrideChecks: False time: None (player: 5.6450000000000005)

(player: paused) also reports back every second as well.

Resolution: change the way PM4K reports back playback status.

@Uncloak2 Uncloak2 reopened this Aug 23, 2024
@pannal pannal added enhancement New feature or request good first issue Good for newcomers labels Aug 23, 2024
@pannal
Copy link
Owner

pannal commented Aug 23, 2024

Yep, this is on my list for 0.8.0. Thank you!

@pannal
Copy link
Owner

pannal commented Aug 23, 2024

Try this: script.plexmod.zip

The DEBUG entries are still every second, but it won't send the same event every second, only if the playstate changes, or every 10 seconds.

@Uncloak2
Copy link
Author

Uncloak2 commented Aug 23, 2024

Try this: script.plexmod.zip

The DEBUG entries are still every second, but it won't send the same event every second, only if the playstate changes, or every 10 seconds.

Thanks for this, so quick! Just tried it out, it appears to be reporting back to the PMS every 20 seconds, not 10 going off the console logs.

@pannal
Copy link
Owner

pannal commented Aug 23, 2024

Here's a more concise implementation: script.plexmod.zip

It uses the same logic, but relies on the serverTimeline for the check whether to send or not (expiry for a server timeline is 15 seconds). Every major state change is reported immediately, of course.

Edit: Whoops, this probably broke music and it threw an error. Reuploaded zip (13:23 CEST)

@Uncloak2
Copy link
Author

Uncloak2 commented Aug 23, 2024

Here's a more concise implementation: script.plexmod.zip

It uses the same logic, but relies on the serverTimeline for the check whether to send or not (expiry for a server timeline is 15 seconds). Every major state change is reported immediately, of course.

Yes, this seems to work well from what I can see in the logs!

EDIT: only tested old zip

EDIT2: new zip also seems to work as well although I don't have any music to test, just video.

@pannal pannal closed this as completed in b9c2c88 Sep 12, 2024
pannal added a commit that referenced this issue Sep 13, 2024
pannal added a commit that referenced this issue Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers Solved in next beta
Projects
None yet
Development

No branches or pull requests

2 participants