mirror of
https://github.com/talwat/lowfi
synced 2026-04-20 08:53:27 +00:00
feat: add feature to toggle default tracklist
This commit is contained in:
parent
980cbbce3f
commit
12d981c5c6
@ -18,6 +18,8 @@ homepage = "https://github.com/talwat/lowfi"
|
|||||||
repository = "https://github.com/talwat/lowfi"
|
repository = "https://github.com/talwat/lowfi"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
default = ["default-tracklist"]
|
||||||
|
default-tracklist = []
|
||||||
mpris = ["dep:mpris-server", "dep:arc-swap"]
|
mpris = ["dep:mpris-server", "dep:arc-swap"]
|
||||||
extra-audio-formats = ["rodio/default"]
|
extra-audio-formats = ["rodio/default"]
|
||||||
scrape = [
|
scrape = [
|
||||||
|
|||||||
@ -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.
|
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?
|
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
|
Well, yes. I thought about it, and came to the conclusion that this isn't *as bad*
|
||||||
not much of a threat for a few reasons.
|
as it sounds for a few reasons.
|
||||||
|
|
||||||
Firstly, it emulates exactly the behavior of chillhop's own radio player.
|
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,
|
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.
|
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
|
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.
|
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
|
At the end of the day, the lowfi player itself has a distinct UserAgent.
|
||||||
it's behavior, banning it is extremely simple. I don't want that to happen, but I
|
Should chillhop ever take issue with it's behavior, banning it is extremely simple.
|
||||||
understand if it does.
|
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
|
## Well, *I* Hate the Chillhop Music
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,9 @@ pub enum Kind {
|
|||||||
#[error("invalid file path")]
|
#[error("invalid file path")]
|
||||||
InvalidPath,
|
InvalidPath,
|
||||||
|
|
||||||
|
#[error("no track list specified! (default track list feature is disabled)")]
|
||||||
|
NoTrackList,
|
||||||
|
|
||||||
#[error("unknown target track length")]
|
#[error("unknown target track length")]
|
||||||
UnknownLength,
|
UnknownLength,
|
||||||
|
|
||||||
|
|||||||
@ -157,11 +157,15 @@ impl List {
|
|||||||
/// Reads a [List] from the filesystem using the CLI argument provided.
|
/// Reads a [List] from the filesystem using the CLI argument provided.
|
||||||
pub async fn load(tracks: &str) -> tracks::Result<Self> {
|
pub async fn load(tracks: &str) -> tracks::Result<Self> {
|
||||||
if tracks == "chillhop" {
|
if tracks == "chillhop" {
|
||||||
|
#[cfg(feature = "default-tracklist")]
|
||||||
return Ok(Self::new(
|
return Ok(Self::new(
|
||||||
"chillhop",
|
"chillhop",
|
||||||
include_str!("../../data/chillhop.txt"),
|
include_str!("../../data/chillhop.txt"),
|
||||||
None,
|
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.
|
// 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?;
|
let raw = fs::read_to_string(path.clone()).await?;
|
||||||
|
|
||||||
// Get rid of special noheader case for tracklists without a header.
|
// Get rid of special noheader case for tracklists without a header.
|
||||||
let raw = raw
|
let raw = raw.strip_prefix("noheader").unwrap_or_else(|| raw.as_ref());
|
||||||
.strip_prefix("noheader")
|
|
||||||
.map_or_else(|| raw.as_ref(), |stripped| stripped);
|
|
||||||
|
|
||||||
let name = path
|
let name = path
|
||||||
.file_stem()
|
.file_stem()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user