[PR #10011] Prefer unplayed items when sorting randomly #12302

Closed
opened 2026-02-07 06:53:27 +03:00 by OVERLORD · 0 comments
Owner

Original Pull Request: https://github.com/jellyfin/jellyfin/pull/10011

State: closed
Merged: No


Changes
This PR adjusts the "Random" sorting strategy to prefer unplayed items over played items, as a simple way of addressing feature request 717.

The idea here is that when a user hits the "Shuffle" button in any given context (e.g. a show, a library, a collection), they are probably not interested in seeing items that they have recently already played via shuffle. Tying the priority to the "Played" flag gives the user some control over this behavior, e.g. if they want to "reset" their shuffle exclusion, they can mark a folder as unplayed.

Looking for feedback and suggestions
I'm definitely open to suggestions about this approach and implementation! In particular, I notice that besides the ORDER BY RANDOM() strategy implemented in SqliteItemRepository, there are two other possible ways for items to be shuffled: RandomComparer and ShuffleExtensions. I'm unsure about whether these need to be adjusted as well, and I was unable to figure how they could get invoked from front-end actions.

Issues
https://features.jellyfin.org/posts/717/shuffle-weight-recently-played-media-should-be-less-likely-to-be-next

**Original Pull Request:** https://github.com/jellyfin/jellyfin/pull/10011 **State:** closed **Merged:** No --- **Changes** This PR adjusts the "Random" sorting strategy to prefer unplayed items over played items, as a simple way of addressing [feature request 717](https://features.jellyfin.org/posts/717/shuffle-weight-recently-played-media-should-be-less-likely-to-be-next). The idea here is that when a user hits the "Shuffle" button in any given context (e.g. a show, a library, a collection), they are probably not interested in seeing items that they have recently already played via shuffle. Tying the priority to the "Played" flag gives the user some control over this behavior, e.g. if they want to "reset" their shuffle exclusion, they can mark a folder as unplayed. **Looking for feedback and suggestions** I'm definitely open to suggestions about this approach and implementation! In particular, I notice that besides the `ORDER BY RANDOM()` strategy implemented in `SqliteItemRepository`, there are two other possible ways for items to be shuffled: `RandomComparer` and `ShuffleExtensions`. I'm unsure about whether these need to be adjusted as well, and I was unable to figure how they could get invoked from front-end actions. **Issues** https://features.jellyfin.org/posts/717/shuffle-weight-recently-played-media-should-be-less-likely-to-be-next
OVERLORD added the pull-request label 2026-02-07 06:53:27 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#12302