wrapperr/api/get_functions.php
aunefyren 2f2e1ca0aa Auto file-creation, trimming and lowercase-compare on inputs, better instructions and labels
The config and cache files are now recreated if missing/deleted.
Inputs are now trimmed in the API and compared in lowercase to avoid missmatches.
Added better labels and descriptions on some inputs, as well as placeholders.
Fixed some details in README.md
2021-09-21 12:40:54 +02:00

22 lines
No EOL
698 B
PHP

<?php
$data = json_decode(file_get_contents("php://input"));
$path = "../config/config.json";
if(!file_exists($path)) {
fopen($path, "w");
}
$config = json_decode(file_get_contents("../config/config.json"));
if (empty($config)) {
echo json_encode(array("message" => "Plex Wrapped is not configured.", "error" => true));
exit(0);
}
$functions = array("get_user_movie_stats" => $config->get_user_movie_stats,
"get_user_show_stats" => $config->get_user_show_stats,
"get_user_show_buddy" => $config->get_user_show_buddy,
"get_year_stats" => $config->get_year_stats
);
echo json_encode($functions);
exit(0);
?>