add more to track info dialog
This commit is contained in:
@@ -14,7 +14,11 @@ func GetSimilarSongsFallback(mp mediaprovider.MediaProvider, track *mediaprovide
|
||||
tracks, _ = mp.GetSimilarTracks(track.ArtistIDs[0], count)
|
||||
}
|
||||
if len(tracks) == 0 {
|
||||
tracks, _ = mp.GetRandomTracks(track.Genre, count)
|
||||
genre := ""
|
||||
if len(track.Genres) > 0 {
|
||||
genre = track.Genres[0]
|
||||
}
|
||||
tracks, _ = mp.GetRandomTracks(genre, count)
|
||||
}
|
||||
|
||||
// make sure to exclude the song itself from the similar list
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package mediaprovider
|
||||
|
||||
import "time"
|
||||
|
||||
// Bit field flag for the ReleaseTypes property
|
||||
type ReleaseType = int32
|
||||
|
||||
@@ -90,7 +92,7 @@ type Track struct {
|
||||
Duration int
|
||||
TrackNumber int
|
||||
DiscNumber int
|
||||
Genre string
|
||||
Genres []string
|
||||
ArtistIDs []string
|
||||
ArtistNames []string
|
||||
Album string
|
||||
@@ -100,6 +102,7 @@ type Track struct {
|
||||
Favorite bool
|
||||
Size int64
|
||||
PlayCount int
|
||||
LastPlayed time.Time
|
||||
FilePath string
|
||||
BitRate int
|
||||
ContentType string
|
||||
|
||||
@@ -500,6 +500,15 @@ func toTrack(ch *subsonic.Child) *mediaprovider.Track {
|
||||
rGain.AlbumPeak = rg.AlbumPeak
|
||||
rGain.TrackPeak = rg.TrackPeak
|
||||
}
|
||||
var genres []string
|
||||
if len(ch.Genres) > 0 {
|
||||
genres = sharedutil.MapSlice(ch.Genres, func(idName subsonic.IDName) string {
|
||||
return idName.Name
|
||||
})
|
||||
} else if ch.Genre != "" {
|
||||
genres = []string{ch.Genre}
|
||||
}
|
||||
|
||||
return &mediaprovider.Track{
|
||||
ID: ch.ID,
|
||||
CoverArtID: ch.CoverArt,
|
||||
@@ -508,7 +517,7 @@ func toTrack(ch *subsonic.Child) *mediaprovider.Track {
|
||||
Duration: ch.Duration,
|
||||
TrackNumber: ch.Track,
|
||||
DiscNumber: ch.DiscNumber,
|
||||
Genre: ch.Genre,
|
||||
Genres: genres,
|
||||
ArtistIDs: artistIDs,
|
||||
ArtistNames: artistNames,
|
||||
Album: ch.Album,
|
||||
@@ -517,12 +526,14 @@ func toTrack(ch *subsonic.Child) *mediaprovider.Track {
|
||||
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,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user