renamed stopAfterCurrent -> pauseAfterCurrent
This commit is contained in:
+2
-2
@@ -598,8 +598,8 @@ func (a *App) checkFlagsAndSendIPCMsg(cli *ipc.Client) error {
|
||||
return cli.SeekNext()
|
||||
case *FlagStop:
|
||||
return cli.Stop()
|
||||
case *FlagStopAfterCurrent:
|
||||
return cli.StopAfterCurrent()
|
||||
case *FlagPauseAfterCurrent:
|
||||
return cli.PauseAfterCurrent()
|
||||
case *FlagShow:
|
||||
return cli.Show()
|
||||
case VolumeCLIArg >= 0:
|
||||
|
||||
+12
-12
@@ -22,18 +22,18 @@ var (
|
||||
SearchPlaylistCLIArg string = ""
|
||||
SearchTrackCLIArg string = ""
|
||||
|
||||
FlagPlay = flag.Bool("play", false, "unpause or begin playback")
|
||||
FlagPause = flag.Bool("pause", false, "pause playback")
|
||||
FlagPlayPause = flag.Bool("play-pause", false, "toggle play/pause state")
|
||||
FlagPrevious = flag.Bool("previous", false, "seek to previous track or beginning of current")
|
||||
FlagNext = flag.Bool("next", false, "seek to next track")
|
||||
FlagStop = flag.Bool("stop", false, "stop playback")
|
||||
FlagStopAfterCurrent = flag.Bool("stop-after-current", false, "stop playback after current track")
|
||||
FlagStartMinimized = flag.Bool("start-minimized", false, "start app minimized")
|
||||
FlagShow = flag.Bool("show", false, "show minimized app")
|
||||
FlagShuffle = flag.Bool("shuffle", false, "shuffle the tracklist (to be used with either -play-album-by-id or -play-playlist-by-id)")
|
||||
FlagVersion = flag.Bool("version", false, "print app version and exit")
|
||||
FlagHelp = flag.Bool("help", false, "print command line options and exit")
|
||||
FlagPlay = flag.Bool("play", false, "unpause or begin playback")
|
||||
FlagPause = flag.Bool("pause", false, "pause playback")
|
||||
FlagPlayPause = flag.Bool("play-pause", false, "toggle play/pause state")
|
||||
FlagPrevious = flag.Bool("previous", false, "seek to previous track or beginning of current")
|
||||
FlagNext = flag.Bool("next", false, "seek to next track")
|
||||
FlagStop = flag.Bool("stop", false, "stop playback")
|
||||
FlagPauseAfterCurrent = flag.Bool("pause-after-current", false, "pause playback after current track")
|
||||
FlagStartMinimized = flag.Bool("start-minimized", false, "start app minimized")
|
||||
FlagShow = flag.Bool("show", false, "show minimized app")
|
||||
FlagShuffle = flag.Bool("shuffle", false, "shuffle the tracklist (to be used with either -play-album-by-id or -play-playlist-by-id)")
|
||||
FlagVersion = flag.Bool("version", false, "print app version and exit")
|
||||
FlagHelp = flag.Bool("help", false, "print command line options and exit")
|
||||
|
||||
FlagPlayAlbum *bool
|
||||
FlagPlayPlaylist *bool
|
||||
|
||||
+20
-20
@@ -7,26 +7,26 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
PingPath = "/ping"
|
||||
PlayPath = "/transport/play"
|
||||
PlayAlbumPath = "/transport/play-album" // ?id=<album ID>&t=<firstTrack>&s=<shuffle>
|
||||
PlayPlaylistPath = "/transport/play-playlist" // ?id=<playlist ID>&t=<firstTrack>&s=<shuffle>
|
||||
PlayTrackPath = "/transport/play-track" // ?id=<track ID>
|
||||
SearchAlbumPath = "/transport/search-album" // ?s=<searchQuery>
|
||||
SearchPlaylistPath = "/transport/search-playlist" // ?s=<searchQuery>
|
||||
SearchTrackPath = "/transport/search-track" // ?s=<searchQuery>
|
||||
PlayPausePath = "/transport/playpause"
|
||||
PausePath = "/transport/pause"
|
||||
StopPath = "/transport/stop"
|
||||
StopAfterCurrentPath = "/transport/stop-after-current"
|
||||
PreviousPath = "/transport/previous"
|
||||
NextPath = "/transport/next"
|
||||
TimePosPath = "/transport/timepos" // ?s=<seconds>
|
||||
SeekByPath = "/transport/seek-by" // ?s=<+/- seconds>
|
||||
VolumePath = "/volume" // ?v=<vol>
|
||||
VolumeAdjustPath = "/volume/adjust" // ?pct=<+/- percentage>
|
||||
ShowPath = "/window/show"
|
||||
QuitPath = "/window/quit"
|
||||
PingPath = "/ping"
|
||||
PlayPath = "/transport/play"
|
||||
PlayAlbumPath = "/transport/play-album" // ?id=<album ID>&t=<firstTrack>&s=<shuffle>
|
||||
PlayPlaylistPath = "/transport/play-playlist" // ?id=<playlist ID>&t=<firstTrack>&s=<shuffle>
|
||||
PlayTrackPath = "/transport/play-track" // ?id=<track ID>
|
||||
SearchAlbumPath = "/transport/search-album" // ?s=<searchQuery>
|
||||
SearchPlaylistPath = "/transport/search-playlist" // ?s=<searchQuery>
|
||||
SearchTrackPath = "/transport/search-track" // ?s=<searchQuery>
|
||||
PlayPausePath = "/transport/playpause"
|
||||
PausePath = "/transport/pause"
|
||||
StopPath = "/transport/stop"
|
||||
PauseAfterCurrentPath = "/transport/pause-after-current"
|
||||
PreviousPath = "/transport/previous"
|
||||
NextPath = "/transport/next"
|
||||
TimePosPath = "/transport/timepos" // ?s=<seconds>
|
||||
SeekByPath = "/transport/seek-by" // ?s=<+/- seconds>
|
||||
VolumePath = "/volume" // ?v=<vol>
|
||||
VolumeAdjustPath = "/volume/adjust" // ?pct=<+/- percentage>
|
||||
ShowPath = "/window/show"
|
||||
QuitPath = "/window/quit"
|
||||
)
|
||||
|
||||
type Response struct {
|
||||
|
||||
@@ -83,8 +83,8 @@ func (c *Client) Stop() error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *Client) StopAfterCurrent() error {
|
||||
_, err := c.sendRequest(StopAfterCurrentPath)
|
||||
func (c *Client) PauseAfterCurrent() error {
|
||||
_, err := c.sendRequest(PauseAfterCurrentPath)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ type PlaybackHandler interface {
|
||||
Continue()
|
||||
SeekBackOrPrevious()
|
||||
SeekNext()
|
||||
SetStopAfterCurrent(bool)
|
||||
SetPauseAfterCurrent(bool)
|
||||
SeekSeconds(float64)
|
||||
SeekBySeconds(float64)
|
||||
Volume() int
|
||||
@@ -83,8 +83,8 @@ func (s *serverImpl) createHandler() http.Handler {
|
||||
m.HandleFunc(PausePath, s.makeSimpleEndpointHandler(s.pbHandler.Pause))
|
||||
m.HandleFunc(PlayPausePath, s.makeSimpleEndpointHandler(s.pbHandler.PlayPause))
|
||||
m.HandleFunc(StopPath, s.makeSimpleEndpointHandler(s.pbHandler.Stop))
|
||||
m.HandleFunc(StopAfterCurrentPath, s.makeSimpleEndpointHandler(func() {
|
||||
s.pbHandler.SetStopAfterCurrent(true)
|
||||
m.HandleFunc(PauseAfterCurrentPath, s.makeSimpleEndpointHandler(func() {
|
||||
s.pbHandler.SetPauseAfterCurrent(true)
|
||||
}))
|
||||
m.HandleFunc(PreviousPath, s.makeSimpleEndpointHandler(s.pbHandler.SeekBackOrPrevious))
|
||||
m.HandleFunc(NextPath, s.makeSimpleEndpointHandler(s.pbHandler.SeekNext))
|
||||
|
||||
@@ -66,7 +66,7 @@ type playbackEngine struct {
|
||||
isRadio bool
|
||||
loopMode LoopMode
|
||||
|
||||
stopAfterCurrent bool // flag to stop playback after current track ends
|
||||
pauseAfterCurrent bool // flag to pause playback after current track ends
|
||||
|
||||
// flags for handleOnTrackChange / handleOnStopped callbacks - reset to false in the callbacks
|
||||
wasStopped bool // true iff player was stopped before handleOnTrackChange invocation
|
||||
@@ -337,8 +337,8 @@ func (p *playbackEngine) Stop() error {
|
||||
return p.player.Stop(false)
|
||||
}
|
||||
|
||||
func (p *playbackEngine) SetStopAfterCurrent(stopAfterCurrent bool) {
|
||||
p.stopAfterCurrent = stopAfterCurrent
|
||||
func (p *playbackEngine) SetPauseAfterCurrent(pauseAfterCurrent bool) {
|
||||
p.pauseAfterCurrent = pauseAfterCurrent
|
||||
}
|
||||
|
||||
func (p *playbackEngine) Pause() error {
|
||||
@@ -641,7 +641,7 @@ func (p *playbackEngine) handleOnStopped() {
|
||||
p.alreadyScrobbled = false
|
||||
p.wasStopped = true
|
||||
p.nowPlayingIdx = -1
|
||||
p.stopAfterCurrent = false
|
||||
p.pauseAfterCurrent = false
|
||||
}
|
||||
|
||||
// to be invoked as soon as the next item in the queue that should play changes
|
||||
|
||||
@@ -135,9 +135,9 @@ func (p *PlaybackManager) addOnTrackChangeHook() {
|
||||
p.cmdQueue.addCommand(playbackCommand{Type: cmdForceRestartPlayback})
|
||||
}
|
||||
|
||||
if p.engine.stopAfterCurrent {
|
||||
if p.engine.pauseAfterCurrent {
|
||||
p.Pause()
|
||||
p.engine.SetStopAfterCurrent(false)
|
||||
p.engine.SetPauseAfterCurrent(false)
|
||||
}
|
||||
}()
|
||||
}
|
||||
@@ -692,12 +692,12 @@ func (p *PlaybackManager) PlayPause() {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *PlaybackManager) SetStopAfterCurrent(stopAfterCurrent bool) {
|
||||
p.engine.SetStopAfterCurrent(stopAfterCurrent)
|
||||
func (p *PlaybackManager) SetPauseAfterCurrent(pauseAfterCurrent bool) {
|
||||
p.engine.SetPauseAfterCurrent(pauseAfterCurrent)
|
||||
}
|
||||
|
||||
func (p *PlaybackManager) IsStopAfterCurrent() bool {
|
||||
return p.engine.stopAfterCurrent
|
||||
func (p *PlaybackManager) IsPauseAfterCurrent() bool {
|
||||
return p.engine.pauseAfterCurrent
|
||||
}
|
||||
|
||||
func (p *PlaybackManager) enqueueAutoplayTracks() {
|
||||
|
||||
Reference in New Issue
Block a user