Load playlist track genres

This commit is contained in:
Deluan 2021-10-26 18:46:08 -04:00
parent 526b6597c8
commit 5e87280750
2 changed files with 25 additions and 5 deletions

View file

@ -33,11 +33,10 @@ func (pls Playlist) IsSmartPlaylist() bool {
}
func (pls Playlist) MediaFiles() MediaFiles {
mfs := make(MediaFiles, len(pls.Tracks))
for i, t := range pls.Tracks {
mfs[i] = t.MediaFile
if len(pls.Tracks) == 0 {
return nil
}
return mfs
return pls.Tracks.MediaFiles()
}
func (pls *Playlist) RemoveTracks(idxToRemove []int) {
@ -104,6 +103,14 @@ type PlaylistTrack struct {
type PlaylistTracks []PlaylistTrack
func (plt PlaylistTracks) MediaFiles() MediaFiles {
mfs := make(MediaFiles, len(plt))
for i, t := range plt {
mfs[i] = t.MediaFile
}
return mfs
}
type PlaylistTrackRepository interface {
ResourceRepository
GetAll(options ...QueryOptions) (PlaylistTracks, error)