Added new json files and sound events.
This commit is contained in:
parent
0c11a98275
commit
d4962e48b5
3 changed files with 77 additions and 3 deletions
public
|
@ -73,6 +73,34 @@ if($reqPath === '/common.json') {
|
|||
json_out($common);
|
||||
}
|
||||
|
||||
if($reqPath === '/sounds2.json') {
|
||||
$sndLibData = file_get_contents(FTM_PATH_PRV . '/sound-library.ini');
|
||||
$sndPackData = file_get_contents(FTM_PATH_PRV . '/sound-packs.ini');
|
||||
|
||||
etag_data('sounds2', $sndLibData . $sndPackData);
|
||||
|
||||
$sndLib = parse_ini_string($sndLibData, true, INI_SCANNER_TYPED);
|
||||
$sndPacks = parse_ini_string($sndPackData, true, INI_SCANNER_TYPED);
|
||||
|
||||
$library = [];
|
||||
foreach($sndLib as $name => $info)
|
||||
$library[] = [
|
||||
'name' => $name,
|
||||
'title' => $info['title'],
|
||||
'sources' => $info['sources'],
|
||||
];
|
||||
|
||||
$packs = [];
|
||||
foreach($sndPacks as $name => $info)
|
||||
$packs[] = [
|
||||
'name' => $name,
|
||||
'title' => $info['title'],
|
||||
'events' => $info['events'],
|
||||
];
|
||||
|
||||
json_out(compact('library', 'packs'));
|
||||
}
|
||||
|
||||
if($reqPath === '/sounds.json') {
|
||||
$sndLibData = file_get_contents(FTM_PATH_PRV . '/sound-library.ini');
|
||||
$sndPackData = file_get_contents(FTM_PATH_PRV . '/sound-packs.ini');
|
||||
|
@ -100,17 +128,30 @@ if($reqPath === '/sounds.json') {
|
|||
}
|
||||
|
||||
$packs = [];
|
||||
foreach($sndPacks as $name => $info) {
|
||||
foreach($sndPacks as $name => $info)
|
||||
$packs[] = [
|
||||
'id' => $name,
|
||||
'name' => $info['title'],
|
||||
'events' => $info['events'],
|
||||
];
|
||||
}
|
||||
|
||||
json_out(compact('library', 'packs'));
|
||||
}
|
||||
|
||||
if($reqPath === '/texttriggers.json') {
|
||||
$textTriggersPath = FTM_PATH_PRV . '/text-triggers.ini';
|
||||
etag_file('texttriggers', $textTriggersPath);
|
||||
|
||||
$triggers = parse_ini_file($textTriggersPath, true, INI_SCANNER_TYPED);
|
||||
|
||||
if($triggers === false)
|
||||
$triggers = [];
|
||||
else
|
||||
$triggers = array_values($triggers);
|
||||
|
||||
json_out($triggers);
|
||||
}
|
||||
|
||||
if($reqPath === '/soundtriggers.json') {
|
||||
$textTriggersPath = FTM_PATH_PRV . '/text-triggers.ini';
|
||||
etag_file('soundtriggers', $textTriggersPath);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue