Skip to content

Commit

Permalink
add show index
Browse files Browse the repository at this point in the history
  • Loading branch information
ImUrX committed Jul 9, 2023
1 parent e00f179 commit 753fd1f
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions src/util/saucenao.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,14 @@ pub async fn build_embed(
.url(format!("https://www.pixiv.net/users/${}", data.member_id)),
)
.title(data.title),
ResData::Anime(data) => if let Some(part) = data.part {
ResData::Anime(SauceAnimeData { part, est_time, source, .. })
| ResData::Shows(SauceShowData { part, est_time, source, ..}) => if let Some(part) = part {
embed.field(EmbedFieldBuilder::new("Part:", part).inline())
} else {
embed
}
.field(EmbedFieldBuilder::new("Timestamp:", data.est_time).inline())
.title(data.source),
.field(EmbedFieldBuilder::new("Timestamp:", est_time).inline())
.title(source),
ResData::DeviantArt(SauceDeviantArtData {
title,
author_name,
Expand Down Expand Up @@ -289,6 +290,7 @@ impl<'de> Deserialize<'de> for Res {
}
21 | 22 => ResData::Anime(SauceAnimeData::deserialize(data).map_err(D::Error::custom)?),
23 => ResData::Movies(SauceMovieData::deserialize(data).map_err(D::Error::custom)?),
24 => ResData::Shows(SauceShowData::deserialize(data).map_err(D::Error::custom)?),
25 => {
ResData::Gelbooru(SauceGelbooruData::deserialize(data).map_err(D::Error::custom)?)
}
Expand Down Expand Up @@ -368,6 +370,7 @@ pub enum ResData {
IdolComplex(SauceIdolComplexData),
Konachan(SauceKonachanData),
Market2D(Sauce2DMarketData),
Shows(SauceShowData),
}

impl ResData {
Expand Down Expand Up @@ -403,7 +406,8 @@ impl ResData {
| Self::Skeb(_)
| Self::Twitter(_)
| Self::Drawr(_)
| Self::Yandere(_) => false,
| Self::Yandere(_)
| Self::Shows(_) => false,
}
}

Expand Down Expand Up @@ -439,7 +443,8 @@ impl ResData {
| Self::IdolComplex(SauceIdolComplexData { ext_urls, .. })
| Self::Konachan(SauceKonachanData { ext_urls, .. })
| Self::Market2D(Sauce2DMarketData { ext_urls, .. })
| Self::BcyCoser(SauceBcyCosplayData { ext_urls, .. }) => Some(ext_urls),
| Self::BcyCoser(SauceBcyCosplayData { ext_urls, .. })
| Self::Shows(SauceShowData { ext_urls, ..}) => Some(ext_urls),
}
}
}
Expand Down Expand Up @@ -771,3 +776,13 @@ pub struct SauceBcyCosplayData {
pub member_link_id: u32,
pub bcy_type: String,
}

#[derive(Debug, Deserialize, Clone)]
pub struct SauceShowData {
pub ext_urls: Vec<String>,
pub imdb_id: String,
pub part: Option<String>,
pub year: Option<String>,
pub est_time: String,
pub source: String,
}

0 comments on commit 753fd1f

Please sign in to comment.