Merge pull request #753 from zacaj/feature/dateAdded-genre-albumArtist-cols

add columns for Date Added, Genre, Album Artist, File Type
This commit is contained in:
Drew Weymouth
2025-11-13 08:22:03 -08:00
committed by GitHub
9 changed files with 216 additions and 95 deletions
@@ -435,6 +435,7 @@ func toTrack(ch *jellyfin.Song) *mediaprovider.Track {
}
lastPlayed, _ := time.Parse(time.RFC3339Nano, ch.UserData.LastPlayedDate)
dateAdded, _ := time.Parse(time.RFC3339Nano, ch.DateCreated)
t := &mediaprovider.Track{
ID: ch.Id,
@@ -454,6 +455,7 @@ func toTrack(ch *jellyfin.Song) *mediaprovider.Track {
Favorite: ch.UserData.IsFavorite,
PlayCount: ch.UserData.PlayCount,
LastPlayed: lastPlayed,
DateAdded: dateAdded,
}
if len(ch.MediaSources) > 0 {
t.FilePath = ch.MediaSources[0].Path
+33 -29
View File
@@ -123,35 +123,39 @@ type Genre struct {
}
type Track struct {
ID string
CoverArtID string
ParentID string
Title string
Duration time.Duration
TrackNumber int
DiscNumber int
Genres []string
ArtistIDs []string
ArtistNames []string
ComposerIDs []string
ComposerNames []string
Album string
AlbumID string
Year int
Rating int
Favorite bool
Size int64
PlayCount int
LastPlayed time.Time
FilePath string
BitRate int
ContentType string
Comment string
BPM int
ReplayGain ReplayGainInfo
SampleRate int
BitDepth int
Channels int
ID string
CoverArtID string
ParentID string
Title string
Duration time.Duration
TrackNumber int
DiscNumber int
Genres []string
ArtistIDs []string
ArtistNames []string
AlbumArtistIDs []string
AlbumArtistNames []string
ComposerIDs []string
ComposerNames []string
Album string
AlbumID string
Year int
Rating int
Favorite bool
Size int64
PlayCount int
LastPlayed time.Time
FilePath string
BitRate int
ContentType string
Comment string
BPM int
ReplayGain ReplayGainInfo
SampleRate int
BitDepth int
Extension string
Channels int
DateAdded time.Time
}
type ReplayGainInfo struct {
@@ -544,6 +544,15 @@ func toTrack(ch *subsonic.Child) *mediaprovider.Track {
artistIDs = append(artistIDs, ch.ArtistID)
}
var albumArtistNames, albumArtistIDs []string
if len(ch.AlbumArtists) > 0 {
// OpenSubsonic extension
for _, a := range ch.AlbumArtists {
albumArtistIDs = append(albumArtistIDs, a.ID)
albumArtistNames = append(albumArtistNames, a.Name)
}
}
var rGain mediaprovider.ReplayGainInfo
if rg := ch.ReplayGain; rg != nil {
rGain.AlbumGain = rg.AlbumGain
@@ -570,35 +579,39 @@ func toTrack(ch *subsonic.Child) *mediaprovider.Track {
}
return &mediaprovider.Track{
ID: ch.ID,
CoverArtID: ch.CoverArt,
ParentID: ch.Parent,
Title: ch.Title,
Duration: time.Duration(ch.Duration) * time.Second,
TrackNumber: ch.Track,
DiscNumber: ch.DiscNumber,
Genres: genres,
ArtistIDs: artistIDs,
ArtistNames: artistNames,
ComposerIDs: composerIDs,
ComposerNames: composers,
Album: ch.Album,
AlbumID: ch.AlbumID,
Year: ch.Year,
Rating: ch.UserRating,
Favorite: !ch.Starred.IsZero(),
PlayCount: int(ch.PlayCount),
LastPlayed: ch.Played,
FilePath: ch.Path,
Size: ch.Size,
BitRate: ch.BitRate,
ContentType: ch.ContentType,
Comment: ch.Comment,
BPM: ch.BPM,
ReplayGain: rGain,
SampleRate: ch.SamplingRate,
BitDepth: ch.BitDepth,
Channels: ch.ChannelCount,
ID: ch.ID,
CoverArtID: ch.CoverArt,
ParentID: ch.Parent,
Title: ch.Title,
Duration: time.Duration(ch.Duration) * time.Second,
TrackNumber: ch.Track,
DiscNumber: ch.DiscNumber,
Genres: genres,
ArtistIDs: artistIDs,
ArtistNames: artistNames,
AlbumArtistIDs: albumArtistIDs,
AlbumArtistNames: albumArtistNames,
ComposerIDs: composerIDs,
ComposerNames: composers,
Album: ch.Album,
AlbumID: ch.AlbumID,
Year: ch.Year,
Rating: ch.UserRating,
Favorite: !ch.Starred.IsZero(),
PlayCount: int(ch.PlayCount),
LastPlayed: ch.Played,
DateAdded: ch.Created,
FilePath: ch.Path,
Size: ch.Size,
BitRate: ch.BitRate,
ContentType: ch.ContentType,
Extension: ch.Suffix,
Comment: ch.Comment,
BPM: ch.BPM,
ReplayGain: rGain,
SampleRate: ch.SamplingRate,
BitDepth: ch.BitDepth,
Channels: ch.ChannelCount,
}
}