pub struct SmartShuffle { /* private fields */ }Expand description
Read-only metadata prepared once for repeated journey planning.
Implementations§
Source§impl SmartShuffle
impl SmartShuffle
Sourcepub fn from_catalog(catalog: &Catalog, tracks: &[Option<Id>]) -> Self
pub fn from_catalog(catalog: &Catalog, tracks: &[Option<Id>]) -> Self
Prepare a selection using catalog identities when they are available.
None and invalid track IDs retain their occurrences with unknown
metadata. Genres attached directly to a track take precedence over the
release’s union of genres, so a mixed compilation does not make all its
tracks stylistically identical. The graph has at most 512 nodes; profiles
retain at most eight genres, eight artists and four labels. Raw and
normalized genre labels over 256 UTF-8 bytes are omitted before planning.
Any limited metadata is counted in the resulting report.
Sourcepub fn transition_distance(&self, from: usize, to: usize) -> Option<u16>
pub fn transition_distance(&self, from: usize, to: usize) -> Option<u16>
Genre distance between two selection occurrences.
Returns None for an invalid index or missing genre metadata. Known but
disconnected genres have distance 1000. Artist, year and label scoring
cannot override this genre distance or turn missing tags into evidence.
Sourcepub fn plan(
&self,
seed: u64,
start_index: Option<usize>,
previous_index: Option<usize>,
) -> SmartOrder
pub fn plan( &self, seed: u64, start_index: Option<usize>, previous_index: Option<usize>, ) -> SmartOrder
Plan one complete journey with an optional pinned first occurrence.
start_index keeps a player’s current occurrence first when changing
mode. previous_index supplies the preceding cycle’s final occurrence,
so the next cycle prefers a smooth opening and reports its boundary too.
Out-of-range optional indices are ignored. Every occurrence still appears
once. No random source, wall clock, hash iteration or floating point is
involved; all choices use the same SplitMix64 generator as classic shuffle.
Sourcepub fn plan_remaining(
&self,
seed: u64,
remaining: &[usize],
previous_index: Option<usize>,
) -> Result<SmartOrder, String>
pub fn plan_remaining( &self, seed: u64, remaining: &[usize], previous_index: Option<usize>, ) -> Result<SmartOrder, String>
Plan only the still-unplayed occurrences after an interactive mode change.
Indices refer to the original selection. Duplicate indices or indices outside that selection are errors; duplicate track identities remain valid when they are distinct playlist occurrences. Planning the remainder itself, rather than filtering a full plan afterwards, prevents already played bridge tracks from influencing a transition they cannot provide.
Trait Implementations§
Source§impl Clone for SmartShuffle
impl Clone for SmartShuffle
Source§fn clone(&self) -> SmartShuffle
fn clone(&self) -> SmartShuffle
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more