fix: ignore live tracks in YTM searches

This commit is contained in:
ThetaDev 2024-10-12 05:33:23 +02:00
parent 69d64e5aca
commit f3f2e1d3ca
No known key found for this signature in database
GPG key ID: E319D3C5148D65B6
4 changed files with 11839 additions and 0 deletions

View file

@ -169,6 +169,9 @@ pub(crate) struct ListMusicItem {
#[serde_as(as = "Option<Text>")]
pub index: Option<String>,
pub menu: Option<MusicItemMenu>,
#[serde(default)]
#[serde_as(deserialize_as = "VecSkipError<_>")]
pub badges: Vec<TrackBadge>,
}
#[derive(Default, Debug, Copy, Clone, Deserialize)]
@ -419,6 +422,12 @@ pub(crate) struct SimpleHeaderRenderer {
pub title: String,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) enum TrackBadge {
LiveBadgeRenderer {},
}
/*
#MAPPER
*/
@ -588,6 +597,15 @@ impl MusicListMapper {
view_count: Option<TextComponents>,
}
// Dont map music livestreams
if item
.badges
.iter()
.any(|b| matches!(b, TrackBadge::LiveBadgeRenderer {}))
{
return Ok(None);
}
let p = match item.flex_column_display_style {
// Search result
FlexColumnDisplayStyle::TwoLines => {