<?php include __DIR__ . '/settings.php'; include __DIR__ . '/../src/Moinax/TvDb/Http/HttpClient.php'; include __DIR__ . '/../src/Moinax/TvDb/Http/CurlClient.php'; include __DIR__ . '/../src/Moinax/TvDb/CurlException.php'; include __DIR__ . '/../src/Moinax/TvDb/Client.php'; include __DIR__ . '/../src/Moinax/TvDb/Serie.php'; include __DIR__ . '/../src/Moinax/TvDb/Banner.php'; include __DIR__ . '/../src/Moinax/TvDb/Episode.php'; use Moinax\TvDb\Client; $tvdb = new Client(TVDB_URL, TVDB_API_KEY); $serverTime = $tvdb->getServerTime(); // Search for a show $data = $tvdb->getSeries('Walking Dead'); // Use the first show found and get the S01E01 episode $episode = $tvdb->getEpisode($data[0]->id, 1, 1, 'en'); var_dump($episode); /*$date = new \DateTime('-1 day'); $data = $tvdb->getUpdates($date->getTimestamp()); var_dump($data); */ /* // Get full series and episode info $episodes = $tvdb->getSerieEpisodes(153021, 'fr', Client::FORMAT_ZIP); var_dump($episodes["episodes"]); printf ("(%d Episodes)\n", count($episodes["episodes"])); */
include __DIR__ . '/../../3rd_party/Moinax/TvDb/CurlException.php'; include __DIR__ . '/../../3rd_party/Moinax/TvDb/Client.php'; include __DIR__ . '/../../3rd_party/Moinax/TvDb/Serie.php'; include __DIR__ . '/../../3rd_party/Moinax/TvDb/Banner.php'; include __DIR__ . '/../../3rd_party/Moinax/TvDb/Episode.php'; use Moinax\TvDb\Client; $tvdb = new Client(TVDB_URL, TVDB_API_KEY); $serverTime = $tvdb->getServerTime(); ##################################################################### $query = $_POST['q']; $theme = $options->get('theme'); $basedir = $options->get('base_directory'); $themepath = $basedir . 'frontend/themes/' . $theme; $partial = $themepath . '/partials/' . $_POST['p'] . '.php'; $partial_code = file_get_contents($partial); $helper->log($query); $data = $tvdb->getSeries($query, 'de'); $values = array(); foreach ($data as $show) { $values['name'] = $show->name; $values['description'] = $show->overview; $url = "http://thetvdb.com/banners/_cache/" . $show->banner; $values['banner'] = $url; if (false === file_get_contents($url, 0, null, 0, 1) || empty($show->banner)) { $helper->log('Image not found'); $values['banner'] = '/tvshows/frontend/images/pixel.gif'; } $values['id'] = $show->id; echo $helper->parse($partial_code, $values); } echo '<script type="text/javascript">ajaxButtons();</script>';
use Moinax\TvDb\Client; $tvdb = new Client(TVDB_URL, TVDB_API_KEY); $serverTime = $tvdb->getServerTime(); ##################################################################### $files = $db->get_incomplete_shows(); $i = 0; foreach ($files as $file) { # FIRST VERSION: EXPECT NAME TO BE LIKE # <SHOWNAME> - <EPISODE SXXEYY> - <OPTIONAL EPISODE-TITLE>.<EXTENSION> # SIMPLE / DIRTY list($show_name, $episode, $episode_title) = preg_split('/ - /', $file['filename']); $episode_title = substr($episode_title, 0, -4); $media_obj = $db->load_object_by_column('tv_shows', 'show_name', $show_name); $file['show_id'] = $media_obj['id']; if (!$media_obj) { $data = $tvdb->getSeries($show_name, 'de'); if (empty($data)) { # NOT FOUND, SET TO -1 AND CONTINUE $file['show_id'] = -1; $db->update($file, 'tv_files'); continue; } # ADD SHOW, UPDATE MEDIA-OBJECT $tvshow['id'] = $db->get_new_table_id('tv_shows'); $tvshow['show_name'] = $data[0]->name; if ($data[0]->firstAired) { $tvshow['date'] = $data[0]->firstAired->format('Y-m-d'); } $tvshow['tvdb_id'] = $data[0]->id; $tvshow['imdb_id'] = $data[0]->imdbId; $tvshow['banner'] = $data[0]->banner;