Пример #1
0
 public function Step2()
 {
     if (!isset($_GET['q'])) {
         AddMovie::Step1('invalid-searchterm');
         exit;
     }
     $search = new imdbsearch();
     $search->setsearchname($_GET['q']);
     $results = $search->results();
     $tpl = new Template(DOCUMENT_ROOT . '_templates/add-movie.tpl');
     $content = new Template(DOCUMENT_ROOT . '_templates/step-2.tpl');
     $content->set('results', $results);
     $tpl->set('content', $content);
     echo $tpl->fetch();
 }
Пример #2
0
        if ($_GET["searchtype"] == "episode") {
            $search->search_episodes(TRUE);
        } else {
            $search->search_episodes(FALSE);
        }
        $headname = "Movie";
        break;
}
$search->setsearchname($_GET["name"]);
echo "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>\n";
echo "<HTML><HEAD>\n";
echo " <TITLE>Performing search for '" . $_GET["name"] . "' [IMDBPHP2 v" . $search->version . "]</TITLE>\n";
echo " <STYLE TYPE='text/css'>body,td,th,h2 { font-size:12px; font-family:sans-serif; } th { background-color:#ffb000; } h2 { text-align:center; font-size:15px; margin-top: 20px; margin-bottom:0; }</STYLE>\n";
echo "</HEAD><BODY>\n";
echo "<H2>[IMDBPHP2 v" . $search->version . " Demo] Search results for '" . $_GET['name'] . "':</H2>\n";
$results = $search->results();
echo "<TABLE ALIGN='center' BORDER='1' STYLE='border-collapse:collapse;margin-top:20px;'>\n" . " <TR><TH>{$headname} Details</TH><TH>IMDB page</TH><TH>Pilot page</TH></TR>";
foreach ($results as $res) {
    switch ($_GET["searchtype"]) {
        case "nm":
            $details = $res->getSearchDetails();
            if (!empty($details)) {
                $hint = " (" . $details["role"] . " in <a href='imdb.php?mid=" . $details["mid"] . "'>" . $details["moviename"] . "</a> (" . $details["year"] . "))";
            }
            echo " <TR><TD><a href='person.php?mid=" . $res->imdbid() . "'>" . $res->name() . "</a>{$hint}</TD>" . "<TD><a href='http://" . $search->imdbsite . "/title/nm" . $res->imdbid() . "'>imdb page</a></TD></TR>\n";
            break;
        default:
            echo " <TR><TD><a href='movie.php?mid=" . $res->imdbid() . "&engine=" . $_GET["engine"] . "'>" . $res->title() . " (" . $res->year() . ")</a></TD>" . "<TD><a href='http://" . $search->imdbsite . "/title/tt" . $res->imdbid() . "'>imdb page</a></TD>" . "<TD><a href='http://www.moviepilot.de/movies/imdb-id-" . (int) $res->imdbid() . "'>pilot page</a></TD></TR>\n";
            break;
    }
}
Пример #3
0
// Automatic update?
$autoupdate = isset($_GET["autoupdate"]);
$Website->assign("autoupdate", $autoupdate);
// Find movies from IMDb
if (isset($_GET["imdbsearch"])) {
    // What is the search term?
    $imdbsearch = trim($_GET["imdbsearch"]);
    $Website->assign("imdbsearch", $imdbsearch);
    if (strlen($imdbsearch) > 0) {
        // IMDB engine
        require_once $loc . "/lib/imdbphp/imdb.class.php";
        require_once $loc . "/lib/imdbphp/imdbsearch.class.php";
        // Search IMDb for the movie
        $imdb = new imdbsearch();
        $imdb->setsearchname($imdbsearch);
        $imdbresults = $imdb->results();
        // Check if any of these results are allready added to our database
        $temp = array();
        foreach ($imdbresults as $result) {
            $result->known = false;
            $imdbmovie = $moviedm->getByImdb($result->imdbid());
            if ($imdbmovie) {
                $result->known = true;
            }
            $temp[] = $result;
        }
        $imdbresults = $temp;
        $Website->assign("imdbresults", $imdbresults);
    }
}
// Update movie
Пример #4
0
 public function executeImdb(sfWebRequest $request)
 {
     ini_set('display_errors', false);
     if ($request->getParameter("flag") == 'search') {
         $search = new imdbsearch();
         $search->setsearchname($request->getPostParameter("title"));
         $this->results = $search->results();
         $this->anime = Doctrine::getTable('Anime')->findOneByTitle($request->getPostParameter("title"));
     } else {
         if ($request->getParameter("flag") == 'get') {
             $util = new Util();
             $result = new imdb($request->getPostParameter("imdbID"));
             $this->imdb = $util->getAnimeInfoFromImdb($result);
             $this->anime = Doctrine::getTable('Anime')->findOneByTitle($request->getPostParameter("title"));
             $this->setTemplate('edit');
         }
     }
 }
Пример #5
0
 function queryListing($page_no, $items_per_page, $offset, $s_item_type, $search_vars_r)
 {
     if (strlen($search_vars_r['imdb_id']) > 0) {
         $this->addListingRow(NULL, NULL, NULL, array('imdb_id' => $search_vars_r['imdb_id']));
         return TRUE;
     } else {
         if ($this->_site_plugin_conf_r['title_search_faster_alternate'] != 'TRUE') {
             $imdbsearch = new imdbsearch();
             $imdbsearch->setsearchname($search_vars_r['title']);
             $this->results = $imdbsearch->results();
             if (is_array($this->results)) {
                 foreach ($this->results as $res_id => $res) {
                     if (starts_with($res->photo(), '/images/nopicture')) {
                         $image = NULL;
                     } else {
                         $image = $res->photo();
                     }
                     $this->addListingRow($res->title(), $image, $res->year(), array('imdb_id' => $res->imdbid(), 'res_id' => $res_id));
                 }
                 return TRUE;
             } else {
                 return FALSE;
             }
         } else {
             $pageBuffer = $this->fetchURI("http://www.imdb.com/find?q=" . rawurlencode(strtolower($search_vars_r['title'])) . ";more=tt");
             if (strlen($pageBuffer) > 0) {
                 if (preg_match("!http://us.imdb.com/title/tt([^/]+)/!", $this->getFetchedURILocation(), $regs)) {
                     $this->addListingRow(NULL, NULL, NULL, array('imdb_id' => $regs[1]));
                     return TRUE;
                 } else {
                     //<h1 class="findHeader">Results for <span class="findSearchTerm">"prometheus;more=tt"</span></h1>
                     if (strpos($pageBuffer, "<h1 class=\"findHeader\">Results for <span class=\"findSearchTerm\">") !== FALSE) {
                         //<tr class="findResult odd">
                         //<td class="primary_photo"> <a href="/title/tt1256632/?ref_=fn_al_tt_2" ><img src="http://ia.media-imdb.com/images/G/01/imdb/images/nopicture/32x44/film-3119741174._V397576370_.png" /></a> </td>
                         //<td class="result_text"> <a href="/title/tt2411516/?ref_=fn_al_tt_6" >Prometheus Trap</a> (2012) </td>
                         //</tr>
                         if (($idx = strpos($pageBuffer, "<table class=\"findList\">")) !== FALSE) {
                             $pageBuffer = substr($pageBuffer, $idx);
                             $idx = strpos($pageBuffer, "</table>");
                             $pageBuffer = substr($pageBuffer, 0, $idx);
                             if (preg_match_all("/<tr class=\"findResult[^\"]*\">.*?<\\/tr>/m", $pageBuffer, $matches)) {
                                 for ($i = 0; $i < count($matches[0]); $i++) {
                                     if (preg_match("/<td class=\"primary_photo\">[\\s]*<a href=\"[^\"]*\"[\\s]*>[\\s]*<img src=\"([^\"]*)\"[^>]*>[\\s]*<\\/a>[\\s]*<\\/td>/m", $matches[0][$i], $lmatches)) {
                                         $image = trim($lmatches[1]);
                                     }
                                     if (preg_match("/<td class=\"result_text\">[\\s]*<a href=\"\\/title\\/tt([0-9]+)[^\"]*\"[\\s]*>([^<]+)<\\/a>[\\s]*([^<]+)</m", $matches[0][$i], $lmatches)) {
                                         $imdb_id = trim($lmatches[1]);
                                         $title = trim($lmatches[2]) . " " . trim($lmatches[3]);
                                     }
                                     $this->addListingRow($title, $image, NULL, array('imdb_id' => $imdb_id));
                                 }
                             }
                         }
                         $pageBuffer = NULL;
                         return TRUE;
                     }
                 }
                 //else no results found
                 return TRUE;
             } else {
                 return FALSE;
             }
         }
     }
 }