pimpbunny fix

This commit is contained in:
Simon
2026-03-22 12:27:46 +00:00
parent a2d31d90a1
commit 50ea0e73b7
13 changed files with 646 additions and 140 deletions

View File

@@ -230,6 +230,10 @@ fn channel_group_order(group_id: &str) -> usize {
pub fn decorate_channel(channel: Channel) -> ChannelView {
let metadata = channel_metadata_for(&channel.id);
let ytdlp_command = match channel.id.as_str() {
"pimpbunny" => Some("yt-dlp --compat-options allow-unsafe-ext".to_string()),
_ => None,
};
ChannelView {
id: channel.id,
name: channel.name,
@@ -250,6 +254,7 @@ pub fn decorate_channel(channel: Channel) -> ChannelView {
.map(|tag| (*tag).to_string())
.collect()
}),
ytdlpCommand: ytdlp_command,
cacheDuration: channel.cacheDuration,
}
}
@@ -413,6 +418,7 @@ mod tests {
let channel = decorate_channel(base_channel("hsex"));
assert_eq!(channel.groupKey.as_deref(), Some("chinese"));
assert_eq!(channel.sortOrder, None);
assert_eq!(channel.ytdlpCommand, None);
assert_eq!(
channel.tags.as_deref(),
Some(
@@ -438,6 +444,15 @@ mod tests {
assert_eq!(groups[2].id, "jav");
}
#[test]
fn decorates_pimpbunny_with_ytdlp_command() {
let channel = decorate_channel(base_channel("pimpbunny"));
assert_eq!(
channel.ytdlpCommand.as_deref(),
Some("yt-dlp --compat-options allow-unsafe-ext")
);
}
#[test]
fn reflects_updated_group_moves() {
assert_eq!(
@@ -461,6 +476,7 @@ mod tests {
base_channel("missav"),
base_channel("hsex"),
base_channel("all"),
base_channel("pimpbunny"),
];
let json = serde_json::to_value(build_status_response(status)).expect("valid status json");
@@ -487,5 +503,14 @@ mod tests {
.find(|group| group["id"] == "chinese")
.expect("chinese group present");
assert_eq!(chinese_group["systemImage"], "globe");
let pimpbunny_channel = channels
.iter()
.find(|channel| channel["id"] == "pimpbunny")
.expect("pimpbunny channel present");
assert_eq!(
pimpbunny_channel["ytdlpCommand"],
"yt-dlp --compat-options allow-unsafe-ext"
);
}
}