Skip to main content

selene_daemon/
shuffle_mode.rs

1use std::fmt::Display;
2
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Serialize, Deserialize, Clone, Copy)]
6#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
7pub enum ShuffleMode {
8    /// Tracks are not shuffled, they are played as is
9    None,
10
11    /// Only collections are shuffled, meaning the collections are shuffled, but not the contents
12    CollectionsOnly,
13
14    /// Randomize tracks only, meaning the contents of collections are shuffled, but not the collections themselves
15    TracksOnly,
16
17    /// Randomize collection order and the tracks inside the collection
18    CollectionsAndTracks,
19
20    /// Randomizes the order of everything
21    Full,
22}
23
24impl Display for ShuffleMode {
25    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
26        match self {
27            ShuffleMode::None => f.write_str("None"),
28            ShuffleMode::CollectionsOnly => f.write_str("Collections Only"),
29            ShuffleMode::TracksOnly => f.write_str("Tracks Only"),
30            ShuffleMode::CollectionsAndTracks => f.write_str("Collections And Tracks"),
31            ShuffleMode::Full => f.write_str("Full"),
32        }
33    }
34}