Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't seek to the start when swiping right #112

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/daemon/controls.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@ func (p *AppPlayer) seek(position int64) error {
return nil
}

func (p *AppPlayer) skipPrev() error {
if p.player.PositionMs() > 3000 {
func (p *AppPlayer) skipPrev(allowSeeking bool) error {
if allowSeeking && p.player.PositionMs() > 3000 {
return p.seek(0)
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/daemon/player.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ func (p *AppPlayer) handlePlayerCommand(req dealer.RequestPayload) error {

return nil
case "skip_prev":
return p.skipPrev()
return p.skipPrev(req.Command.Options.AllowSeeking)
case "skip_next":
if req.Command.Track != nil {
contextSpotType := librespot.InferSpotifyIdTypeFromContextUri(p.state.player.ContextUri)
Expand Down Expand Up @@ -441,7 +441,7 @@ func (p *AppPlayer) handleApiRequest(req ApiRequest) (any, error) {
_ = p.seek(position)
return nil, nil
case ApiRequestTypePrev:
_ = p.skipPrev()
_ = p.skipPrev(true)
return nil, nil
case ApiRequestTypeNext:
_ = p.skipNext()
Expand Down
1 change: 1 addition & 0 deletions dealer/recv.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ type RequestPayload struct {
RestorePosition string `json:"restore_position"`
RestoreTrack string `json:"restore_track"`
AlwaysPlaySomething bool `json:"always_play_something"`
AllowSeeking bool `json:"allow_seeking"`
SkipTo struct {
TrackUid string `json:"track_uid"`
TrackUri string `json:"track_uri"`
Expand Down
Loading