release / go (push) Successful in 1m54s
release / web (push) Failing after 5s
release / integration (push) Failing after 3m44s
release / govulncheck (push) Successful in 20s
release / Attach APK to the Release (tag releases only) (push) Canceled after 0s
release / Build + push container image (push) Canceled after 0s
release / Verify release artifacts (tag releases only) (push) Canceled after 0s
release / Build signed APK (push) Canceled after 19s
release / android (push) Canceled after 2m37s
Minstrel is now a viewer of the library it is pointed at. Finding, downloading and filing music moves out of it. Removed from the server: - the request flow (requests, approval, auto-approve) and the wanted list, follows, release profiles and release blocks; - searching indexers, the download clients, the importer, the album lifecycle and missing-file re-acquisition; - the catalogue's discography, search and art (the MusicBrainz release and track-list cache stays, for the duplicate resolver); - Discover: its suggestions of artists not in the library, snoozes, the candidate-artist tag enrichment and its tuning scope; - writes to acquisition tables from moving the library folder and from merging duplicates, the want-list join on Suspect sources, the sealing of acquisition credentials, and the release-group lookup only re-acquisition used. Settling a wrong-slot duplicate no longer sets the release aside: the copies go and their slots show as missing until a good copy is in the library. Removed from the web: Admin > Acquisition and Requests, /requests, /discover, Follow on the artist page, the auto-approve toggle, and the Collection's wanted-list tabs. The Collection is now the library's health: an overview, Reports, Duplicates, Suspect sources and Missing files. The README and docs no longer describe getting music. The tables stay for now; a later migration drops them. The request notification kinds and the Android screens are still to go. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
104 lines
3.0 KiB
Go
104 lines
3.0 KiB
Go
// Small helpers for posting live events to the SSE bus. Producers call
|
|
// these from their handler success paths so the wire shape stays in one
|
|
// place. Each helper is a no-op when h.eventbus is nil (tests that don't
|
|
// construct a bus); production always has one.
|
|
|
|
package api
|
|
|
|
import (
|
|
"git.fabledsword.com/bvandeusen/minstrel/internal/eventbus"
|
|
"github.com/jackc/pgx/v5/pgtype"
|
|
)
|
|
|
|
// publishLikeEvent broadcasts a track/album/artist like or unlike. The
|
|
// event is scoped to the user (so only their own clients invalidate); the
|
|
// payload includes the entity_type and entity_id so the dispatcher can
|
|
// invalidate the right query keys.
|
|
func (h *handlers) publishLikeEvent(userID, entityID pgtype.UUID, entityType string, liked bool) {
|
|
if h.eventbus == nil {
|
|
return
|
|
}
|
|
kind := "track.liked"
|
|
if !liked {
|
|
kind = "track.unliked"
|
|
}
|
|
if entityType == "album" {
|
|
if liked {
|
|
kind = "album.liked"
|
|
} else {
|
|
kind = "album.unliked"
|
|
}
|
|
}
|
|
if entityType == "artist" {
|
|
if liked {
|
|
kind = "artist.liked"
|
|
} else {
|
|
kind = "artist.unliked"
|
|
}
|
|
}
|
|
h.eventbus.Publish(eventbus.Event{
|
|
Kind: kind,
|
|
UserID: uuidToString(userID),
|
|
Data: map[string]any{
|
|
"entity_type": entityType,
|
|
"entity_id": uuidToString(entityID),
|
|
},
|
|
})
|
|
}
|
|
|
|
// publishQuarantineEvent broadcasts a quarantine action. User-side
|
|
// flag/unflag are scoped to the user; admin-side resolve / delete-file
|
|
// are broadcast (empty UserID) because a single admin
|
|
// action can affect every user who'd flagged that track — every client
|
|
// invalidates and the non-affected ones no-op when the query result
|
|
// matches their cache.
|
|
func (h *handlers) publishQuarantineEvent(kind string, userID, trackID pgtype.UUID, broadcast bool) {
|
|
if h.eventbus == nil {
|
|
return
|
|
}
|
|
scope := ""
|
|
if !broadcast {
|
|
scope = uuidToString(userID)
|
|
}
|
|
h.eventbus.Publish(eventbus.Event{
|
|
Kind: kind,
|
|
UserID: scope,
|
|
Data: map[string]any{
|
|
"track_id": uuidToString(trackID),
|
|
},
|
|
})
|
|
}
|
|
|
|
// publishPlaylistEvent broadcasts a playlist mutation to the owner so
|
|
// their other clients invalidate the affected playlist (and playlist list)
|
|
// providers. Public-playlist subscribers are out of scope here — they'd
|
|
// need a separate "playlists.public_updated" broadcast, deferred until
|
|
// the multi-user case is exercised.
|
|
func (h *handlers) publishPlaylistEvent(kind string, ownerID, playlistID pgtype.UUID) {
|
|
if h.eventbus == nil {
|
|
return
|
|
}
|
|
h.eventbus.Publish(eventbus.Event{
|
|
Kind: kind,
|
|
UserID: uuidToString(ownerID),
|
|
Data: map[string]any{
|
|
"playlist_id": uuidToString(playlistID),
|
|
},
|
|
})
|
|
}
|
|
|
|
// publishSystemRebuilt notifies the owner's clients that their system
|
|
// playlists (and You-might-like rows) were regenerated, so they invalidate
|
|
// the home / system-playlist providers and a stale active queue can re-pull.
|
|
// Mirrors the daily scheduler's event; fired here from the manual refresh.
|
|
func (h *handlers) publishSystemRebuilt(userID pgtype.UUID) {
|
|
if h.eventbus == nil {
|
|
return
|
|
}
|
|
h.eventbus.Publish(eventbus.Event{
|
|
Kind: "playlist.system_rebuilt",
|
|
UserID: uuidToString(userID),
|
|
Data: map[string]any{},
|
|
})
|
|
}
|