use error toasts for errors playing random/similar tracks
This commit is contained in:
@@ -171,7 +171,13 @@ func (g *ArtistPage) Scroll(scrollAmt float32) {
|
||||
}
|
||||
|
||||
func (a *ArtistPage) playArtistRadio() {
|
||||
go a.pm.PlaySimilarSongs(a.artistID)
|
||||
go func() {
|
||||
err := a.pm.PlaySimilarSongs(a.artistID)
|
||||
if err != nil {
|
||||
log.Println("error playing similar songs: %v", err)
|
||||
a.contr.ToastProvider.ShowErrorToast(lang.L("Unable to play artist radio"))
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
func (a *ArtistPage) showAlbumSortMenu() {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package browsing
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/dweymouth/supersonic/backend"
|
||||
"github.com/dweymouth/supersonic/backend/mediaprovider"
|
||||
"github.com/dweymouth/supersonic/ui/controller"
|
||||
@@ -58,7 +60,15 @@ func (g *genrePageAdapter) Route() controller.Route {
|
||||
}
|
||||
|
||||
func (g *genrePageAdapter) ActionButton() *widget.Button {
|
||||
fn := func() { go g.pm.PlayRandomSongs(g.genre) }
|
||||
fn := func() {
|
||||
go func() {
|
||||
err := g.pm.PlayRandomSongs(g.genre)
|
||||
if err != nil {
|
||||
log.Println("error playing random tracks: %v", err)
|
||||
g.contr.ToastProvider.ShowErrorToast(lang.L("Unable to play random tracks"))
|
||||
}
|
||||
}()
|
||||
}
|
||||
return widget.NewButtonWithIcon(lang.L("Play random"), myTheme.ShuffleIcon, fn)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package browsing
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/dweymouth/supersonic/backend"
|
||||
"github.com/dweymouth/supersonic/backend/mediaprovider"
|
||||
"github.com/dweymouth/supersonic/sharedutil"
|
||||
@@ -205,7 +207,13 @@ func (s *tracksPageState) Restore() Page {
|
||||
}
|
||||
|
||||
func (t *TracksPage) playRandomSongs() {
|
||||
t.contr.App.PlaybackManager.PlayRandomSongs("")
|
||||
go func() {
|
||||
err := t.contr.App.PlaybackManager.PlayRandomSongs("")
|
||||
if err != nil {
|
||||
log.Println("error playing random tracks: %v", err)
|
||||
t.contr.ToastProvider.ShowErrorToast(lang.L("Unable to play random tracks"))
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
func (t *TracksPage) obtainTracklist() *widgets.Tracklist {
|
||||
|
||||
Reference in New Issue
Block a user