fix(name): fix route crash for some ids
sometimes we don't get genres, causing the crash. fix https://codeberg.org/zyachel/libremdb/issues/20
This commit is contained in:
parent
5fa5e9e2c2
commit
e91c313f12
2 changed files with 10 additions and 9 deletions
|
@ -373,7 +373,7 @@ export default interface Name {
|
||||||
}>;
|
}>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
titleGenres: {
|
titleGenres?: {
|
||||||
genres: Array<{
|
genres: Array<{
|
||||||
genre: {
|
genre: {
|
||||||
text: string;
|
text: string;
|
||||||
|
@ -525,7 +525,7 @@ export default interface Name {
|
||||||
}>;
|
}>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
titleGenres: {
|
titleGenres?: {
|
||||||
genres: Array<{
|
genres: Array<{
|
||||||
genre: {
|
genre: {
|
||||||
text: string;
|
text: string;
|
||||||
|
@ -740,7 +740,7 @@ export default interface Name {
|
||||||
}>;
|
}>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
titleGenres: {
|
titleGenres?: {
|
||||||
genres: Array<{
|
genres: Array<{
|
||||||
genre: {
|
genre: {
|
||||||
text: string;
|
text: string;
|
||||||
|
|
|
@ -113,7 +113,7 @@ const cleanName = (rawData: RawName) => {
|
||||||
avg: item.node.title.ratingsSummary.aggregateRating ?? null,
|
avg: item.node.title.ratingsSummary.aggregateRating ?? null,
|
||||||
numVotes: item.node.title.ratingsSummary.voteCount,
|
numVotes: item.node.title.ratingsSummary.voteCount,
|
||||||
},
|
},
|
||||||
genres: item.node.title.titleGenres.genres.map(genre => genre.genre.text),
|
genres: item.node.title.titleGenres?.genres.map(genre => genre.genre.text) ?? [],
|
||||||
|
|
||||||
summary: {
|
summary: {
|
||||||
numEpisodes: item.node.summary.episodeCount ?? null,
|
numEpisodes: item.node.summary.episodeCount ?? null,
|
||||||
|
@ -133,10 +133,11 @@ const cleanName = (rawData: RawName) => {
|
||||||
id: cat.titleTypeCategory.id,
|
id: cat.titleTypeCategory.id,
|
||||||
label: cat.titleTypeCategory.text,
|
label: cat.titleTypeCategory.text,
|
||||||
})),
|
})),
|
||||||
genres: misc.creditSummary.genres.map(genre => ({
|
genres:
|
||||||
total: genre.total,
|
misc.creditSummary.genres.map(genre => ({
|
||||||
name: genre.genre.displayableProperty.value.plainText,
|
total: genre.total,
|
||||||
})),
|
name: genre.genre.displayableProperty.value.plainText,
|
||||||
|
})) ?? [],
|
||||||
},
|
},
|
||||||
released: getCredits(misc.releasedPrimaryCredits),
|
released: getCredits(misc.releasedPrimaryCredits),
|
||||||
// unreleased: getCredits<'unreleased'>(misc.unreleasedPrimaryCredits),
|
// unreleased: getCredits<'unreleased'>(misc.unreleasedPrimaryCredits),
|
||||||
|
@ -263,7 +264,7 @@ const getCredits = <T extends 'released' | 'unreleased' = 'released'>(
|
||||||
numVotes: item.node.title.ratingsSummary.voteCount,
|
numVotes: item.node.title.ratingsSummary.voteCount,
|
||||||
},
|
},
|
||||||
test: JSON.stringify(item.node.title),
|
test: JSON.stringify(item.node.title),
|
||||||
genres: item.node.title.titleGenres.genres.map(genre => genre.genre.text),
|
genres: item.node.title.titleGenres?.genres.map(genre => genre.genre.text) ?? [],
|
||||||
productionStatus: item.node.title.productionStatus.currentProductionStage.text,
|
productionStatus: item.node.title.productionStatus.currentProductionStage.text,
|
||||||
|
|
||||||
summary: {
|
summary: {
|
||||||
|
|
Loading…
Reference in a new issue