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

Graph API supports bi-directional updates for Releases (Playnite Games) #711

Merged

Conversation

andrew-codes
Copy link
Owner

@andrew-codes andrew-codes commented Feb 2, 2025

Playnite Web Releases can have certain properties updated via the Graph API that will reflect in both Playnite and Playnite Web.

Note that relational properties must be handled individually for every entity type in Playnite. Currently this PR enables the Graph API to support Playnite Games' features. Soon to be included completion status, too. Others will be considered additional features and will have a dedicated issue for each.
Note this does not enable a UI to support updating data. This will be handled in a future PR.

The following cases are handled:

  • Sending an update to the Graph API for non-relational properties and Playnite is running, then the update is applied to Playnite.
  • Updates applied to Playnite via the Graph API for non-relational properties, will synchronizec back to Playnite Web automatically when successfully updating Playnite.
  • One or more updates are sent to the Graph API, while Playnite is not running. Each update is applied in chronological order once Playnite comes back online.
  • Graph API provides a subscription for entity updates. When an entity is updated from Playnite, subscribers are notified of the change. This allows automatically updating the UI with fresh data.
  • Playnite game features relational property is supported for updates (add and remove)
  • duplicated adds and removes are ignored
  • adds or removes with invalid Oids are ignored

Closes #569
Closes #696
Relates to #461
Closes #668

BREAKING CHANGE - MQTT update messages have changed. The message topic taxonomy, payload shape, and persistence have changed. Update and connection messages are not persistent. Bi-directional updates rely on persistent message in MQTT. Please see the setup documentation for an example Mosquitto configuration file to enable persistence. Please see MQTT documentation for changes to message formats.

Copy link

codecov bot commented Feb 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 51.12%. Comparing base (8cf3c07) to head (25c0042).
Report is 47 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (8cf3c07) and HEAD (25c0042). Click for more details.

HEAD has 3 uploads less than BASE
Flag BASE (8cf3c07) HEAD (25c0042)
unit-tests 2 1
component-tests 2 1
e2e-tests 2 1
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #711      +/-   ##
==========================================
- Coverage   61.00%   51.12%   -9.89%     
==========================================
  Files          98      103       +5     
  Lines        2003     2173     +170     
  Branches      442      482      +40     
==========================================
- Hits         1222     1111     -111     
- Misses        773      993     +220     
- Partials        8       69      +61     
Flag Coverage Δ
component-tests 36.04% <ø> (ø)
e2e-tests 60.23% <ø> (-13.29%) ⬇️
unit-tests 8.40% <ø> (-0.91%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@andrew-codes andrew-codes force-pushed the 461-update-completion-status-directly-from-playnite-web branch 2 times, most recently from 16f8cae to 0f2c8ef Compare February 4, 2025 16:03
MQTT messages are not structured to be persistent for entity updates. This ensures updates applied in Playnite Web or Playnite are received to keep the two in sync, even if one is offline. Additionally, the device ID becomes important to prevent infinite loop updates of Playnite or Playnite  Web receiving update messages that it itself broadcast.

Note the MQTT documentation for the changes to message formats.

BREAKING CHANGE
@andrew-codes andrew-codes force-pushed the 461-update-completion-status-directly-from-playnite-web branch from 0f2c8ef to 123d770 Compare February 4, 2025 16:04
Now that update messages are persisted, syncing the library can and should utilize these. This ensures all data is synced, even if Playnite Web goes down in the middle. The only exception to this at the moment are game assets (cover art, icons and background images).
@andrew-codes andrew-codes force-pushed the 461-update-completion-status-directly-from-playnite-web branch from 61da4e8 to 29ca584 Compare February 5, 2025 00:16
@andrew-codes andrew-codes changed the title Enable updating Playnite Games from Playnite Web Support updating data from Playnite Web to Playnite Feb 5, 2025
@andrew-codes andrew-codes changed the title Support updating data from Playnite Web to Playnite Enable updating release completion status from Playnite Web to Playnite Feb 5, 2025
@andrew-codes andrew-codes changed the title Enable updating release completion status from Playnite Web to Playnite Graph API supports bi-directional updates for Releases (Playnite Games) Feb 5, 2025
@andrew-codes andrew-codes marked this pull request as ready for review February 5, 2025 16:54
@andrew-codes andrew-codes force-pushed the 461-update-completion-status-directly-from-playnite-web branch from 55d34bd to 8ee9fc4 Compare February 5, 2025 18:10
@andrew-codes andrew-codes merged commit 5cd3215 into main Feb 5, 2025
8 checks passed
@andrew-codes andrew-codes deleted the 461-update-completion-status-directly-from-playnite-web branch February 5, 2025 20:28
github-actions bot pushed a commit that referenced this pull request Feb 7, 2025
# [11.0.0](v10.4.0...v11.0.0) (2025-02-07)

* Graph API supports bi-directional updates for Releases (Playnite Games) ([#711](#711)) ([5cd3215](5cd3215)), closes [#569](#569) [#696](#696) [#461](#461)

### Features

* persist connection mqtt messages ([0621062](0621062)), closes [#569](#569)

### wip

* update messages are persistent ([123d770](123d770))

### BREAKING CHANGES

* - MQTT update messages have changed. The message topic
taxonomy, payload shape, and persistence have changed. Update and
connection messages are not persistent. Bi-directional updates rely on
persistent message in MQTT. Please see the setup documentation for an
example Mosquitto configuration file to enable persistence. Please see
MQTT documentation for changes to message formats.
* CHANGE
Copy link

github-actions bot commented Feb 7, 2025

🎉 This PR is included in version 11.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done ✅
1 participant