func addToQueue(track *sconsify.Track) bool { if queue.Add(track) == nil { return false } fmt.Fprintf(gui.queueView, "%v\n", track.GetTitle()) return true }
func (spotify *Spotify) play(trackUri *sconsify.Track) { link, err := spotify.session.ParseLink(trackUri.Uri) if err != nil { return } track, err := link.Track() if err != nil { return } if trackUri.IsPartial() { trackUri = sconsify.ToSconsifyTrack(track) } if !spotify.isTrackAvailable(track) { spotify.events.TrackNotAvailable(trackUri) return } player := spotify.session.Player() if err := player.Load(track); err != nil { return } player.Play() spotify.events.TrackPlaying(trackUri) spotify.currentTrack = trackUri }
func (spotify *Spotify) play(trackUri *sconsify.Track) { link, err := spotify.session.ParseLink(trackUri.URI) if err != nil { return } track, err := link.Track() if err != nil { return } if trackUri.IsPartial() { trackUri = sconsify.ToSconsifyTrack(track) } if !spotify.isTrackAvailable(track) { if trackUri.IsFromWebApi() { retry := trackUri.RetryLoading() if retry < 4 { go func() { time.Sleep(100 * time.Millisecond) spotify.events.Play(trackUri) }() return } } spotify.events.TrackNotAvailable(trackUri) return } player := spotify.session.Player() if err := player.Load(track); err != nil { return } player.Play() spotify.events.TrackPlaying(trackUri) spotify.currentTrack = trackUri spotify.paused = false return }
func (noui *NoUi) TrackPlaying(track *sconsify.Track) { noui.output.Print(fmt.Sprintf("Playing: %v\n", track.GetFullTitle())) }
func (cui *ConsoleUserInterface) TrackNotAvailable(track *sconsify.Track) { gui.flash("Not available: " + track.GetTitle()) }
func (cui *ConsoleUserInterface) TrackPlaying(track *sconsify.Track) { gui.PlayingTrack = track gui.setStatus("Playing: " + track.GetFullTitle()) }
func (cui *ConsoleUserInterface) TrackPaused(track *sconsify.Track) { gui.setStatus("Paused: " + track.GetFullTitle()) }