feat(subsonic): support more podcast metadata and podcast bookmarks (#569)

* Migrate podcast episodes database entries.

* Expose album, artist, and image for podcast episodes.

* Update bookmarks to show podcast episodes.

* Fix lint error.

* Remove OriginalImageURL field.
This commit is contained in:
Vijay Dubb
2025-03-24 13:43:06 +00:00
committed by GitHub
parent e5f7ef3c86
commit 63a420d2d3
7 changed files with 58 additions and 29 deletions

No files matched your search

+12
View File
@@ -48,6 +48,18 @@ func (c *Controller) ServeGetBookmarks(r *http.Request) *spec.Response {
return spec.NewError(10, "finding entry: %v", err)
}
respBookmark.Entry = spec.NewTrackByTags(&track, track.Album)
case specid.PodcastEpisode:
var podcastEpisode db.PodcastEpisode
err := c.dbc.
Preload("Podcast").
Find(&podcastEpisode, "id=?", bookmark.EntryID).
Error
if err != nil {
return spec.NewError(10, "finding entry: %v", err)
}
respBookmark.Entry = spec.NewTCPodcastEpisode(&podcastEpisode)
default:
continue
}
sub.Bookmarks.List = append(sub.Bookmarks.List, respBookmark)
@@ -127,6 +127,9 @@ func NewTCPodcastEpisode(pe *db.PodcastEpisode) *TrackChild {
IsDir: false,
Type: "podcastepisode",
CreatedAt: pe.CreatedAt,
Album: pe.Album,
Artist: pe.Artist,
CoverID: pe.SID(),
}
if pe.Podcast != nil {
trCh.ParentID = pe.Podcast.SID()
@@ -136,7 +139,7 @@ func NewTCPodcastEpisode(pe *db.PodcastEpisode) *TrackChild {
}
func NewArtistByFolder(f *db.Album) *Artist {
// the db is structued around "browse by tags", and where
// the db is structured around "browse by tags", and where
// an album is also a folder. so we're constructing an artist
// from an "album" where
// maybe TODO: rename the Album model to Folder
@@ -42,6 +42,8 @@ func NewPodcastEpisode(pe *db.PodcastEpisode) *PodcastEpisode {
BitRate: pe.Bitrate,
IsDir: false,
Size: pe.Size,
Album: pe.Album,
Artist: pe.Artist,
}
if pe.Podcast != nil {
r.Path = pe.AbsPath()
+20 -18
View File
@@ -394,24 +394,26 @@ type PodcastChannel struct {
}
type PodcastEpisode struct {
ID *specid.ID `xml:"id,attr" json:"id"`
StreamID *specid.ID `xml:"streamId,attr" json:"streamId"`
ChannelID *specid.ID `xml:"channelId,attr" json:"channelId"`
Title string `xml:"title,attr" json:"title"`
Description string `xml:"description,attr" json:"description"`
PublishDate time.Time `xml:"publishDate,attr" json:"publishDate"`
Status string `xml:"status,attr" json:"status"`
Parent string `xml:"parent,attr" json:"parent"`
IsDir bool `xml:"isDir,attr" json:"isDir"`
Year int `xml:"year,attr" json:"year"`
Genre string `xml:"genre,attr" json:"genre"`
CoverArt *specid.ID `xml:"coverArt,attr" json:"coverArt"`
Size int `xml:"size,attr" json:"size"`
ContentType string `xml:"contentType,attr" json:"contentType"`
Suffix string `xml:"suffix,attr" json:"suffix"`
Duration int `xml:"duration,attr" json:"duration"`
BitRate int `xml:"bitRate,attr" json:"bitrate"`
Path string `xml:"path,attr" json:"path"`
ID *specid.ID `xml:"id,attr" json:"id"`
StreamID *specid.ID `xml:"streamId,attr" json:"streamId"`
ChannelID *specid.ID `xml:"channelId,attr" json:"channelId"`
Title string `xml:"title,attr" json:"title"`
Description string `xml:"description,attr" json:"description"`
PublishDate time.Time `xml:"publishDate,attr" json:"publishDate"`
Status string `xml:"status,attr" json:"status"`
Parent string `xml:"parent,attr" json:"parent"`
IsDir bool `xml:"isDir,attr" json:"isDir"`
Year int `xml:"year,attr" json:"year"`
Genre string `xml:"genre,attr" json:"genre"`
CoverArt *specid.ID `xml:"coverArt,attr" json:"coverArt"`
Size int `xml:"size,attr" json:"size"`
ContentType string `xml:"contentType,attr" json:"contentType"`
Suffix string `xml:"suffix,attr" json:"suffix"`
Duration int `xml:"duration,attr" json:"duration"`
BitRate int `xml:"bitRate,attr" json:"bitrate"`
Path string `xml:"path,attr" json:"path"`
Album string `xml:"album,attr" json:"album"`
Artist string `xml:"artist,attr" json:"artist"`
}
type Bookmarks struct {