Skip to content

should fix #61#65

Open
mmattbtw wants to merge 3 commits intomainfrom
matt/fix-fighting
Open

should fix #61#65
mmattbtw wants to merge 3 commits intomainfrom
matt/fix-fighting

Conversation

@mmattbtw
Copy link
Copy Markdown
Member

haven't tested so beware

@mmattbtw mmattbtw requested a review from Copilot March 31, 2026 17:13
@mmattbtw
Copy link
Copy Markdown
Member Author

@fatfingers23 if you wanna test, i don't have spotify T-T

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/arbiter coordinator that resolves the “current” track by per-user service priority and gates publish/clear/scrobble actions.
  • Persist a service_priority preference on models.User / users table, 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.

mmattbtw and others added 2 commits April 1, 2026 23:20
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@mmattbtw mmattbtw linked an issue Apr 2, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Apple Music and Spotify are fighting

2 participants