示例#1
0
 public function processTvDB()
 {
     if ($this->pdo->getSetting('lookupthetvdb') == 1) {
         $thetvdb = new \TheTVDB($this->echooutput);
         $thetvdb->processReleases();
     }
 }
示例#2
0
<?php

require_once "config.php";
$page = new AdminPage();
$TheTVDB = new TheTVDB();
$id = 0;
// set the current action
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view';
switch ($action) {
    case 'submit':
        $TheTVDB->updateSeries($_POST['tvdbid'], $_POST['actors'], $_POST['airsday'], $_POST['airstime'], $_POST['contentrating'], $_POST['firstaired'], $_POST['genre'], $_POST['imdbid'], $_POST['network'], $_POST['overview'], $_POST['rating'], $_POST['ratingcount'], $_POST['runtime'], $_POST['seriesname'], $_POST['status']);
        if (isset($_POST['from']) && !empty($_POST['from'])) {
            header("Location:" . $_POST['from']);
            exit;
        }
        header("Location:" . WWW_TOP . "/thetvdb-list.php");
        break;
    case 'view':
    default:
        if (isset($_GET["id"])) {
            $page->title = "TheTVDB Edit";
            $page->smarty->assign('series', $TheTVDB->getSeriesInfoByID($_GET["id"]));
        }
        break;
}
$page->title = "Edit TheTVDB Data";
$page->content = $page->smarty->fetch('thetvdb-edit.tpl');
$page->render();
示例#3
0
<?php

