Skip to content

Commit

Permalink
add missing fields to info and data & change character voice actor so…
Browse files Browse the repository at this point in the history
…rting (#74)

* added missing fields to info and data, and also changed character sorting
  • Loading branch information
inumakieu authored Sep 18, 2022
1 parent 4e91529 commit 6be91f2
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 5 deletions.
7 changes: 7 additions & 0 deletions dist/models/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ export interface IAnimeInfo extends IAnimeResult {
status?: MediaStatus;
totalEpisodes?: number;
subOrDub?: SubOrSub;
synonyms?: string[];
/**
* two letter representation of coutnry: e.g JP for japan
*/
countryOfOrigin?: string;
isAdult?: boolean;
isLicensed?: boolean;
/**
* `FALL`, `WINTER`, `SPRING`, `SUMMER`
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/models/types.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions dist/providers/meta/anilist.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/providers/meta/anilist.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/utils/queries.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/utils/queries.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions src/models/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ export interface IAnimeInfo extends IAnimeResult {
status?: MediaStatus;
totalEpisodes?: number;
subOrDub?: SubOrSub;
synonyms?: string[];
/**
* two letter representation of coutnry: e.g JP for japan
*/
countryOfOrigin?: string;
isAdult?: boolean;
isLicensed?: boolean;
/**
* `FALL`, `WINTER`, `SPRING`, `SUMMER`
*/
Expand Down
11 changes: 11 additions & 0 deletions src/providers/meta/anilist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,11 @@ class Anilist extends AnimeParser {
userPreferred: data.data.Media.title.userPreferred,
};

animeInfo.synonyms = data.data.Media.synonyms;
animeInfo.isLicensed = data.data.Media.isLicensed;
animeInfo.isAdult = data.data.Media.isAdult;
animeInfo.countryOfOrigin = data.data.Media.countryOfOrigin;

if (data.data.Media.trailer?.id) {
animeInfo.trailer = {
id: data.data.Media.trailer.id,
Expand Down Expand Up @@ -1132,6 +1137,12 @@ class Anilist extends AnimeParser {
thumbnail: data.data.Media.trailer?.thumbnail,
};
}

animeInfo.synonyms = data.data.Media.synonyms;
animeInfo.isLicensed = data.data.Media.isLicensed;
animeInfo.isAdult = data.data.Media.isAdult;
animeInfo.countryOfOrigin = data.data.Media.countryOfOrigin;

animeInfo.image =
data.data.Media.coverImage.extraLarge ??
data.data.Media.coverImage.large ??
Expand Down
2 changes: 1 addition & 1 deletion src/utils/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const anilistSearchQuery = (
) =>
`query ($page: Int = ${page}, $id: Int, $type: MediaType = ${type}, $search: String = "${query}", $isAdult: Boolean = false, $size: Int = ${perPage}) { Page(page: $page, perPage: $size) { pageInfo { total perPage currentPage lastPage hasNextPage } media(id: $id, type: $type, search: $search, isAdult: $isAdult) { id idMal status(version: 2) title { userPreferred romaji english native } bannerImage popularity coverImage{ extraLarge large medium color } episodes format season description seasonYear chapters volumes averageScore genres nextAiringEpisode { airingAt timeUntilAiring episode } } } }`;
export const anilistMediaDetailQuery = (id: string) =>
`query ($id: Int = ${id}) { Media(id: $id) { id idMal title { english native romaji } coverImage { extraLarge large color } startDate { year month day } endDate { year month day } bannerImage season seasonYear description type format status(version: 2) episodes duration chapters volumes trailer { id site thumbnail } genres source averageScore popularity meanScore nextAiringEpisode { airingAt timeUntilAiring episode } characters(sort: ROLE) { edges { role node { id name { first middle last full native userPreferred } image { large medium } } voiceActors(sort: RELEVANCE) { id name { first middle last full native userPreferred } image { large medium } } } } recommendations { edges { node { id mediaRecommendation { id idMal title { romaji english native userPreferred } status episodes coverImage { extraLarge large medium color } bannerImage format chapters meanScore nextAiringEpisode { episode timeUntilAiring airingAt } } } } } relations { edges { id relationType node { id idMal status coverImage { extraLarge large medium color } bannerImage title { romaji english native userPreferred } episodes chapters format nextAiringEpisode { airingAt timeUntilAiring episode } meanScore } } } studios(isMain: true) { edges { isMain node { id name } } } } }`;
`query ($id: Int = ${id}) { Media(id: $id) { id idMal title { english native romaji } synonyms countryOfOrigin isLicensed isAdult coverImage { extraLarge large color } startDate { year month day } endDate { year month day } bannerImage season seasonYear description type format status(version: 2) episodes duration chapters volumes trailer { id site thumbnail } genres source averageScore popularity meanScore nextAiringEpisode { airingAt timeUntilAiring episode } characters(sort: ROLE) { edges { role node { id name { first middle last full native userPreferred } image { large medium } } voiceActors(sort: LANGUAGE) { id name { first middle last full native userPreferred } image { large medium } } } } recommendations { edges { node { id mediaRecommendation { id idMal title { romaji english native userPreferred } status episodes coverImage { extraLarge large medium color } bannerImage format chapters meanScore nextAiringEpisode { episode timeUntilAiring airingAt } } } } } relations { edges { id relationType node { id idMal status coverImage { extraLarge large medium color } bannerImage title { romaji english native userPreferred } episodes chapters format nextAiringEpisode { airingAt timeUntilAiring episode } meanScore } } } studios(isMain: true) { edges { isMain node { id name } } } } }`;
export const anilistTrendingQuery = (
page: number = 1,
perPage: number = 20,
Expand Down

0 comments on commit 6be91f2

Please sign in to comment.