mirror of
https://github.com/Drop-OSS/drop.git
synced 2026-07-24 17:03:00 +10:00
feat: pcgamgingwiki desc in searchstub
This commit is contained in:
@@ -258,8 +258,6 @@ export class PCGamingWikiProvider implements MetadataProvider {
|
|||||||
receptionResults.push(getRating(MetadataSource.OpenCritic));
|
receptionResults.push(getRating(MetadataSource.OpenCritic));
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(res.data.parse.title, receptionResults);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
shortIntro: introductionEle.find("p").first().text().trim(),
|
shortIntro: introductionEle.find("p").first().text().trim(),
|
||||||
introduction: introductionEle.text().trim(),
|
introduction: introductionEle.text().trim(),
|
||||||
@@ -277,26 +275,28 @@ export class PCGamingWikiProvider implements MetadataProvider {
|
|||||||
format: "json",
|
format: "json",
|
||||||
});
|
});
|
||||||
|
|
||||||
const res = await this.cargoQuery<PCGamingWikiSearchStub>(searchParams);
|
const response =
|
||||||
|
await this.cargoQuery<PCGamingWikiSearchStub>(searchParams);
|
||||||
|
|
||||||
const mapped = res.data.cargoquery.map((result) => {
|
const results: GameMetadataSearchResult[] = [];
|
||||||
|
for (const result of response.data.cargoquery) {
|
||||||
const game = result.title;
|
const game = result.title;
|
||||||
|
const pageContent = await this.getPageContent(game.PageID);
|
||||||
|
|
||||||
const metadata: GameMetadataSearchResult = {
|
results.push({
|
||||||
id: game.PageID,
|
id: game.PageID,
|
||||||
name: game.PageName,
|
name: game.PageName,
|
||||||
icon: game["Cover URL"] ?? "",
|
icon: game["Cover URL"] ?? "",
|
||||||
description: "", // TODO: need to render the `Introduction` template somehow (or we could just hardcode it)
|
description: pageContent.shortIntro,
|
||||||
year:
|
year:
|
||||||
game.Released !== null && game.Released.length > 0
|
game.Released !== null && game.Released.length > 0
|
||||||
? // sometimes will provide multiple dates
|
? // sometimes will provide multiple dates
|
||||||
this.parseTS(game.Released).year
|
this.parseTS(game.Released).year
|
||||||
: 0,
|
: 0,
|
||||||
};
|
});
|
||||||
return metadata;
|
}
|
||||||
});
|
|
||||||
|
|
||||||
return mapped;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user