Mopidy: previous track doesn't work with repeat mode

Created on 15 Aug 2018  路  9Comments  路  Source: mopidy/mopidy

https://github.com/mopidy/mopidy/blob/2ee130057113d7c0b46e16a0d7c19180614d5bd9/mopidy/core/tracklist.py#L370

Is this intentional to not return previous track when repeat mode is enabled ?

C-bug A-core good first issue

Most helpful comment

IMO, having previous go back to the previously played track when random is set would be the most useful behavior. When is it useful to go to a random track if you press previous?

I also think it would be best if pressing next after pressing previous goes back to the same track it was on before pressing previous. This is the way Spotify works btw, i.e. when you press shuffle, it creates a shuffled playlist, and pressing previous/next just jumps in this playlist.

All 9 comments

Looking at the (possibly outdated) MPD behaviour table, which I believe is what we try to follow, this does seem wrong. There's also very limited tests for this.

There is https://github.com/mopidy/mopidy/pull/1616/files but it needs the tests (and maybe a bit of re-jigging).

If someone did want to look at this properly, updating the table would be a good first step that just requires a bit of time. Then we can implement that table in the tests (https://github.com/mopidy/mopidy/pull/1695).

I made a new MPD behavior table for the previous action, based on MPD version 0.21.19:

repeat | random | single | consume | c=1 | c=2 | c=3
------ | ------- | ------ | --------- | ------ | --- | ----
T | T | T | T | Rand? | Rand? | Rand?
T | T | T | . | Rand? | Rand? | Rand?
T | T | . | T | Rand? | Rand? | Rand?
T | T | . | . | Rand? | Rand? | Rand?
T | . | T | T | 3 | 1 | 2
T | . | T | . | 3 | 1 | 2
T | . | . | T | 3 | 1 | 2
T | . | . | . | 3 | 1 | 2
. | T | T | T | 1 | 2 | 3
. | T | T | . | 1 | 2 | 3
. | T | . | T | 1 | 2 | 3
. | T | . | . | 1 | 2 | 3
. | . | T | T | 1 | 1 | 2
. | . | T | . | 1 | 1 | 2
. | . | . | T | 1 | 1 | 2
. | . | . | . | 1 | 1 | 2

Note that the only difference from the previous MPD behavior table
is that when repeat and random are set, previous changes to a random track.

Awesome! Would you up for a PR that updates the comment we have at https://github.com/mopidy/mopidy-mpd/blob/master/mopidy_mpd/protocol/playback.py#L242-L265 ?

On it! :)

Will also look at changing the behavior in Mopidy core first,
since this doesn't mimic MPD at the moment.

Assuming the intention still is to mimic MPD's behavior?
Since the MPD was moved out of core, the previous/next behavior tables was also moved out of the docs.

I suggest we actually add the previous/next behavior tables to https://github.com/mopidy/mopidy/blob/develop/mopidy/core/tracklist.py#L300-L349
and make this the behavior of mopidy on previous/next.
(The docstrings in Mopidy-MPD are conflicting with those in Mopidy core ATM)

Is this cool? Or is the intention to let Mopidys behavior deviate from MPD's?

Assuming the intention still is to mimic MPD's behavior?

We haven't had that discussion since moving the mpd extension out.

But you are right, it does make more sense to move that documentation to the tracklist. And mpd's behaviour of "when repeat and random are set, previous changes to a random track" sounds more logical so we probably want that. But w.r.t changing the other deviations to follow mpd, maybe we'd be better off considering each of them. Since you are looking at it, do you have a list of what the other deviations are?

Mopidy's current behavior deviates quite a lot from mpd.

  • In mopidy, when repeat is set, previous stays on the same track. Where in mpd they step back one (unless random is set).
  • In mopidy, if consume is set, previous stays on same track. Where in mpd consume has no effect on the previous function.
  • In mopidy, if random is set, previous stays on same track. Where in mpd it does so only when repeat is not set.
  • In mopidy, the previous action never wraps around to the end of a playlist, where mpd does so when repeat is set.

And this is from looking only at the previous action. It suspect the same might be true for next.

IMO, having previous go back to the previously played track when random is set would be the most useful behavior. When is it useful to go to a random track if you press previous?

I also think it would be best if pressing next after pressing previous goes back to the same track it was on before pressing previous. This is the way Spotify works btw, i.e. when you press shuffle, it creates a shuffled playlist, and pressing previous/next just jumps in this playlist.

I also think it would be best if pressing next after pressing previous goes back to the same track it was on before pressing previous. This is the way Spotify works btw, i.e. when you press shuffle, it creates a shuffled playlist, and pressing previous/next just jumps in this playlist.

This is exactly how Mopidy behaves if you simply shuffle the tracklist. But that's not the same as enabling random playback mode.

I think MPD got the distinction right, but most webclients expose random mode rather than shuffle, or at least don't make the distinction obvious.

The Spotify player doesn't support the MPD style random playback mode. Which you could argue is simpler to understand in most cases (not all!), but on the other hand is slightly less flexible. Their tracklist current context philosophy is very different and it comes with its own set of problems that make for some really confusing tracklist changes IMO.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

djselbeck picture djselbeck  路  8Comments

godzillamesel picture godzillamesel  路  6Comments

handsomegui picture handsomegui  路  12Comments

flyingrub picture flyingrub  路  15Comments

altano picture altano  路  6Comments