refactor!: make artist description optional
This commit is contained in:
parent
81e913fa85
commit
690388788a
16 changed files with 25 additions and 24 deletions
|
|
@ -310,8 +310,8 @@ impl RustyPipeBuilder {
|
|||
pub fn new() -> Self {
|
||||
RustyPipeBuilder {
|
||||
default_opts: RustyPipeOpts::default(),
|
||||
storage: Some(Box::new(FileStorage::default())),
|
||||
reporter: Some(Box::new(FileReporter::default())),
|
||||
storage: Some(Box::<FileStorage>::default()),
|
||||
reporter: Some(Box::<FileReporter>::default()),
|
||||
n_http_retries: 2,
|
||||
user_agent: DEFAULT_UA.to_owned(),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -235,12 +235,14 @@ fn map_artist_page(
|
|||
|
||||
static WIKIPEDIA_REGEX: Lazy<Regex> =
|
||||
Lazy::new(|| Regex::new(r"https://[a-z]+\.wikipedia.org/wiki/[^()\s]+").unwrap());
|
||||
let wikipedia_url = WIKIPEDIA_REGEX
|
||||
.captures(&header.description)
|
||||
.ok()
|
||||
.flatten()
|
||||
.and_then(|c| c.get(0))
|
||||
.map(|m| m.as_str().to_owned());
|
||||
let wikipedia_url = header.description.as_deref().and_then(|h| {
|
||||
WIKIPEDIA_REGEX
|
||||
.captures(h)
|
||||
.ok()
|
||||
.flatten()
|
||||
.and_then(|c| c.get(0))
|
||||
.map(|m| m.as_str().to_owned())
|
||||
});
|
||||
|
||||
Ok(MapResult {
|
||||
c: (
|
||||
|
|
|
|||
|
|
@ -34,9 +34,8 @@ pub(crate) struct MusicHeaderRenderer {
|
|||
#[serde(default)]
|
||||
#[serde_as(as = "DefaultOnError")]
|
||||
pub subscription_button: Option<SubscriptionButton>,
|
||||
#[serde(default)]
|
||||
#[serde_as(as = "Text")]
|
||||
pub description: String,
|
||||
#[serde_as(as = "Option<Text>")]
|
||||
pub description: Option<String>,
|
||||
#[serde(default)]
|
||||
pub thumbnail: MusicThumbnailRenderer,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ MusicArtist(
|
|||
height: 1200,
|
||||
),
|
||||
],
|
||||
description: "Edward Christopher Sheeran MBE is an English singer-songwriter. Born in Halifax, West Yorkshire and raised in Framlingham, Suffolk, he began writing songs around the age of eleven. In early 2011, Sheeran independently released the extended play, No. 5 Collaborations Project. He signed with Asylum Records the same year.\nSheeran\'s debut album, +, was released in September 2011 and topped the UK Albums Chart. It contained his first hit single \"The A Team\". In 2012, Sheeran won the Brit Awards for Best British Male Solo Artist and British Breakthrough Act. Sheeran\'s second studio album, ×, topped charts around the world upon its release in June 2014. It was named the second-best-selling album worldwide of 2015. In the same year, × won Album of the Year at the 2015 Brit Awards, and he received the Ivor Novello Award for Songwriter of the Year from the British Academy of Songwriters, Composers and Authors. A single from ×, \"Thinking Out Loud\", earned him the 2016 Grammy Awards for Song of the Year and Best Pop Solo Performance.\nSheeran\'s third album, ÷, was released in March 2017, and was the best-selling album worldwide of 2017.\n\nFrom Wikipedia (https://en.wikipedia.org/wiki/Ed_Sheeran) under Creative Commons Attribution CC-BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/legalcode)",
|
||||
description: Some("Edward Christopher Sheeran MBE is an English singer-songwriter. Born in Halifax, West Yorkshire and raised in Framlingham, Suffolk, he began writing songs around the age of eleven. In early 2011, Sheeran independently released the extended play, No. 5 Collaborations Project. He signed with Asylum Records the same year.\nSheeran\'s debut album, +, was released in September 2011 and topped the UK Albums Chart. It contained his first hit single \"The A Team\". In 2012, Sheeran won the Brit Awards for Best British Male Solo Artist and British Breakthrough Act. Sheeran\'s second studio album, ×, topped charts around the world upon its release in June 2014. It was named the second-best-selling album worldwide of 2015. In the same year, × won Album of the Year at the 2015 Brit Awards, and he received the Ivor Novello Award for Songwriter of the Year from the British Academy of Songwriters, Composers and Authors. A single from ×, \"Thinking Out Loud\", earned him the 2016 Grammy Awards for Song of the Year and Best Pop Solo Performance.\nSheeran\'s third album, ÷, was released in March 2017, and was the best-selling album worldwide of 2017.\n\nFrom Wikipedia (https://en.wikipedia.org/wiki/Ed_Sheeran) under Creative Commons Attribution CC-BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/legalcode)"),
|
||||
wikipedia_url: Some("https://en.wikipedia.org/wiki/Ed_Sheeran"),
|
||||
subscriber_count: Some(52600000),
|
||||
tracks: [
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ MusicArtist(
|
|||
height: 1015,
|
||||
),
|
||||
],
|
||||
description: "",
|
||||
description: None,
|
||||
wikipedia_url: None,
|
||||
subscriber_count: None,
|
||||
tracks: [],
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ MusicArtist(
|
|||
height: 1200,
|
||||
),
|
||||
],
|
||||
description: "Edward Christopher Sheeran MBE is an English singer-songwriter. Born in Halifax, West Yorkshire and raised in Framlingham, Suffolk, he began writing songs around the age of eleven. In early 2011, Sheeran independently released the extended play, No. 5 Collaborations Project. He signed with Asylum Records the same year.\nSheeran\'s debut album, +, was released in September 2011 and topped the UK Albums Chart. It contained his first hit single \"The A Team\". In 2012, Sheeran won the Brit Awards for Best British Male Solo Artist and British Breakthrough Act. Sheeran\'s second studio album, ×, topped charts around the world upon its release in June 2014. It was named the second-best-selling album worldwide of 2015. In the same year, × won Album of the Year at the 2015 Brit Awards, and he received the Ivor Novello Award for Songwriter of the Year from the British Academy of Songwriters, Composers and Authors. A single from ×, \"Thinking Out Loud\", earned him the 2016 Grammy Awards for Song of the Year and Best Pop Solo Performance.\nSheeran\'s third album, ÷, was released in March 2017, and was the best-selling album worldwide of 2017.\n\nFrom Wikipedia (https://en.wikipedia.org/wiki/Ed_Sheeran) under Creative Commons Attribution CC-BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/legalcode)",
|
||||
description: Some("Edward Christopher Sheeran MBE is an English singer-songwriter. Born in Halifax, West Yorkshire and raised in Framlingham, Suffolk, he began writing songs around the age of eleven. In early 2011, Sheeran independently released the extended play, No. 5 Collaborations Project. He signed with Asylum Records the same year.\nSheeran\'s debut album, +, was released in September 2011 and topped the UK Albums Chart. It contained his first hit single \"The A Team\". In 2012, Sheeran won the Brit Awards for Best British Male Solo Artist and British Breakthrough Act. Sheeran\'s second studio album, ×, topped charts around the world upon its release in June 2014. It was named the second-best-selling album worldwide of 2015. In the same year, × won Album of the Year at the 2015 Brit Awards, and he received the Ivor Novello Award for Songwriter of the Year from the British Academy of Songwriters, Composers and Authors. A single from ×, \"Thinking Out Loud\", earned him the 2016 Grammy Awards for Song of the Year and Best Pop Solo Performance.\nSheeran\'s third album, ÷, was released in March 2017, and was the best-selling album worldwide of 2017.\n\nFrom Wikipedia (https://en.wikipedia.org/wiki/Ed_Sheeran) under Creative Commons Attribution CC-BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/legalcode)"),
|
||||
wikipedia_url: Some("https://en.wikipedia.org/wiki/Ed_Sheeran"),
|
||||
subscriber_count: Some(52600000),
|
||||
tracks: [
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ MusicArtist(
|
|||
height: 1200,
|
||||
),
|
||||
],
|
||||
description: "Senta-Sofia Delliponti is a German singer, songwriter and actress. Since January 2014, she used the stage name Oonagh, until she changed it to Senta in 2022. Her signature musical style is inspired by the mystical lore of J. R. R. Tolkien\'s universe and by ethnic sounds throughout the world.\n\nFrom Wikipedia (https://en.wikipedia.org/wiki/Oonagh_(singer)) under Creative Commons Attribution CC-BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/legalcode)",
|
||||
description: Some("Senta-Sofia Delliponti is a German singer, songwriter and actress. Since January 2014, she used the stage name Oonagh, until she changed it to Senta in 2022. Her signature musical style is inspired by the mystical lore of J. R. R. Tolkien\'s universe and by ethnic sounds throughout the world.\n\nFrom Wikipedia (https://en.wikipedia.org/wiki/Oonagh_(singer)) under Creative Commons Attribution CC-BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/legalcode)"),
|
||||
wikipedia_url: Some("https://en.wikipedia.org/wiki/Oonagh_"),
|
||||
subscriber_count: Some(34200),
|
||||
tracks: [
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ MusicArtist(
|
|||
height: 1200,
|
||||
),
|
||||
],
|
||||
description: "ImagineDragons.lnk.to/Mercury",
|
||||
description: Some("ImagineDragons.lnk.to/Mercury"),
|
||||
wikipedia_url: None,
|
||||
subscriber_count: Some(29300000),
|
||||
tracks: [
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ MusicArtist(
|
|||
height: 1200,
|
||||
),
|
||||
],
|
||||
description: "Choi Jin-ri, better known by her stage name Sulli, was a South Korean actress and singer. She first made her debut as a child actress, appearing as a supporting cast member on the SBS historical drama Ballad of Seodong. Following this, she earned a number of guest roles, appearing in the television series Love Needs a Miracle and Drama City, and the film Vacation. She then subsequently appeared in the independent films Punch Lady and BA:BO, the former being her first time cast in a substantial dramatic role.\nAfter signing a record deal with SM Entertainment, Sulli rose to prominence as a member of the girl group f(x) formed in 2009. The group achieved both critical and commercial success, with four Korean number-one singles and international recognition after becoming the first K-pop act to perform at SXSW. Concurrently with her music career, Sulli returned to acting by starring in the SBS romantic comedy series, To the Beautiful You, a Korean adaptation of the shōjo manga Hana-Kimi where her performance was positively received and earned her two SBS Drama Awards and a nomination at the 49th Paeksang Arts Awards.\n\nFrom Wikipedia (https://en.wikipedia.org/wiki/Sulli) under Creative Commons Attribution CC-BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/legalcode)",
|
||||
description: Some("Choi Jin-ri, better known by her stage name Sulli, was a South Korean actress and singer. She first made her debut as a child actress, appearing as a supporting cast member on the SBS historical drama Ballad of Seodong. Following this, she earned a number of guest roles, appearing in the television series Love Needs a Miracle and Drama City, and the film Vacation. She then subsequently appeared in the independent films Punch Lady and BA:BO, the former being her first time cast in a substantial dramatic role.\nAfter signing a record deal with SM Entertainment, Sulli rose to prominence as a member of the girl group f(x) formed in 2009. The group achieved both critical and commercial success, with four Korean number-one singles and international recognition after becoming the first K-pop act to perform at SXSW. Concurrently with her music career, Sulli returned to acting by starring in the SBS romantic comedy series, To the Beautiful You, a Korean adaptation of the shōjo manga Hana-Kimi where her performance was positively received and earned her two SBS Drama Awards and a nomination at the 49th Paeksang Arts Awards.\n\nFrom Wikipedia (https://en.wikipedia.org/wiki/Sulli) under Creative Commons Attribution CC-BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/legalcode)"),
|
||||
wikipedia_url: Some("https://en.wikipedia.org/wiki/Sulli"),
|
||||
subscriber_count: Some(74400),
|
||||
tracks: [
|
||||
|
|
|
|||
|
|
@ -1099,7 +1099,7 @@ pub struct MusicArtist {
|
|||
/// Artist header image
|
||||
pub header_image: Vec<Thumbnail>,
|
||||
/// Artist description
|
||||
pub description: String,
|
||||
pub description: Option<String>,
|
||||
/// URL of the artist's wikipedia page
|
||||
pub wikipedia_url: Option<String>,
|
||||
/// Artist subscriber count
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ MusicArtist(
|
|||
id: "UC7cl4MmM6ZZ2TcFyMk_b4pg",
|
||||
name: "Unheilig",
|
||||
header_image: "[header_image]",
|
||||
description: "Unheilig was a German band that featured a variety of influences, including various pop and electronic styles as well as harder, nihilistic hard rock. The band was founded in 1999 and principally consisted of singer Bernd Heinrich \"Der Graf\" along with various musical partners. He was accompanied for live shows with musicians Christoph \"Licky\" Termühlen, Henning Verlage, and Martin \"Potti\" Potthoff. The group\'s debut, Phosphor, came out in 2000.\n\nFrom Wikipedia (https://en.wikipedia.org/wiki/Unheilig) under Creative Commons Attribution CC-BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/legalcode)",
|
||||
description: Some("Unheilig was a German band that featured a variety of influences, including various pop and electronic styles as well as harder, nihilistic hard rock. The band was founded in 1999 and principally consisted of singer Bernd Heinrich \"Der Graf\" along with various musical partners. He was accompanied for live shows with musicians Christoph \"Licky\" Termühlen, Henning Verlage, and Martin \"Potti\" Potthoff. The group\'s debut, Phosphor, came out in 2000.\n\nFrom Wikipedia (https://en.wikipedia.org/wiki/Unheilig) under Creative Commons Attribution CC-BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/legalcode)"),
|
||||
wikipedia_url: Some("https://en.wikipedia.org/wiki/Unheilig"),
|
||||
subscriber_count: "[subscriber_count]",
|
||||
tracks: "[tracks]",
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ MusicArtist(
|
|||
id: "UC7cl4MmM6ZZ2TcFyMk_b4pg",
|
||||
name: "Unheilig",
|
||||
header_image: "[header_image]",
|
||||
description: "Unheilig was a German band that featured a variety of influences, including various pop and electronic styles as well as harder, nihilistic hard rock. The band was founded in 1999 and principally consisted of singer Bernd Heinrich \"Der Graf\" along with various musical partners. He was accompanied for live shows with musicians Christoph \"Licky\" Termühlen, Henning Verlage, and Martin \"Potti\" Potthoff. The group\'s debut, Phosphor, came out in 2000.\n\nFrom Wikipedia (https://en.wikipedia.org/wiki/Unheilig) under Creative Commons Attribution CC-BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/legalcode)",
|
||||
description: Some("Unheilig was a German band that featured a variety of influences, including various pop and electronic styles as well as harder, nihilistic hard rock. The band was founded in 1999 and principally consisted of singer Bernd Heinrich \"Der Graf\" along with various musical partners. He was accompanied for live shows with musicians Christoph \"Licky\" Termühlen, Henning Verlage, and Martin \"Potti\" Potthoff. The group\'s debut, Phosphor, came out in 2000.\n\nFrom Wikipedia (https://en.wikipedia.org/wiki/Unheilig) under Creative Commons Attribution CC-BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/legalcode)"),
|
||||
wikipedia_url: Some("https://en.wikipedia.org/wiki/Unheilig"),
|
||||
subscriber_count: "[subscriber_count]",
|
||||
tracks: "[tracks]",
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ MusicArtist(
|
|||
id: "UCh8gHdtzO2tXd593_bjErWg",
|
||||
name: "Doobydobap",
|
||||
header_image: "[header_image]",
|
||||
description: "",
|
||||
description: None,
|
||||
wikipedia_url: None,
|
||||
subscriber_count: "[subscriber_count]",
|
||||
tracks: "[tracks]",
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ MusicArtist(
|
|||
id: "UC_vmjW5e1xEHhYjY2a0kK1A",
|
||||
name: "Oonagh",
|
||||
header_image: "[header_image]",
|
||||
description: "Senta-Sofia Delliponti is a German singer, songwriter and actress. Since January 2014, she used the stage name Oonagh, until she changed it to Senta in 2022. Her signature musical style is inspired by the mystical lore of J. R. R. Tolkien\'s universe and by ethnic sounds throughout the world.\n\nFrom Wikipedia (https://en.wikipedia.org/wiki/Oonagh_(singer)) under Creative Commons Attribution CC-BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/legalcode)",
|
||||
description: Some("Senta-Sofia Delliponti is a German singer, songwriter and actress. Since January 2014, she used the stage name Oonagh, until she changed it to Senta in 2022. Her signature musical style is inspired by the mystical lore of J. R. R. Tolkien\'s universe and by ethnic sounds throughout the world.\n\nFrom Wikipedia (https://en.wikipedia.org/wiki/Oonagh_(singer)) under Creative Commons Attribution CC-BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/legalcode)"),
|
||||
wikipedia_url: Some("https://en.wikipedia.org/wiki/Oonagh_"),
|
||||
subscriber_count: "[subscriber_count]",
|
||||
tracks: "[tracks]",
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ MusicArtist(
|
|||
id: "UCfwCE5VhPMGxNPFxtVv7lRw",
|
||||
name: "Sulli",
|
||||
header_image: "[header_image]",
|
||||
description: "Choi Jin-ri, better known by her stage name Sulli, was a South Korean actress and singer. She first made her debut as a child actress, appearing as a supporting cast member on the SBS historical drama Ballad of Seodong. Following this, she earned a number of guest roles, appearing in the television series Love Needs a Miracle and Drama City, and the film Vacation. She then subsequently appeared in the independent films Punch Lady and BA:BO, the former being her first time cast in a substantial dramatic role.\nAfter signing a record deal with SM Entertainment, Sulli rose to prominence as a member of the girl group f(x) formed in 2009. The group achieved both critical and commercial success, with four Korean number-one singles and international recognition after becoming the first K-pop act to perform at SXSW. Concurrently with her music career, Sulli returned to acting by starring in the SBS romantic comedy series, To the Beautiful You, a Korean adaptation of the shōjo manga Hana-Kimi where her performance was positively received and earned her two SBS Drama Awards and a nomination at the 49th Paeksang Arts Awards.\n\nFrom Wikipedia (https://en.wikipedia.org/wiki/Sulli) under Creative Commons Attribution CC-BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/legalcode)",
|
||||
description: Some("Choi Jin-ri, better known by her stage name Sulli, was a South Korean actress and singer. She first made her debut as a child actress, appearing as a supporting cast member on the SBS historical drama Ballad of Seodong. Following this, she earned a number of guest roles, appearing in the television series Love Needs a Miracle and Drama City, and the film Vacation. She then subsequently appeared in the independent films Punch Lady and BA:BO, the former being her first time cast in a substantial dramatic role.\nAfter signing a record deal with SM Entertainment, Sulli rose to prominence as a member of the girl group f(x) formed in 2009. The group achieved both critical and commercial success, with four Korean number-one singles and international recognition after becoming the first K-pop act to perform at SXSW. Concurrently with her music career, Sulli returned to acting by starring in the SBS romantic comedy series, To the Beautiful You, a Korean adaptation of the shōjo manga Hana-Kimi where her performance was positively received and earned her two SBS Drama Awards and a nomination at the 49th Paeksang Arts Awards.\n\nFrom Wikipedia (https://en.wikipedia.org/wiki/Sulli) under Creative Commons Attribution CC-BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/legalcode)"),
|
||||
wikipedia_url: Some("https://en.wikipedia.org/wiki/Sulli"),
|
||||
subscriber_count: "[subscriber_count]",
|
||||
tracks: "[tracks]",
|
||||
|
|
|
|||
|
|
@ -1924,7 +1924,7 @@ async fn music_related(#[case] id: &str, #[case] full: bool) {
|
|||
assert!(!album.cover.is_empty(), "got no cover");
|
||||
|
||||
let artist = album.artists.first().unwrap();
|
||||
assert_channel_id(&artist.id.as_ref().unwrap());
|
||||
assert_channel_id(artist.id.as_ref().unwrap());
|
||||
assert!(!artist.name.is_empty());
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue