Example #1
0
<?php

require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'indexer.php');
use nzedb\processing\tv\TVDB;
$c = new nzedb\ColorCLI();
$tvdb = new TVDB();
if (!empty($argv[1]) && is_numeric($argv[2]) && is_numeric($argv[3])) {
    // Test if your TvDB API key and configuration are 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];
    $serverTime = $tvdb->client->getServerTime();
    // Search for a show
    $series = $tvdb->client->getSeries((string) $argv[1]);
    // Use the first show found (highest match) and get the requested season/episode from $argv
    if ($series) {
        echo PHP_EOL . $c->info("Server Time: " . $serverTime) . PHP_EOL;
        print_r($series[0]);
        if ($season > 0 and $episode > 0) {
            $episodeObj = $tvdb->client->getEpisode($series[0]->id, $season, $episode, 'en');
            if ($episodeObj) {
                print_r($episodeObj);
            }
        } else {
            if ($season == 0 && $episode == 0) {
                $episodeObj = $tvdb->client->getSerieEpisodes($series[0]->id, 'en');
                if ($episodeObj['episodes'] instanceof \Traversable) {
                    foreach ($episodeObj['episodes'] as $ep) {
                        print_r($ep);
                    }
                }
Example #2
0
<?php

require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'indexer.php');
use nzedb\processing\tv\TVDB;
$c = new nzedb\ColorCLI();
$tvdb = new TVDB();
if (isset($argv[1]) && !empty($argv[1]) && isset($argv[2]) && is_numeric($argv[2]) && isset($argv[3]) && is_numeric($argv[3])) {
    // Test if your TvDB API key and configuration are 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];
    $day = isset($argv[4]) && is_numeric($argv[4]) ? $argv[4] : '';
    $serverTime = $tvdb->client->getServerTime();
    // Search for a show
    $series = $tvdb->client->getSeries((string) $argv[1]);
    // Use the first show found (highest match) and get the requested season/episode from $argv
    if ($series) {
        echo PHP_EOL . $c->info("Server Time: " . $serverTime) . PHP_EOL;
        print_r($series[0]);
        if ($season > 0 && $episode > 0 && $day === '') {
            $episodeObj = $tvdb->client->getEpisode($series[0]->id, $season, $episode, 'en');
            if ($episodeObj) {
                print_r($episodeObj);
            }
        } else {
            if ($season == 0 && $episode == 0) {
                $episodeObj = $tvdb->client->getSerieEpisodes($series[0]->id, 'en');
                if (is_array($episodeObj['episodes'])) {
                    foreach ($episodeObj['episodes'] as $ep) {
                        print_r($ep);
                    }
Example #3
0
<?php

require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'indexer.php');
use nzedb\processing\tv\TraktTv;
$c = new nzedb\ColorCLI();
$trakt = new TraktTv();
if (!empty($argv[1]) && is_numeric($argv[2]) && is_numeric($argv[3])) {
    // Test if your Trakt API key and configuration are working
    // If it works you should get a printed array of the show/season/episode entered
    // Search for a show
    $series = $trakt->client->showSearch((string) $argv[1], 'show');
    // Use the first show found (highest match) and get the requested season/episode from $argv
    if (is_array($series)) {
        $episode = $trakt->client->episodeSummary((int) $series[0]['show']['ids']['trakt'], (int) $argv[2], (int) $argv[3], 'full');
        print_r($series[0]);
        print_r($episode);
    } else {
        exit($c->error("Error retrieving Trakt data."));
    }
} else {
    exit($c->error("Invalid arguments.  This script requires a text string (show name) followed by a season and episode number."));
}
Example #4
0
<?php

require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'indexer.php');
use nzedb\processing\tv\TMDB;
$c = new nzedb\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) {
        $seriesAppends = $tmdb->client->getTVShow($series[0]->_data['id'], 'append_to_response=alternative_titles,external_ids');
        if ($seriesAppends) {
            $series[0]->_data['networks'] = $seriesAppends->_data['networks'];
            $series[0]->_data['alternative_titles'] = $seriesAppends->_data['alternative_titles']['results'];
            $series[0]->_data['external_ids'] = $seriesAppends->_data['external_ids'];
        }
        print_r($series[0]);
        if ($season > 0 && $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)) {