Open
Conversation
Member
Author
|
@fatfingers23 if you wanna test, i don't have spotify T-T |
There was a problem hiding this comment.
Pull request overview
This PR introduces cross-service arbitration to prevent conflicting “now playing” updates and duplicate scrobbles when multiple music services are linked, and adds a user-configurable streaming service priority to control which service wins.
Changes:
- Add a new
service/arbitercoordinator that resolves the “current” track by per-user service priority and gates publish/clear/scrobble actions. - Persist a
service_prioritypreference onmodels.User/userstable, expose an API to update it, and add a home-page UI to manage it. - Update Spotify, Last.fm, and Apple Music services to report “live” / “last stamped” tracks and to consult the arbiter before publishing/clearing/scrobbling.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| service/arbiter/arbiter.go | New coordinator enforcing per-user service priority and dedupe window rules. |
| service/arbiter/arbiter_test.go | Tests for priority resolution, dedupe behavior, and gating decisions. |
| models/user.go | Add service constants + ServicePriority field and normalization/parsing helpers. |
| models/user_test.go | Tests for priority normalization and default fallback. |
| db/db.go | Add service_priority column, load/save it, and add DB update method. |
| cmd/handlers.go | Build priority options for UI; add current-track resolver handler + priority update API handler. |
| cmd/routes.go | Route current-track through arbiter; add service-priority preferences endpoint. |
| cmd/main.go | Instantiate arbiter and inject into Spotify/Last.fm/Apple Music services. |
| cmd/service_priority_test.go | Handler/unit tests for updating service priority and current-track resolution handler. |
| pages/templates/home.gohtml | Add UI + JS to select and save service priority. |
| service/spotify/spotify.go | Add live/last-stamped tracking + arbiter checks for publish/clear/scrobble. |
| service/lastfm/lastfm.go | Add live/last-stamped tracking + arbiter checks for publish/clear/scrobble. |
| service/lastfm/lastfm_test.go | Tests asserting Last.fm publish/clear/scrobble are blocked by higher-priority live state. |
| service/applemusic/applemusic.go | Add TTL-based live-state tracking + arbiter checks + avoid republishing unchanged tracks. |
| service/applemusic/applemusic_test.go | Tests for TTL expiry and “unchanged track does not republish”. |
| config/config.go | Add Apple Music now-playing TTL default. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
haven't tested so beware