<?php

require_once "api.php";
$videoFileUrl = null;
$assignedId = null;
$title = null;
$url = null;
$previewImage = null;
$params = $_GET;
if (array_key_exists("video_file_url", $params)) {
    $videoFileUrl = $params["video_file_url"];
} else {
    exit('{"status" : "error", "message" : "key \\"video_file_url\\" needs to point to the video file"}');
}
if (array_key_exists("video_id", $params)) {
    $assignedId = $params["video_id"];
}
if (array_key_exists("title", $params)) {
    $title = utf8_decode(urldecode($params["title"]));
}
if (array_key_exists("url", $params)) {
    $url = $params["url"];
}
if (array_key_exists("preview_image", $params)) {
    $previewImage = $params["preview_image"];
}
$api = new TextRecognitionAPI();
$api->add_to_queue($videoFileUrl, $assignedId, $title, $url, $previewImage);
<?php

if (!array_key_exists("queue_status", $_GET)) {
    exit('{"status" : "error", "message" : "queue_status needs to be set"}');
}
$api = new TextRecognitionAPI();
$api->set_queue_status($_GET["queue_status"]);
<?php

require_once "api.php";
if (!isset($_GET["id_type"]) || !isset($_GET["id_value"])) {
    exit('{"status":"error","message":"id_type and id_value need to be set"}');
}
$idType = $_GET["id_type"];
$idValue = $_GET["id_value"];
$api = new TextRecognitionAPI();
if (array_key_exists("with_id", $_GET) && $_GET["with_id"] == 1) {
    $api->get_tags($idType, $idValue, true);
} else {
    $api->get_tags($idType, $idValue);
}
<?php

require_once "api.php";
if (!isset($_GET["id_type"]) || !isset($_GET["id_value"])) {
    exit('{"status":"error","message":"id_type and id_value need to be set"}');
}
$idType = $_GET["id_type"];
$idValue = $_GET["id_value"];
$api = new TextRecognitionAPI();
$api->get_status($idType, $idValue);
<?php

require_once "api.php";
if (!isset($_GET["id_type"]) || !isset($_GET["id_value"])) {
    exit('{"status":"error","message":"id_type and id_value need to be set"}');
}
$idType = $_GET["id_type"];
$idValue = $_GET["id_value"];
$api = new TextRecognitionAPI();
$api->delete_video($idType, $idValue);
<?php

require_once "api.php";
// retrieve params
if (!isset($_GET["id_type"]) || !isset($_GET["id_value"])) {
    exit('{"status":"error","message":"id_type and id_value need to be set"}');
}
$idType = $_GET["id_type"];
$idValue = $_GET["id_value"];
$api = new TextRecognitionAPI();
$api->try_video_again($idType, $idValue);
if (!isset($_GET["id_type"]) || !isset($_GET["id_value"])) {
    exit('{"status":"error","message":"id_type and id_value need to be set"}');
}
$idType = $_GET["id_type"];
$idValue = $_GET["id_value"];
$videoFileUrl = null;
$assignedId = null;
$title = null;
$url = null;
$previewImage = null;
$params = $_GET;
if (array_key_exists("video_file_url", $params)) {
    $videoFileUrl = $params["video_file_url"];
} else {
    exit('{"status" : "error", "message" : "key \\"video_file_url\\" needs to point to the video file"}');
}
if (array_key_exists("video_id", $params)) {
    $assignedId = $params["video_id"];
}
if (array_key_exists("title", $params)) {
    $title = utf8_decode(urldecode($params["title"]));
}
if (array_key_exists("url", $params)) {
    $url = $params["url"];
}
if (array_key_exists("preview_image", $params)) {
    $previewImage = $params["preview_image"];
}
// call api
$api = new TextRecognitionAPI();
$api->update_item($idType, $idValue, $videoFileUrl, $assignedId, $title, $url, $previewImage);
<?php

require_once "api.php";
if (array_key_exists("id", $_GET) && array_key_exists("accepted", $_GET)) {
    $api = new TextRecognitionAPI();
    $api->accept_decline_tag($_GET["id"], $_GET["accepted"]);
} else {
    exit('{"status":"error", "message":"parameters id and accepted need to be set."}');
}