add "Play artist radio" feature
This commit is contained in:
committed by
Drew Weymouth
parent
6b22915677
commit
7ae7048293
@@ -192,6 +192,16 @@ func (p *PlaybackManager) PlayRandomSongs(genreName string) {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *PlaybackManager) PlaySimilarSongs(id string) {
|
||||
params := map[string]string{"size": "100"}
|
||||
if songs, err := p.sm.Server.GetSimilarSongs2(id, params); err != nil {
|
||||
log.Printf("error getting similar songs: %s", err.Error())
|
||||
} else {
|
||||
p.LoadTracks(songs, false, false)
|
||||
p.PlayFromBeginning()
|
||||
}
|
||||
}
|
||||
|
||||
func (p *PlaybackManager) GetPlayQueue() []*subsonic.Child {
|
||||
pq := make([]*subsonic.Child, len(p.playQueue))
|
||||
for i, tr := range p.playQueue {
|
||||
|
||||
@@ -142,6 +142,10 @@ func (a *ArtistPage) playAllTracks() {
|
||||
}
|
||||
}
|
||||
|
||||
func (a *ArtistPage) playArtistRadio() {
|
||||
go a.pm.PlaySimilarSongs(a.artistID)
|
||||
}
|
||||
|
||||
func (a *ArtistPage) onShowAlbumPage(albumID string) {
|
||||
a.contr.NavigateTo(controller.AlbumRoute(albumID))
|
||||
}
|
||||
@@ -233,6 +237,7 @@ type ArtistPageHeader struct {
|
||||
similarArtists *fyne.Container
|
||||
favoriteBtn *widgets.FavoriteButton
|
||||
playBtn *widget.Button
|
||||
playRadioBtn *widget.Button
|
||||
container *fyne.Container
|
||||
}
|
||||
|
||||
@@ -248,7 +253,8 @@ func NewArtistPageHeader(page *ArtistPage) *ArtistPageHeader {
|
||||
}
|
||||
a.artistImage = widgets.NewImagePlaceholder(res.ResPeopleInvertPng, 225)
|
||||
a.favoriteBtn = widgets.NewFavoriteButton(func() { go a.toggleFavorited() })
|
||||
a.playBtn = widget.NewButtonWithIcon("Play", theme.MediaPlayIcon(), page.playAllTracks)
|
||||
a.playBtn = widget.NewButtonWithIcon("Play Discography", theme.MediaPlayIcon(), page.playAllTracks)
|
||||
a.playRadioBtn = widget.NewButtonWithIcon("Play Artist Radio", res.ResShuffleInvertSvg, page.playArtistRadio)
|
||||
a.biographyDisp.Wrapping = fyne.TextWrapWord
|
||||
a.ExtendBaseWidget(a)
|
||||
a.createContainer()
|
||||
@@ -323,7 +329,7 @@ func (a *ArtistPageHeader) createContainer() {
|
||||
container.NewVBox(
|
||||
container.New(&layouts.VboxCustomPadding{ExtraPad: -10},
|
||||
a.titleDisp, a.biographyDisp, a.similarArtists),
|
||||
container.NewHBox(widgets.NewHSpace(2), a.favoriteBtn, a.playBtn)))
|
||||
container.NewHBox(widgets.NewHSpace(2), a.favoriteBtn, a.playBtn, a.playRadioBtn)))
|
||||
}
|
||||
|
||||
func (a *ArtistPageHeader) CreateRenderer() fyne.WidgetRenderer {
|
||||
|
||||
Reference in New Issue
Block a user