Added testcases from telemetry into compatdb.
This commit is contained in:
parent
640c806fd3
commit
ac40da89b5
|
@ -64,6 +64,29 @@ async function getGithubIssues() {
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getTestcases() {
|
||||||
|
let options = {
|
||||||
|
url: 'https://api.citra-emu.org/telemetry/testcase/',
|
||||||
|
headers: { 'User-Agent': 'citrabot' },
|
||||||
|
};
|
||||||
|
|
||||||
|
var body = await request.get(options);
|
||||||
|
return JSON.parse(body).map(x => {
|
||||||
|
return {
|
||||||
|
title: x.title,
|
||||||
|
compatibility: x.compatibility.toString(),
|
||||||
|
date: x.date,
|
||||||
|
version: x.version,
|
||||||
|
buildName: x.buildName,
|
||||||
|
buildDate: x.buildDate,
|
||||||
|
cpu: x.cpu,
|
||||||
|
gpu: x.gpu,
|
||||||
|
os: x.os,
|
||||||
|
author: x.author
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Fetch game information stored in Github repository.
|
// Fetch game information stored in Github repository.
|
||||||
gitPull('./citra-games-wiki', 'https://github.com/citra-emu/citra-games-wiki.git');
|
gitPull('./citra-games-wiki', 'https://github.com/citra-emu/citra-games-wiki.git');
|
||||||
|
|
||||||
|
@ -71,15 +94,19 @@ gitPull('./citra-games-wiki', 'https://github.com/citra-emu/citra-games-wiki.git
|
||||||
gitPull('./citra-games-wiki.wiki', 'https://github.com/citra-emu/citra-games-wiki.wiki.git');
|
gitPull('./citra-games-wiki.wiki', 'https://github.com/citra-emu/citra-games-wiki.wiki.git');
|
||||||
|
|
||||||
// Fetch all issues from Github.
|
// Fetch all issues from Github.
|
||||||
var githubIssues = null;
|
var githubIssues = [];
|
||||||
var wikiEntries = {};
|
var wikiEntries = {};
|
||||||
|
var testcases = [];
|
||||||
|
|
||||||
getGithubIssues()
|
async function setup() {
|
||||||
.then(function(issues) {
|
//githubIssues = await getGithubIssues();
|
||||||
logger.info(`Imported ${issues.length} issues from Github.`);
|
//logger.info(`Imported ${githubIssues.length} issues from Github.`);
|
||||||
githubIssues = issues;
|
|
||||||
})
|
testcases = await getTestcases();
|
||||||
.then(function() {
|
logger.info(`Obtained ${testcases.length} testcases from Telemetry API.`);
|
||||||
|
};
|
||||||
|
|
||||||
|
setup().then(function() {
|
||||||
// Make sure the output directories in Hugo exist.
|
// Make sure the output directories in Hugo exist.
|
||||||
[fsPathHugoContent, fsPathHugoBoxart, fsPathHugoIcon, fsPathHugoSavefiles, fsPathHugoScreenshots].forEach(function (path) {
|
[fsPathHugoContent, fsPathHugoBoxart, fsPathHugoIcon, fsPathHugoSavefiles, fsPathHugoScreenshots].forEach(function (path) {
|
||||||
if (fs.existsSync(path) == false) {
|
if (fs.existsSync(path) == false) {
|
||||||
|
@ -122,8 +149,22 @@ function processGame(game) {
|
||||||
let currentDate = new Date();
|
let currentDate = new Date();
|
||||||
model.date = `${currentDate.toISOString()}`;
|
model.date = `${currentDate.toISOString()}`;
|
||||||
|
|
||||||
// Reverse the order of the testcases array, so that the newest ones are displayed first
|
// Look up all testcases associated with the Title IDs.
|
||||||
model.testcases = model.testcases.reverse();
|
let releases = model.releases.map(y => y.title);
|
||||||
|
let foundTestcases = testcases.filter(x => {
|
||||||
|
return releases.includes(x.title);
|
||||||
|
});
|
||||||
|
|
||||||
|
logger.info(`Found ${foundTestcases.length} testcases from telemetry, found ${model.testcases.length} in toml file.`);
|
||||||
|
|
||||||
|
model.testcases = model.testcases.concat(foundTestcases);
|
||||||
|
|
||||||
|
// Sort the testcases from most recent to least recent.
|
||||||
|
model.testcases.sort(function(a, b){
|
||||||
|
// Turn your strings into dates, and then subtract them
|
||||||
|
// to get a value that is either negative, positive, or zero.
|
||||||
|
return new Date(b.date) - new Date(a.date);
|
||||||
|
});
|
||||||
|
|
||||||
// SHORTCUTS BLOCK
|
// SHORTCUTS BLOCK
|
||||||
// Parse testcase information out of the dat to reinject as shortcut values.
|
// Parse testcase information out of the dat to reinject as shortcut values.
|
||||||
|
|
|
@ -114,10 +114,10 @@
|
||||||
{{ range .Params.testcases }}
|
{{ range .Params.testcases }}
|
||||||
{{- $rating := index $siteCompatibility .compatibility }}
|
{{- $rating := index $siteCompatibility .compatibility }}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ dateFormat "January 2, 2006" .date }}</td>
|
<td>{{ dateFormat "01/02/2006" .date }}</td>
|
||||||
<td><a href="https://community.citra-emu.org/u/{{ .author }}/summary">{{ .author }}</a></td>
|
<td><a href="https://community.citra-emu.org/u/{{ .author }}/summary">{{ .author }}</a></td>
|
||||||
<td>{{ .cpu }}<br />{{ .gpu }}<br />{{ .os }}</td>
|
<td>{{ .cpu }}<br />{{ .gpu }}<br />{{ .os }}</td>
|
||||||
<td>{{ .version }}</td>
|
<td>{{ if isset . "versionType" }}{{ .versionType }} Build<br />{{ end }}{{ .version }}<br />{{ if isset . "buildDate" }} {{ dateFormat "01/2/2006" .buildDate }} {{ end }}</td>
|
||||||
<td><b><div class="square-icon" style="background-color: {{ $rating.color }}"></div> {{ $rating.name }}</b></td>
|
<td><b><div class="square-icon" style="background-color: {{ $rating.color }}"></div> {{ $rating.name }}</b></td>
|
||||||
</tr>
|
</tr>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
Reference in New Issue