mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 09:18:54 +00:00
First push of semi working tmdb
This commit is contained in:
Executable
+48
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'indexer.php');
|
||||
|
||||
use newznab\processing\tv\TMDB;
|
||||
|
||||
$c = new newznab\ColorCLI();
|
||||
$tmdb = new TMDB();
|
||||
|
||||
if (!empty($argv[1]) && is_numeric($argv[2]) && is_numeric($argv[3])) {
|
||||
|
||||
// Test if your TMDB API configuration is working
|
||||
// If it works you should get a var dumped array of the show/season/episode entered
|
||||
|
||||
$season = (int)$argv[2];
|
||||
$episode = (int)$argv[3];
|
||||
|
||||
// Search for a show
|
||||
$series = $tmdb->client->searchTVShow((string)$argv[1]);
|
||||
|
||||
// Use the first show found (highest match) and get the requested season/episode from $argv
|
||||
if ($series) {
|
||||
|
||||
print_r($series[0]);
|
||||
|
||||
if ($season > 0 AND $episode > 0) {
|
||||
$episodeObj = $tmdb->client->getEpisode($series[0]->_data['id'], $season, $episode);
|
||||
if ($episodeObj) {
|
||||
print_r($episodeObj);
|
||||
}
|
||||
} else if ($season == 0 && $episode == 0) {
|
||||
$episodeObj = $tmdb->client->getTVShow($series[0]->_data['id']);
|
||||
if (is_array($episodeObj)) {
|
||||
foreach ($episodeObj AS $ep) {
|
||||
print_r($ep);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
exit($c->error("Invalid episode data returned from TVMaze API."));
|
||||
}
|
||||
|
||||
} else {
|
||||
exit($c->error("Invalid show data returned from TVMaze API."));
|
||||
}
|
||||
|
||||
} else {
|
||||
exit($c->error("Invalid arguments. This script requires a text string (show name) followed by a season and episode number."));
|
||||
}
|
||||
Reference in New Issue
Block a user