示例#1
0
    $response["comment"] = "You did not specify a video file";
    output($response);
}
// Set variables
$video = $_GET["file"];
$videolocation = "../video/" . $video;
// Check if file exists
if (!file_exists($videolocation)) {
    $response["success"] = false;
    $response["comment"] = "File does not exist";
    output($response);
}
// Include the metadata list
include_once "../names.php";
// Check if the file is in the array
if (!array_key_exists($video, $names)) {
    $response["success"] = false;
    $response["comment"] = "We do not have any metadata for this file";
    output($response);
}
// If all test passed, Reply with information
$data = $names[$video];
// Set response
$response["success"] = true;
$response["comment"] = "No errors";
$response["filename"] = $video;
$response["title"] = existsOrDefault("title", $data);
$response["source"] = existsOrDefault("source", $data);
$response["song"] = existsOrDefault("song", $data, 0);
// Finish reply
output($response);
示例#2
0
    $response["success"] = false;
    $response["comment"] = "File does not exist";
    output($response);
}
// Include the metadata list
include_once "../names.php";
// Check if the file is in the array
$found = false;
foreach ($names as $S => $video_array) {
    foreach ($video_array as $T => $data) {
        if ($data["file"] == $video) {
            $found = true;
            $series = $S;
            $title = $T;
            $song = existsOrDefault("song", $data);
            $subtitles = existsOrDefault("subtitles", $data);
            break 2;
        }
    }
}
if (!$found) {
    $response["success"] = false;
    $response["comment"] = "We do not have any metadata for this file";
    output($response);
}
// Set response
$response["success"] = true;
$response["comment"] = "No errors";
$response["filename"] = $video;
$response["title"] = $title;
$response["source"] = $series;