Skip to content

Commit

Permalink
Introduced media status for anilist (#972)
Browse files Browse the repository at this point in the history
* introduced media status for anilist

* Referencing MediaStatus by full path

* Updated text to match other providers

* Added newline

* chore(providers): add trailing comma

* Changed to use custom function rather than to_string implementation

---------

Co-authored-by: Diptesh Choudhuri <[email protected]>
  • Loading branch information
Jacob-Tate and IgnisDa authored Aug 19, 2024
1 parent d884135 commit 1b8b982
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions crates/providers/src/anilist/media_details.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ query MediaDetailsQuery($id: Int!) {
native
romaji
}
status
airingSchedule {
nodes {
airingAt
Expand Down
14 changes: 13 additions & 1 deletion crates/providers/src/anilist/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,18 @@ impl NonMediaAnilistService {
}
}

fn media_status_string(status: Option<media_details_query::MediaStatus>) -> Option<String>
{
match status {
Some(media_details_query::MediaStatus::FINISHED) => Some("Finished".to_string()),
Some(media_details_query::MediaStatus::RELEASING) => Some("Ongoing".to_string()),
Some(media_details_query::MediaStatus::NOT_YET_RELEASED) => Some("Not Yet Released".to_string()),
Some(media_details_query::MediaStatus::CANCELLED) => Some("Canceled".to_string()),
Some(media_details_query::MediaStatus::HIATUS) => Some("Hiatus".to_string()),
_ => None,
}
}

#[async_trait]
impl MediaProvider for NonMediaAnilistService {
async fn people_search(
Expand Down Expand Up @@ -704,7 +716,7 @@ async fn media_details(
provider_rating: score,
group_identifiers: vec![],
s3_images: vec![],
production_status: None,
production_status: media_status_string(details.status),
original_language: None,
..Default::default()
})
Expand Down

0 comments on commit 1b8b982

Please sign in to comment.