예제 #1
0
         }
     }
 }
 $imdbids = array();
 if (isset($obj) && count($obj) > 0) {
     foreach ($obj as $movie) {
         if (isset($movie['title']) && isset($movie['imdb_id'])) {
             $imdbids[] = str_replace('tt', '', $movie['imdb_id']);
         }
     }
     if (count($imdbids) == 0) {
         print "<h3 style='padding-top:30px;'>No results found</h3>";
     } else {
         $ourmovieimdbs = array();
         if (count($imdbids) > 0) {
             $m = new Movie(['Settings' => $page->settings, 'TMDb' => $tmdb]);
             $allmovies = $m->getMovieInfoMultiImdb($imdbids);
             foreach ($allmovies as $ourmovie) {
                 if ($ourmovie['relimdb'] != '') {
                     $ourmovieimdbs[$ourmovie['imdbid']] = $ourmovie['imdbid'];
                 }
             }
         }
         $userimdbs = array();
         $usermovies = $um->getMovies($page->users->currentUserId());
         foreach ($usermovies as $umovie) {
             $userimdbs[$umovie['imdbid']] = $umovie['imdbid'];
         }
         $page->smarty->assign('data', $obj);
         $page->smarty->assign('ourmovies', $ourmovieimdbs);
         $page->smarty->assign('userimdbs', $userimdbs);
예제 #2
0
파일: Nfo.php 프로젝트: egandt/nZEDb
    /**
     * Attempt to find NFO files inside the NZB's of releases.
     *
     * @param object $nntp           Instance of class NNTP.
     * @param string $groupID        (optional) Group ID.
     * @param string $guidChar       (optional) First character of the release GUID (used for multi-processing).
     * @param int    $processImdb    (optional) Attempt to find IMDB id's in the NZB?
     * @param int    $processTvrage  (optional) Attempt to find TvRage id's in the NZB?
     *
     * @return int                   How many NFO's were processed?
     *
     * @access public
     */
    public function processNfoFiles($nntp, $groupID = '', $guidChar = '', $processImdb = 1, $processTvrage = 1)
    {
        $ret = 0;
        $guidCharQuery = $guidChar === '' ? '' : 'AND r.guid ' . $this->pdo->likeString($guidChar, false, true);
        $groupIDQuery = $groupID === '' ? '' : 'AND r.group_id = ' . $groupID;
        $optionsQuery = self::NfoQueryString($this->pdo);
        $res = $this->pdo->query(sprintf('
				SELECT r.id, r.guid, r.group_id, r.name
				FROM releases r
				WHERE 1=1 %s %s %s
				ORDER BY r.nfostatus ASC, r.postdate DESC
				LIMIT %d', $optionsQuery, $guidCharQuery, $groupIDQuery, $this->nzbs));
        $nfoCount = count($res);
        if ($nfoCount > 0) {
            $this->pdo->log->doEcho($this->pdo->log->primary(PHP_EOL . ($guidChar === '' ? '' : '[' . $guidChar . '] ') . ($groupID === '' ? '' : '[' . $groupID . '] ') . 'Processing ' . $nfoCount . ' NFO(s), starting at ' . $this->nzbs . ' * = hidden NFO, + = NFO, - = no NFO, f = download failed.'));
            if ($this->echo) {
                // Get count of releases per nfo status
                $nfoStats = $this->pdo->queryDirect(sprintf('
						SELECT r.nfostatus AS status, COUNT(*) AS count
						FROM releases r
						WHERE 1=1 %s %s %s
						GROUP BY r.nfostatus
						ORDER BY r.nfostatus ASC', $optionsQuery, $guidCharQuery, $groupIDQuery));
                if ($nfoStats instanceof \Traversable) {
                    $outString = PHP_EOL . 'Available to process';
                    foreach ($nfoStats as $row) {
                        $outString .= ', ' . $row['status'] . ' = ' . number_format($row['count']);
                    }
                    $this->pdo->log->doEcho($this->pdo->log->header($outString . '.'));
                }
            }
            $groups = new Groups(['Settings' => $this->pdo]);
            $nzbContents = new NZBContents(['Echo' => $this->echo, 'NNTP' => $nntp, 'Nfo' => $this, 'Settings' => $this->pdo, 'PostProcess' => new PostProcess(['Echo' => $this->echo, 'Nfo' => $this, 'Settings' => $this->pdo])]);
            $movie = new Movie(['Echo' => $this->echo, 'Settings' => $this->pdo]);
            foreach ($res as $arr) {
                $fetchedBinary = $nzbContents->getNFOfromNZB($arr['guid'], $arr['id'], $arr['group_id'], $groups->getByNameByID($arr['group_id']));
                if ($fetchedBinary !== false) {
                    // Insert nfo into database.
                    $cp = 'COMPRESS(%s)';
                    $nc = $this->pdo->escapeString($fetchedBinary);
                    $ckreleaseid = $this->pdo->queryOneRow(sprintf('SELECT releaseid FROM release_nfos WHERE releaseid = %d', $arr['id']));
                    if (!isset($ckreleaseid['releaseid'])) {
                        $this->pdo->queryInsert(sprintf('INSERT INTO release_nfos (nfo, releaseid) VALUES (' . $cp . ', %d)', $nc, $arr['id']));
                    }
                    $this->pdo->queryExec(sprintf('UPDATE releases SET nfostatus = %d WHERE id = %d', self::NFO_FOUND, $arr['id']));
                    $ret++;
                    $movie->doMovieUpdate($fetchedBinary, 'nfo', $arr['id'], $processImdb);
                    // If set scan for tvrage info. Disabled for now while TvRage is down. TODO: Add Other Scraper Checks
                    if ($processTvrage == 1) {
                        /*$tvRage = new TvRage(['Echo' => $this->echo, 'Settings' => $this->pdo]);
                        		$showId = $this->parseShowId($fetchedBinary);
                        		if ($showId !== false) {
                        			$show = $tvRage->parseNameEpSeason($arr['name']);
                        			if (is_array($show) && $show['name'] != '') {
                        				// Update release with season, ep, and air date info (if available) from release title.
                        				$tvRage->updateEpInfo($show, $arr['id']);
                        				$rid = $tvRage->getByRageID($rageId);
                        				if (!$rid) {
                        					$tvrShow = $tvRage->getRageInfoFromService($rageId);
                        					$tvRage->updateRageInfo($rageId, $show, $tvrShow, $arr['id']);
                        				}
                        			}
                        		}*/
                    }
                }
            }
        }
        // Remove nfo that we cant fetch after 5 attempts.
        $releases = $this->pdo->queryDirect(sprintf('SELECT r.id
				FROM releases r
				WHERE r.nzbstatus = %d
				AND r.nfostatus < %d AND r.nfostatus > %d %s %s', NZB::NZB_ADDED, $this->maxRetries, self::NFO_FAILED, $groupIDQuery, $guidCharQuery));
        if ($releases instanceof \Traversable) {
            foreach ($releases as $release) {
                // remove any release_nfos for failed
                $this->pdo->queryExec(sprintf('
					DELETE FROM release_nfos WHERE nfo IS NULL AND releaseid = %d', $release['id']));
                // set release.nfostatus to failed
                $this->pdo->queryExec(sprintf('
					UPDATE releases r SET r.nfostatus = %d WHERE r.id = %d', self::NFO_FAILED, $release['id']));
            }
        }
        if ($this->echo) {
            if ($nfoCount > 0) {
                echo PHP_EOL;
            }
            if ($ret > 0) {
                $this->pdo->log->doEcho($ret . ' NFO file(s) found/processed.', true);
            }
        }
        return $ret;
    }
예제 #3
0
파일: movies.php 프로젝트: kaibosh/nZEDb
<?php

use nzedb\Category;
use nzedb\Movie;
use nzedb\DnzbFailures;
if (!$page->users->isLoggedIn()) {
    $page->show403();
}
$movie = new Movie(['Settings' => $page->settings]);
$cat = new Category(['Settings' => $page->settings]);
$fail = new DnzbFailures(['Settings' => $page->settings]);
$moviecats = $cat->getChildren(Category::CAT_PARENT_MOVIE);
$mtmp = [];
foreach ($moviecats as $mcat) {
    $mtmp[$mcat['id']] = $mcat;
}
$category = Category::CAT_PARENT_MOVIE;
if (isset($_REQUEST['t']) && array_key_exists($_REQUEST['t'], $mtmp)) {
    $category = $_REQUEST['t'] + 0;
}
$user = $page->users->getById($page->users->currentUserId());
$cpapi = $user['cp_api'];
$cpurl = $user['cp_url'];
$page->smarty->assign('cpapi', $cpapi);
$page->smarty->assign('cpurl', $cpurl);
$catarray = [];
$catarray[] = $category;
$page->smarty->assign('catlist', $mtmp);
$page->smarty->assign('category', $category);
$browsecount = $movie->getMovieCount($catarray, -1, $page->userdata['categoryexclusions']);
$offset = isset($_REQUEST['offset']) && ctype_digit($_REQUEST['offset']) ? $_REQUEST["offset"] : 0;
예제 #4
0
파일: upcoming.php 프로젝트: kaibosh/nZEDb
<?php

use nzedb\Movie;
if (!$page->users->isLoggedIn()) {
    $page->show403();
}
$m = new Movie(['Settings' => $page->settings]);
if (!isset($_GET["id"])) {
    $_GET["id"] = 1;
}
$user = $page->users->getById($page->users->currentUserId());
$cpapi = $user['cp_api'];
$cpurl = $user['cp_url'];
$page->smarty->assign('cpapi', $cpapi);
$page->smarty->assign('cpurl', $cpurl);
$data = $m->getUpcoming($_GET["id"]);
//print_r(json_decode($data["info"])->movies);die();
if (!$data || $data["info"] == "") {
    $page->smarty->assign("nodata", "No upcoming data.");
} else {
    $data = json_decode($data["info"]);
    if (isset($data->error)) {
        $page->smarty->assign("nodata", $data->error);
    } else {
        if (!isset($data->movies)) {
            $page->smarty->assign("nodata", 'Unspecified error.');
        } else {
            $page->smarty->assign('data', $data->movies);
            switch ($_GET["id"]) {
                case Movie::SRC_BOXOFFICE:
                    $page->title = "Box Office";
예제 #5
0
<?php

require_once './config.php';
use nzedb\Movie;
$page = new AdminPage();
$movie = new Movie(['Settings' => $page->settings]);
$id = 0;
// Set the current action.
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view';
if (isset($_REQUEST["id"])) {
    $id = $_REQUEST["id"];
    $mov = $movie->getMovieInfo($id);
    if (!$mov) {
        $page->show404();
    }
    switch ($action) {
        case 'submit':
            $coverLoc = nZEDb_COVERS . "movies/" . $id . '-cover.jpg';
            $backdropLoc = nZEDb_COVERS . "movies/" . $id . '-backdrop.jpg';
            if ($_FILES['cover']['size'] > 0) {
                $tmpName = $_FILES['cover']['tmp_name'];
                $file_info = getimagesize($tmpName);
                if (!empty($file_info)) {
                    move_uploaded_file($_FILES['cover']['tmp_name'], $coverLoc);
                }
            }
            if ($_FILES['backdrop']['size'] > 0) {
                $tmpName = $_FILES['backdrop']['tmp_name'];
                $file_info = getimagesize($tmpName);
                if (!empty($file_info)) {
                    move_uploaded_file($_FILES['backdrop']['tmp_name'], $backdropLoc);
예제 #6
0
<?php

require_once './config.php';
use nzedb\Movie;
$page = new AdminPage();
$movie = new Movie(['Settings' => $page->settings]);
$page->title = "Movie List";
$movcount = $movie->getCount();
$offset = isset($_REQUEST["offset"]) ? $_REQUEST["offset"] : 0;
$page->smarty->assign('pagertotalitems', $movcount);
$page->smarty->assign('pageroffset', $offset);
$page->smarty->assign('pageritemsperpage', ITEMS_PER_PAGE);
$page->smarty->assign('pagerquerybase', WWW_TOP . "/movie-list.php?offset=");
$pager = $page->smarty->fetch("pager.tpl");
$page->smarty->assign('pager', $pager);
$movielist = $movie->getRange($offset, ITEMS_PER_PAGE);
$page->smarty->assign('movielist', $movielist);
$page->content = $page->smarty->fetch('movie-list.tpl');
$page->render();
예제 #7
0
<?php

// Run this once per day.
require_once realpath(dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'indexer.php');
use nzedb\Movie;
$m = new Movie(['Echo' => true]);
$m->updateUpcoming();
예제 #8
0
파일: movie.php 프로젝트: kaibosh/nZEDb
<?php

use nzedb\Movie;
if (!$page->users->isLoggedIn()) {
    $page->show403();
}
if (isset($_GET['modal']) && isset($_GET["id"]) && ctype_digit($_GET["id"])) {
    $movie = new Movie(['Settings' => $page->settings]);
    $mov = $movie->getMovieInfo($_GET['id']);
    if (!$mov) {
        $page->show404();
    }
    $mov['actors'] = $movie->makeFieldLinks($mov, 'actors');
    $mov['genre'] = $movie->makeFieldLinks($mov, 'genre');
    $mov['director'] = $movie->makeFieldLinks($mov, 'director');
    $page->smarty->assign(['movie' => $mov, 'modal' => true]);
    $page->title = "Info for " . $mov['title'];
    $page->meta_title = "";
    $page->meta_keywords = "";
    $page->meta_description = "";
    $page->smarty->registerPlugin('modifier', 'ss', 'stripslashes');
    $page->content = $page->smarty->fetch('viewmovie.tpl');
    echo $page->content;
} else {
    $page->render();
}
예제 #9
0
파일: details.php 프로젝트: kaibosh/nZEDb
         $needed = count($criteria);
         foreach ($showInfo as $info) {
             foreach ($criteria as $key => $value) {
                 if (empty($value) && !empty($info[$key])) {
                     $criteria[$key] = $info[$key];
                     $done++;
                 }
             }
             if ($done == $needed) {
                 break;
             }
         }
     }
 }
 if ($data['imdbid'] != '' && $data['imdbid'] != 00) {
     $movie = new Movie(['Settings' => $page->settings]);
     $mov = $movie->getMovieInfo($data['imdbid']);
     if ($mov && isset($mov['title'])) {
         $mov['title'] = str_replace(['/', '\\'], '', $mov['title']);
         $mov['actors'] = $movie->makeFieldLinks($mov, 'actors');
         $mov['genre'] = $movie->makeFieldLinks($mov, 'genre');
         $mov['director'] = $movie->makeFieldLinks($mov, 'director');
         if ($page->settings->getSetting('trailers_display')) {
             $trailer = !isset($mov['trailer']) || empty($mov['trailer']) || $mov['trailer'] == '' ? $movie->getTrailer($data['imdbid']) : $mov['trailer'];
             if ($trailer) {
                 $mov['trailer'] = sprintf("<iframe width=\"%d\" height=\"%d\" src=\"%s\"></iframe>", $page->settings->getSetting('trailers_size_x'), $page->settings->getSetting('trailers_size_y'), $trailer);
             }
         }
     }
 }
 if ($data['xxxinfo_id'] != '' && $data['xxxinfo_id'] != 0) {
예제 #10
0
파일: getImdb.php 프로젝트: EeGgSs/nZEDb
<?php

//This script will update all records in the movieinfo table
require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'indexer.php');
use nzedb\ColorCLI;
use nzedb\Movie;
use nzedb\db\Settings;
$pdo = new Settings();
$c = new ColorCLI();
$movie = new Movie(['Echo' => true, 'Settings' => $pdo]);
$movies = $pdo->queryDirect("SELECT imdbid FROM movieinfo WHERE tmdbid IS NULL ORDER BY id ASC");
if ($movies instanceof \Traversable) {
    echo $pdo->log->header("Updating movie info for " . number_format($movies->rowCount()) . " movies.");
    foreach ($movies as $mov) {
        $starttime = microtime(true);
        $mov = $movie->updateMovieInfo($mov['imdbid']);
        // tmdb limits are 30 per 10 sec, not certain for imdb
        $diff = floor((microtime(true) - $starttime) * 1000000);
        if (333333 - $diff > 0) {
            echo "sleeping\n";
            usleep(333333 - $diff);
        }
    }
    echo "\n";
}
예제 #11
0
파일: movie-edit.php 프로젝트: EeGgSs/nZEDb
<?php

require_once './config.php';
use nzedb\Movie;
$page = new AdminPage();
$movie = new Movie(['Settings' => $page->settings]);
$id = 0;
// Set the current action.
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view';
if (isset($_REQUEST["id"])) {
    $id = $_REQUEST["id"];
    $mov = $movie->getMovieInfo($id);
    if (!$mov) {
        $page->show404();
    }
    switch ($action) {
        case 'submit':
            $coverLoc = nZEDb_COVERS . "movies/" . $id . '-cover.jpg';
            $backdropLoc = nZEDb_COVERS . "movies/" . $id . '-backdrop.jpg';
            if ($_FILES['cover']['size'] > 0) {
                $tmpName = $_FILES['cover']['tmp_name'];
                $file_info = getimagesize($tmpName);
                if (!empty($file_info)) {
                    move_uploaded_file($_FILES['cover']['tmp_name'], $coverLoc);
                }
            }
            if ($_FILES['backdrop']['size'] > 0) {
                $tmpName = $_FILES['backdrop']['tmp_name'];
                $file_info = getimagesize($tmpName);
                if (!empty($file_info)) {
                    move_uploaded_file($_FILES['backdrop']['tmp_name'], $backdropLoc);
예제 #12
0
파일: movie-add.php 프로젝트: kaibosh/nZEDb
<?php

require_once './config.php';
use nzedb\Movie;
$page = new AdminPage();
$movie = new Movie(['Settings' => $page->settings]);
$id = 0;
$page->title = "Movie Add";
if (isset($_REQUEST['id']) && ctype_digit($_REQUEST['id']) && strlen($_REQUEST['id']) == 7) {
    $id = $_REQUEST['id'];
    $movCheck = $movie->getMovieInfo($id);
    if (!$movCheck || isset($_REQUEST['update']) && $_REQUEST['update'] == 1) {
        if ($movie->updateMovieInfo($id)) {
            header("Location:" . WWW_TOP . "/movie-list.php");
            die;
        }
    }
}
$page->content = $page->smarty->fetch('movie-add.tpl');
$page->render();