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

smart playlist: unstable sorting #1099

Closed
paroj opened this issue Oct 9, 2023 · 8 comments
Closed

smart playlist: unstable sorting #1099

paroj opened this issue Oct 9, 2023 · 8 comments

Comments

@paroj
Copy link

paroj commented Oct 9, 2023

settings

list size: 100
Play history: often played
rest: blank

result

each time, I click update a different playlist is returned. Not merely a different order, but with different elements. Can be verified by setting list size = 3.

expectation

"often played" should be deterministic and thus result in the exact same playlist (+sorting) each time.

@paulijar
Copy link
Collaborator

paulijar commented Oct 9, 2023

This is intentional, as the point of the feature is to create somewhat random playlists. Note that the filter name is "often played" and not "most often played" :). What is considered "often", is open to interpretation.

The implemented logic is such that when you request 3 often played tacks, the server will create a pool of 12 most often played tracks and randomly select 3 of them. However, if 12 would be more than half of all the tracks, then the pool size will be half of the total number of tracks. That is, it's guaranteed that the returned songs are always among the more often played half.

So formally, if requested list size is S and total number of tracks matching the other filters is T, then the server will select at most S random tracks among the min(S*4, T/2) most often played tracks.

@paroj
Copy link
Author

paroj commented Oct 10, 2023

uh.. I did not expect this to happen given my experience with other "smart playlist" implementations.

Maybe add a "Randomize" toggle to the filters tab. This way the randomization is user-visible and one could opt-out if one is after deterministic results.

@paulijar
Copy link
Collaborator

Maybe so. So would you still expect to get the results in random order, even if "randomize" wouldn't be selected? And what about the artist and genre filters: if there were 100 matches to the selected genre filter and you selected list size of 50, would you except to get the same 50 songs each time?

@paroj
Copy link
Author

paroj commented Oct 21, 2023

if randomize is off, then I would expect deterministic results, yes.

In your example with the "artist" filter, I would just sort the songs alphabetically. One could override that by selecting a "Play history" setting explicitly.

paulijar added a commit that referenced this issue Jan 14, 2024
In the "strict" mode the history filters are interpreted in absolute sense:
E.g. requesting 100 "recently played" songs returns 100 most recently played
songs with no element of randomness. The non-strict mode works as previously
and returns instead 100 songs among the most recently played ones.

refs #1099
@paulijar
Copy link
Collaborator

The new Music app version 1.10.0 now has an optional "Strict" mode for the history filter of the smart list. In this mode, the filter selects only songs best matching the given rule, randomizing only the order.

@paroj
Copy link
Author

paroj commented Jan 30, 2024

why did you keep randomizing the order in "strict" mode? I really would like to have a list in order of date added or play count.

Anyway it works as expected if I set the list size to 1 :)

@paulijar
Copy link
Collaborator

paulijar commented Feb 1, 2024

@parjo
Well, it was a judgment call. For me, creating randomized lists is the thing of this whole feature and I liked to keep the behavior of all the filters consistent. This view even started its life known as "Random" in the PR #1061. Then the optional filters got added and the view was rebranded as "Smart list".

I'm also planning to introduce another feature "Advanced search" which is partially overlapping with the smart list feature. There, there would be even greater number of available search rules to combine and the default would be to return non-randomized results. Most of the heavy lifting is already done for such a feature because the back-end part has been implemented as part of the Ampache API. So it's now only lacking a web UI.

@paroj
Copy link
Author

paroj commented Feb 1, 2024

thanks for the heads-up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants