a
This commit is contained in:
4
db/db.go
4
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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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 == "" {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user