diff --git a/server/subsonic/media_annotation.go b/server/subsonic/media_annotation.go index b715f711f..171c54be1 100644 --- a/server/subsonic/media_annotation.go +++ b/server/subsonic/media_annotation.go @@ -112,6 +112,7 @@ func (api *Router) setStar(ctx context.Context, star bool, ids ...string) error return nil } event := &events.RefreshResource{} + broadcastToAll := false err := api.ds.WithTxImmediate(func(tx model.DataStore) error { for _, id := range ids { exist, err := tx.Album(ctx).Exists(id) @@ -149,7 +150,7 @@ func (api *Router) setStar(ctx context.Context, star bool, ids ...string) error } event = event.With("playlist", "*") // Ensure the refresh event is sent to all clients, including the originator - ctx = events.BroadcastToAll(ctx) + broadcastToAll = true continue } err = tx.MediaFile(ctx).SetStar(star, id) @@ -158,7 +159,11 @@ func (api *Router) setStar(ctx context.Context, star bool, ids ...string) error } event = event.With("song", id) } - api.broker.SendMessage(ctx, event) + if broadcastToAll { + api.broker.SendBroadcastMessage(ctx, event) + } else { + api.broker.SendMessage(ctx, event) + } return nil }) if err != nil {