require_once "config.php";
$page = new AdminPage();
$TheTVDB = new TheTVDB();
$page->title = "TheTVDB List";
$sname = "";
if (isset($_REQUEST['seriesname']) && !empty($_REQUEST['seriesname'])) {
    $sname = $_REQUEST['seriesname'];
}
$seriescount = $TheTVDB->getSeriesCount($sname);
$offset = isset($_REQUEST["offset"]) ? $_REQUEST["offset"] : 0;
$ssearch = $sname != "" ? 'seriesname=' . $sname . '&amp;' : '';
$page->smarty->assign('pagertotalitems', $seriescount);
$page->smarty->assign('pageroffset', $offset);
$page->smarty->assign('pageritemsperpage', ITEMS_PER_PAGE);
$page->smarty->assign('pagerquerybase', WWW_TOP . "/thetvdb-list.php?" . $ssearch . "&offset=");
$pager = $page->smarty->fetch("pager.tpl");
$page->smarty->assign('pager', $pager);
$page->smarty->assign('seriesname', $sname);
$serieslist = $TheTVDB->getSeriesRange($offset, ITEMS_PER_PAGE, $sname);
$page->smarty->assign('serieslist', $serieslist);
$page->content = $page->smarty->fetch('thetvdb-list.tpl');
$page->render();
 public function processTvReleases($site, $numtoProcess = 100)
 {
     $ret = 0;
     $db = new DB();
     $tvmaze = new TVMaze();
     $tvdb = new TheTVDB();
     $lookupTvMaze = $site->lookuptvmaze;
     $lookuptheTvDB = $site->lookupthetvdb;
     // get all releases without a tvinfo which are in a tv category.
     $result = $db->queryDirect(sprintf("SELECT searchname, ID from releases where tvinfoID = -1 and categoryID in ( select ID from category where parentID = %d ) order by postdate desc limit %d ", Category::CAT_PARENT_TV, $numtoProcess));
     if ($db->getNumRows($result) > 0) {
         if ($this->echooutput) {
             echo "TVInfo  : Looking up " . $db->getNumRows($result) . " releases. TvMaze:" . ($lookupTvMaze ? "on" : "off") . " theTVDB:" . ($lookuptheTvDB ? "on" : "off") . "\n";
         }
         while ($arr = $db->getAssocArray($result)) {
             $show = $this->parseNameEpSeason($arr['searchname']);
             if ($show && $show['name'] != '') {
                 // find the ID locally
                 $tvinforow = $this->getTvInfoByTitle($show['cleanname']);
                 if ($tvinforow && $this->echooutput) {
                     echo sprintf("TVInfo  : Found %s %s %s\n", $show['cleanname'], $show['seriesfull'], $tvinforow['localonly'] == 1 ? "Local Only" : "");
                 }
                 // if not found locally try maze
                 if (!$tvinforow && $lookupTvMaze) {
                     if ($this->echooutput) {
                         echo "TVInfo  : Didnt find " . $show['cleanname'] . " locally, checking TvMaze\n";
                     }
                     $tvmShow = $tvmaze->singleSearch($show['cleanname']);
                     if ($tvmShow && $this->compare($show['cleanname'], $tvmShow->name) >= TvInfo::MATCH_PROBABILITY) {
                         $this->addTvInfoFromMaze($show['cleanname'], $tvmShow);
                         $tvinforow = $this->getByMazeID($tvmShow->id);
                         //get back out on maze id, not insertid, incase it failed to insert due to mazeid already existing
                     }
                 }
                 // if not found locally or maze try tvdb
                 if (!$tvinforow && $lookuptheTvDB) {
                     $seriesinfo = $tvdb->lookupSeriesID($show['cleanname']);
                     if ($seriesinfo && $seriesinfo["id"] > 0 && $this->compare($show['cleanname'], $seriesinfo["name"]) >= TvInfo::MATCH_PROBABILITY) {
                         $tvinforow = $this->getByTvdbID($seriesinfo["id"]);
                         if (!$tvinforow) {
                             if ($this->echooutput) {
                                 echo "TVInfo  : Didnt find " . $show['cleanname'] . " locally, checking theTVDB\n";
                             }
                             $tvdbShow = $tvdb->lookupSeries($seriesinfo["id"], $show['cleanname'], false);
                             $this->addTvInfoFromTVDB($show, $tvdbShow);
                             $tvinforow = $this->getByTvdbID($tvdbShow["tvdbID"]);
                             //get back out on tvdb id, not insertid, incase it failed to insert due to tvdbid already existing
                         }
                     }
                 }
                 // if tv try and get episode info
                 if ($tvinforow) {
                     $seriesfull = isset($show['seriesfull']) && !empty($show['seriesfull']) ? $db->escapeString($show['seriesfull']) : "null";
                     $season = isset($show['season']) && !empty($show['season']) ? $db->escapeString($show['season']) : "null";
                     $episode = isset($show['episode']) && !empty($show['episode']) ? $db->escapeString($show['episode']) : "null";
                     $tvairdate = isset($show['airdate']) && !empty($show['airdate']) ? $db->escapeString($show['airdate']) : "null";
                     $tvepisodetitle = "null";
                     $shortfullep = str_replace('S', '', $show['season']) . 'x' . str_replace('E', '', $show['episode']);
                     $episodeid = "null";
                     // only bother looking up for episode data if the match wasnt to a local tvinfo row
                     if ($tvinforow["localonly"] == 0) {
                         //check local releases to see if we already have the data (release or episodeinfo)
                         $epsql = sprintf("select tvtitle as title, tvairdate as airdate from releases\n                                 where tvairdate is not null and season = %s and episode = %s and tvinfoID = %d\n                                 union select eptitle as title, airdate from episodeinfo where tvinfoID = %d and fullep = %s", $db->escapeString($show['season']), $db->escapeString($show['episode']), $tvinforow["ID"], $tvinforow["ID"], $db->escapeString($shortfullep));
                         $epinfo = $db->queryOneRow($epsql);
                         // check maze for ep if mazeID is known
                         if (!$epinfo && $lookupTvMaze && $tvinforow["mazeID"]) {
                             if (strpos($show["seriesfull"], '/') !== false) {
                                 $tvmEpInfo = $tvmaze->getDatedEpisode($tvinforow["mazeID"], str_replace("/", "-", $show["seriesfull"]));
                             } else {
                                 $tvmEpInfo = $tvmaze->getNumberedEpisode($tvinforow["mazeID"], str_replace('S', '', $show['season']), str_replace('E', '', $show['episode']));
                             }
                             if ($tvmEpInfo) {
                                 $episodeid = $this->addEpisode(null, $tvmEpInfo->id, $tvinforow["releasetitle"], $tvmEpInfo->airdate, $tvmEpInfo->season, $tvmEpInfo->number, $tvmEpInfo->name, null, null, $tvmEpInfo->summary, null, null, null, $tvinforow["ID"]);
                                 $epinfo = $this->getEpisodeInfoByID($episodeid);
                             }
                         }
                         // check tvdb for ep if tvdb is known
                         if (!$epinfo && $lookuptheTvDB && $tvinforow["tvdbID"]) {
                             $tvdbEpInfo = $tvdb->lookupEpisode($tvinforow["tvdbID"], $show);
                             if ($tvdbEpInfo) {
                                 $episodeid = $this->addEpisode($tvdbEpInfo["id"], null, $tvinforow["releasetitle"], $tvdbEpInfo["airdate"], $tvdbEpInfo["season"], $tvdbEpInfo["number"], $tvdbEpInfo["name"], $tvdbEpInfo["director"], $tvdbEpInfo["gueststars"], $tvdbEpInfo["summary"], $tvdbEpInfo["rating"], $tvdbEpInfo["writer"], $tvdbEpInfo["epabsolute"], $tvinforow["ID"]);
                                 $epinfo = $this->getEpisodeInfoByID($episodeid);
                             }
                         }
                         if ($epinfo) {
                             if (!empty($epinfo['airdate'])) {
                                 $tvairdate = $db->escapeString($epinfo['airdate']);
                             }
                             if (!empty($epinfo['eptitle'])) {
                                 $tvepisodetitle = $db->escapeString($epinfo['eptitle']);
                             }
                         }
                     }
                     $db->exec(sprintf("update releases set tvinfoID=%d, seriesfull = %s, season = %s, episode = %s, tvairdate=%s, tvtitle=%s, episodeinfoID=%s where ID = %d", $tvinforow["ID"], $seriesfull, $season, $episode, $tvairdate, $tvepisodetitle, $episodeid, $arr['ID']));
                 } else {
                     $this->markAsNotFound($show, $arr["ID"]);
                 }
             } else {
                 $this->markAsNotFound($show, $arr["ID"]);
             }
             $ret++;
         }
     }
     return $ret;
 }
