navidrome/model/radio.go
Deluan 8badec2d62 refactor(artwork): drop what the removed retry paths left behind
Deleting the absent-retry jobs and the startup backfill orphaned more
than the code that went with them.

`Worker.agents` lost its only reader when Backfill went.
`RadioRepository.GetAllIDs` existed solely for that backfill's bulk
enumeration, as its own comment said. `CountAbsent` became a second
query for a number `artwork status` already had: only two paths write
item_artwork, and only the absent one leaves `source` empty, so
`hash = ''` and `source = ''` select the same rows. The absent count now
comes from the source breakdown collected in the same loop, four queries
cheaper.

Two defects surfaced while pulling on that thread. `reprocess --all`
returned on an empty match set before recording the fingerprint, so the
command the startup warning names could not silence it. And the "did
this run apply the config" flag was derived in the CLI from its own
globals, which made `--kind ar --kind al --kind pl --kind rd` — work
identical to `--all` — leave the fingerprint stale. It is now derived
inside reprocessArtwork from the kinds and sources that drive the
queries, so a filter added later has to pass through it.

settlesAbsentOnGiveUp decided a worker persistence policy by testing
membership in a CLI-facing kind list. It now states the policy directly.
Its rationale was wrong too: media files already get an absent row on
the definitive path, and the reason to skip them on give-up is that a
track with no row still falls back to disc or album art.

CheckConfigFingerprint wrote to the database on one of three branches,
so it is ReconcileConfigFingerprint now.
2026-08-30 20:03:10 -04:00

40 lines
1.1 KiB
Go

package model
import (
"time"
"github.com/navidrome/navidrome/consts"
)
type Radio struct {
ItemImage `structs:"-"`
ID string `structs:"id" json:"id"`
StreamUrl string `structs:"stream_url" json:"streamUrl"`
Name string `structs:"name" json:"name"`
HomePageUrl string `structs:"home_page_url" json:"homePageUrl"`
UploadedImage string `structs:"uploaded_image" json:"uploadedImage,omitempty"`
CreatedAt time.Time `structs:"created_at" json:"createdAt"`
UpdatedAt time.Time `structs:"updated_at" json:"updatedAt"`
}
func (r Radio) CoverArtID() ArtworkID {
return artworkIDFromRadio(r)
}
func (r Radio) UploadedImagePath() string {
return UploadedImagePath(consts.EntityRadio, r.UploadedImage)
}
type Radios []Radio
type RadioRepository interface {
ResourceRepository
CountAll(options ...QueryOptions) (int64, error)
Delete(id string) error
Exists(id string) (bool, error)
Get(id string) (*Radio, error)
GetAll(options ...QueryOptions) (Radios, error)
Put(u *Radio, colsToUpdate ...string) error
}