forked from Li/psmreborn
87 lines
1.4 KiB
PHP
87 lines
1.4 KiB
PHP
<?php
|
|
function update_rifs()
|
|
{
|
|
|
|
if(time() + 86400 < filemtime("NpsPsm.tsv"))
|
|
{
|
|
file_put_contents("NpsPsm.tsv", file_get_contents("http://beta.nopaystation.com/tsv/PSM_GAMES.tsv"));
|
|
}
|
|
}
|
|
update_rifs();
|
|
|
|
|
|
function getTitle(string $game)
|
|
{
|
|
$xml = simplexml_load_file('gameinfo/' . $game . "/app.xml", 'SimpleXMLElement', LIBXML_NOENT);
|
|
$title = $xml->name->localized_item[0]->attributes()->value;
|
|
unset($xml);
|
|
return $title;
|
|
}
|
|
|
|
function getPlayableList()
|
|
{
|
|
$playable_list = (array)null;
|
|
$delimiter = "\t";
|
|
$fp = fopen("NpsPsm.tsv", 'r');
|
|
while (!feof($fp))
|
|
{
|
|
$line = fgets($fp, 2048);
|
|
$data = str_getcsv($line, $delimiter);
|
|
$playable = 0;
|
|
if($data[4] != "MISSING")
|
|
{
|
|
$playable = 1;
|
|
}
|
|
$playable_list[$data[0]] = $playable;
|
|
|
|
|
|
}
|
|
fclose($fp);
|
|
return $playable_list;
|
|
}
|
|
|
|
|
|
|
|
function getZRIF(string $titleid)
|
|
{
|
|
$delimiter = "\t";
|
|
|
|
$fp = fopen("NpsPsm.tsv", 'r');
|
|
|
|
while ( !feof($fp) )
|
|
{
|
|
$line = fgets($fp, 2048);
|
|
|
|
$data = str_getcsv($line, $delimiter);
|
|
|
|
if($data[0] == $titleid)
|
|
{
|
|
return($data[4]);
|
|
}
|
|
}
|
|
|
|
fclose($fp);
|
|
}
|
|
|
|
function getPKG(string $titleid)
|
|
{
|
|
$delimiter = "\t";
|
|
|
|
$fp = fopen("NpsPsm.tsv", 'r');
|
|
|
|
while ( !feof($fp) )
|
|
{
|
|
$line = fgets($fp, 2048);
|
|
|
|
$data = str_getcsv($line, $delimiter);
|
|
|
|
if($data[0] == $titleid)
|
|
{
|
|
return($data[3]);
|
|
}
|
|
}
|
|
|
|
fclose($fp);
|
|
}
|
|
|
|
?>
|