示例#5
0
 /**
  * Process all TV related releases which will assign their series/episode/rage data
  */
 public function processTv()
 {
     if ($this->pdo->getSetting('lookupanidb') == 1) {
         $anidb = new AniDB($this->echooutput);
         $anidb->animetitlesUpdate();
         $anidb->processAnimeReleases();
     }
     if ($this->pdo->getSetting('lookuptvrage') == 1) {
         $tvrage = new TVRage($this->echooutput);
         $tvrage->processTvReleases($this->pdo->getSetting('lookuptvrage') == 1);
     }
     if ($this->pdo->getSetting('lookupthetvdb') == 1) {
         $thetvdb = new TheTVDB($this->echooutput);
         $thetvdb->processReleases();
     }
 }
示例#6
0
<?php

require_once "config.php";
$page = new AdminPage();
if (isset($_GET['id'])) {
    $TheTVDB = new TheTVDB();
    $TheTVDB->deleteTitle($_GET['id']);
}
$referrer = $_SERVER['HTTP_REFERER'];
header("Location: " . $referrer);
示例#7
0
* (at your option) any later version,
* and distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* Sample PHP File
*
* @package    TheTVDB API
* @author     Ekachai Omkaew <*****@*****.**>
* @copyright  1997-2015 Ekachai Omkaew
* @license    GNU General Public License (GNU GPL or GPL): http://www.gnu.org/licenses/
*/
require_once 'TheTVDB.class.php';
// Replace your API key here (Require)
$api = new TheTVDB("ABCDEF0123456789");
echo '<br>';
echo '----------------------------------------------------------------------------------------------------------- GET MIRROR EXAMPLE -----------------------------------------------------------------------------------------------------------';
echo '<br>';
// Get api path to show (optional)
$mirror = $api->get_mirror();
echo 'Mirror ID: ' . $mirror->Mirror->id . '<br>Mirror Path: ' . $mirror->Mirror->mirrorpath . '<br>Mirror Type Mask: ' . $mirror->Mirror->typemask;
echo '<br>';
echo '<br>';
echo '--------------------------------------------------------------------------------------------------------- SEARCH SERIES EXAMPLE ---------------------------------------------------------------------------------------------------------';
echo '<br>';
// Search series name with 'Overlord'
$search_series_result_all = $api->search_series('Overlord');
// Search series name with 'Overlord' and get result index 1 (First result)
$search_series_result_specific = $api->search_series('Overlord', 1);
// Set series id to variable to get series data
示例#8
0
* and distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* Sample PHP File
*
* @package    TheTVDB API
* @author     Ekachai Omkaew <*****@*****.**>
* @copyright  1997-2015 Ekachai Omkaew
* @license    GNU General Public License (GNU GPL or GPL): http://www.gnu.org/licenses/
*/
require_once 'TheTVDB.class.php';
include 'helper.class.php';
// Replace your API key here (Require)
$api = new TheTVDB("ABCDEF0123456789");
echo '<br>';
echo '----------------------------------------------------------------------------------------------------------- GET MIRROR EXAMPLE -----------------------------------------------------------------------------------------------------------';
echo '<br>';
// Get api path to show (optional)
$mirror = $api->get_mirror();
echo 'Mirror ID: ' . $mirror->Mirror->id . '<br>Mirror Path: ' . $mirror->Mirror->mirrorpath . '<br>Mirror Type Mask: ' . $mirror->Mirror->typemask;
echo '<br>';
echo '<br>';
echo '--------------------------------------------------------------------------------------------------------- SEARCH SERIES EXAMPLE ---------------------------------------------------------------------------------------------------------';
echo '<br>';
// Search series name with 'Overlord'
$search_series_result_all = $api->search_series('Gakusen Toshi Asterisk');
// Search series name with 'Overlord' and get result index 1 (First result)
$search_series_result_specific = $api->search_series('Gakusen Toshi Asterisk', 1);
// Set series id to variable to get series data