diff --git a/Cargo.toml b/Cargo.toml index 5a43545..f255fbd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,6 +18,8 @@ homepage = "https://github.com/talwat/lowfi" repository = "https://github.com/talwat/lowfi" [features] +default = ["default-tracklist"] +default-tracklist = [] mpris = ["dep:mpris-server", "dep:arc-swap"] extra-audio-formats = ["rodio/default"] scrape = [ diff --git a/docs/MUSIC.md b/docs/MUSIC.md index 1c6ec19..eb251d0 100644 --- a/docs/MUSIC.md +++ b/docs/MUSIC.md @@ -48,20 +48,29 @@ that chillhop entirely bans third party players in their TOS. They also ban scrapers, which I only learned after writing one. So, is lowfi really going to have to violate the TOS of it's own music provider? -Well, yes. I thought about it, and came to the conclusion that lowfi is probably -not much of a threat for a few reasons. +Well, yes. I thought about it, and came to the conclusion that this isn't *as bad* +as it sounds for a few reasons. Firstly, it emulates exactly the behavior of chillhop's own radio player. The only difference is that one shoves you into a web browser, and the other, -into a nice terminal window. +into a nice terminal window. The fact that these are so functionally identical +makes it a pretty unnoticeable difference. Then, I also realize that lowfi is just a small program used by few. I'm not making money on any of this, and I think degrading the experience for my fellow nerds who just want to listen to some lowfi without all the crap is not worth it. -At the end of the day, lowfi has a distinct UserAgent. Should chillhop ever take issue with -it's behavior, banning it is extremely simple. I don't want that to happen, but I -understand if it does. +At the end of the day, the lowfi player itself has a distinct UserAgent. +Should chillhop ever take issue with it's behavior, banning it is extremely simple. +I don't want that to happen, but I understand if it does. + +## For Distributions + +As of April, 2026, there is a new optional feature (`default-tracklist`) you can use to disable the +default list entirely. It won't be shipped in the binary, or compiled at all. This should in theory +resolve any issues of legality, but reality is complicated. If you maintain a distro, you have enough +work on your hands already and don't need to worry about a silly music player which has +some questionable sourcing practices. ## Well, *I* Hate the Chillhop Music diff --git a/src/tracks/error.rs b/src/tracks/error.rs index 8517498..9c0024c 100644 --- a/src/tracks/error.rs +++ b/src/tracks/error.rs @@ -11,6 +11,9 @@ pub enum Kind { #[error("invalid file path")] InvalidPath, + #[error("no track list specified! (default track list feature is disabled)")] + NoTrackList, + #[error("unknown target track length")] UnknownLength, diff --git a/src/tracks/list.rs b/src/tracks/list.rs index 6140cd7..399e73b 100644 --- a/src/tracks/list.rs +++ b/src/tracks/list.rs @@ -157,11 +157,15 @@ impl List { /// Reads a [List] from the filesystem using the CLI argument provided. pub async fn load(tracks: &str) -> tracks::Result { if tracks == "chillhop" { + #[cfg(feature = "default-tracklist")] return Ok(Self::new( "chillhop", include_str!("../../data/chillhop.txt"), None, )); + + #[cfg(not(feature = "default-tracklist"))] + return Err(tracks::error::Kind::NoTrackList.into()); } // Check if the track is in ~/.local/share/lowfi, in which case we'll load that. @@ -173,9 +177,7 @@ impl List { let raw = fs::read_to_string(path.clone()).await?; // Get rid of special noheader case for tracklists without a header. - let raw = raw - .strip_prefix("noheader") - .map_or_else(|| raw.as_ref(), |stripped| stripped); + let raw = raw.strip_prefix("noheader").unwrap_or_else(|| raw.as_ref()); let name = path .file_stem()