Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
sentriz committed Mar 11, 2024
1 parent 6b8d6b7 commit 6ce1fe5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions infocache/artistinfocache/artistinfocache.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 2 additions & 0 deletions server/ctrlsubsonic/handlers_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 == "" {
Expand Down
3 changes: 3 additions & 0 deletions server/ctrlsubsonic/specidpaths/specidpaths.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 6ce1fe5

Please sign in to comment.