diff --git a/db/db.go b/db/db.go index 0b60c084..9ea81a97 100644 --- a/db/db.go +++ b/db/db.go @@ -557,6 +557,10 @@ func (ir *InternetRadioStation) SID() *specid.ID { return &specid.ID{Type: specid.InternetRadioStation, Value: ir.ID} } +func (ir *InternetRadioStation) AbsPath() string { + return ir.StreamURL +} + type ArtistInfo struct { ID int `gorm:"primary_key" sql:"type:int REFERENCES artists(id) ON DELETE CASCADE"` CreatedAt time.Time diff --git a/infocache/artistinfocache/artistinfocache.go b/infocache/artistinfocache/artistinfocache.go index f30c1cba..6951205b 100644 --- a/infocache/artistinfocache/artistinfocache.go +++ b/infocache/artistinfocache/artistinfocache.go @@ -109,6 +109,7 @@ func (a *ArtistInfoCache) Refresh() error { if err := q.Find(&artist).Error; err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { return fmt.Errorf("finding non cached artist: %w", err) } + if artist.ID == 0 { return nil } diff --git a/server/ctrlsubsonic/handlers_common.go b/server/ctrlsubsonic/handlers_common.go index 1ee6484a..8db9ad87 100644 --- a/server/ctrlsubsonic/handlers_common.go +++ b/server/ctrlsubsonic/handlers_common.go @@ -95,6 +95,8 @@ func (c *Controller) ServeScrobble(r *http.Request) *spec.Response { if err := scrobbleStatsUpdatePodcastEpisode(c.dbc, id.Value); err != nil { return spec.NewError(0, "error updating stats: %v", err) } + default: + return spec.NewError(10, "can't scrobble type %s", id.Type) } if scrobbleTrack.Track == "" { diff --git a/server/ctrlsubsonic/specidpaths/specidpaths.go b/server/ctrlsubsonic/specidpaths/specidpaths.go index 4ff8ab9e..51fb0ece 100644 --- a/server/ctrlsubsonic/specidpaths/specidpaths.go +++ b/server/ctrlsubsonic/specidpaths/specidpaths.go @@ -29,6 +29,9 @@ func Locate(dbc *db.DB, id specid.ID) (Result, error) { case specid.PodcastEpisode: var pe db.PodcastEpisode return &pe, dbc.Preload("Podcast").Where("id=? AND status=?", id.Value, db.PodcastEpisodeStatusCompleted).Find(&pe).Error + case specid.InternetRadioStation: + var irs db.InternetRadioStation + return &irs, dbc.Where("id=?", id.Value).Find(&irs).Error default: return nil, ErrNotFound }