Exemplo n.º 1
0
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>';
Exemplo n.º 2
0
require_once $basepath . '/../lib/lib_options.php';
$helper = new LibHelper();
$db = new LibDatabase($dbs);
$options = new LibOptions();
$media_objects = array();
$media_directory = $options->get('media_directory');
$md = new LibDirectory($media_directory);
$md->add_filetype('avi');
$md->add_filetype('mkv');
$md->load_all_files();
$filelist = $md->get_filelist();
$files_existing = 0;
$files_new = 0;
foreach ($filelist as $file) {
    $media_object = new LibMediaObject();
    $media_object->set_metadata('filename', $file['basename']);
    $media_object->set_metadata('filetype', $file['extension']);
    $media_object->set_metadata('path', $file['dirname']);
    if ($param1 != 'dryrun') {
        if ($media_object->save(TRUE)) {
            $files_new++;
        } else {
            $files_existing++;
        }
    } else {
        var_dump($media_object);
    }
}
$helper->log('EXISTING FILES: ' . $files_existing);
$helper->log('NEW FILES:      ' . $files_new);
echo $files_new . '*' . $files_existing;