|
|
|
@ -21,7 +21,8 @@ declare(strict_types=1); |
|
|
|
require_once('include/getJsonErrorString.php'); |
|
|
|
require_once('include/getJsonErrorString.php'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const FOLDER_PATH = '../video/unwatched'; |
|
|
|
//const FOLDER_PATH = '../video/unwatched'; |
|
|
|
|
|
|
|
const FOLDER_PATH = '../video/tv.shows/Archer'; |
|
|
|
const MAX_RECURSE_DEPTH = 5; |
|
|
|
const MAX_RECURSE_DEPTH = 5; |
|
|
|
$g_errors = []; |
|
|
|
$g_errors = []; |
|
|
|
|
|
|
|
|
|
|
|
@ -147,6 +148,29 @@ function getUnsavedMetadata() : void |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function verifyChanges() : void |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
header('Content-Type: text/json'); |
|
|
|
|
|
|
|
$input = file_get_contents('php://input'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($input) { |
|
|
|
|
|
|
|
$json = json_decode($input); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($json) { |
|
|
|
|
|
|
|
// TODO: recursively check that each path entry maps to a file on disk |
|
|
|
|
|
|
|
// and has a valid media type set |
|
|
|
|
|
|
|
// TODO: sanitize file names for TMDB queries |
|
|
|
|
|
|
|
// TODO: make queries to TMDB for sanitized titles |
|
|
|
|
|
|
|
// NOTE: this will be much easier for movies because TV shows will require |
|
|
|
|
|
|
|
// additional queries for seasons and episodes |
|
|
|
|
|
|
|
echo '{"errors": null, "message": "successfully decoded"}'; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
echo '{"errors":"' . __FUNCTION__ . ', error decoding json: ' |
|
|
|
|
|
|
|
. getJsonErrorString(json_last_error()) . '"}'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function main() : void |
|
|
|
function main() : void |
|
|
|
{ |
|
|
|
{ |
|
|
|
switch (@$_GET['action']) { |
|
|
|
switch (@$_GET['action']) { |
|
|
|
@ -156,6 +180,9 @@ function main() : void |
|
|
|
case 'file_map'; |
|
|
|
case 'file_map'; |
|
|
|
// |
|
|
|
// |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
case 'verify': |
|
|
|
|
|
|
|
verifyChanges(); |
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|