function testMovie2() { // Star Wars: Episode III // http://www.allocine.fr/film/fichefilm_gen_cfilm=40623.html $id = "40623"; $data = engineGetData($id, 'allocine'); #$this->assertNoErrors(); $this->assertTrue(sizeof($data) > 0); #echo '<pre>'; #dump($data); #echo '</pre>'; $this->assertEqual($data[id], 'allocine:40623'); $this->assertEqual($data[title], 'Star Wars : Episode III'); $this->assertEqual($data[subtitle], 'La Revanche des Sith'); $this->assertEqual($data[year], 2004); $this->assertEqual($data[coverurl], "http://images.allocine.fr/r_160_214/b_1_cfd7e1/medias/nmedia/18/35/53/23/18423997.jpg"); $this->assertEqual($data[runtime], 140); $this->assertEqual($data[director], 'George Lucas'); $this->assertTrue($data[rating] >= 5); $this->assertTrue($data[rating] <= 8); $this->assertEqual($data[country], 'USA'); $this->assertEqual($data[language], 'english'); sort($data[genres]); $this->assertEqual(join(',', $data[genres]), 'Action,Sci-Fi'); $this->assertPattern('/Ewan McGregor::Obi-Wan Kenobi::allocine:17043/si', $data[cast]); $this->assertPattern('/revanche/si', $data[plot]); $this->assertPattern('/Tourné/si', $data[comment]); /* Array ( [id] => allocine:40623 [title] => Star Wars : Episode III [subtitle] => La Revanche des Sith [year] => 2005 [coverurl] => http://images.allocine.fr/r_160_214/b_1_cfd7e1/medias/nmedia/18/35/53/23/18423997.jpg [runtime] => 140 [director] => George Lucas [rating] => 6.6 [country] => USA [plot] => La Guerre des Clones fait rage. Une franche hostilité oppose désormais le Chancelier Palpatine au Conseil Jedi. Anakin Skywalker, jeune Chevalier Jedi pris entre deux feux, hésite sur la conduite ?tenir. Séduit par la promesse d'un pouvoir sans précédent, tenté par le côté obscur de la Force, il prête allégeance au maléfique Darth Sidious et devient Dark Vador. Les Seigneurs Sith s'unissent alors pour préparer leur revanche, qui commence par l'extermination des Jedi. Seuls rescapés du massacre, Yoda et Obi Wan se lancent ?la poursuite des Sith. La traque se conclut par un spectaculaire combat au sabre entre Anakin et Obi Wan, qui décidera du sort de la galaxie. [genres] => Array ( [0] => Sci-Fi [1] => Action ) [cast] => Hayden Christensen::Anakin Skywalker / Dark Vador::allocine:67670 Ewan McGregor::Obi-Wan Kenobi::allocine:17043 Natalie Portman::Padmé Amidala::allocine:18066 Ian McDiarmid::le Chancelier Suprême Palpatine / Dark Sidious::allocine:52971 Samuel L. Jackson::Mace Windu::allocine:14454 Anthony Daniels::C-3PO::allocine:29807 Kenny Baker::R2-D2::allocine:12096 Peter Mayhew::Chewbacca::allocine:68258 Jimmy Smits::le sénateur Bail Organa::allocine:31186 Silas Carson::Ki-Adi Mundi / Nute Gunray::allocine:68136 [language] => english [comment] => Box Office USA : 380 270 577 $ Box Office France : 7 230 583 entrées Budget : 115 millions de dollars Couleur Format du son : Dolby SR + Digital SR-D + DTS & SDDS Format de production : HD Tourné en : Anglais ) */ }
function testMovie2() { // Boogie Nights // http://www.ofdb.de/film/1545,Boogie-Nights $id = '1545'; $data = engineGetData($id, 'ofdb'); # dump($data); $this->assertTrue(sizeof($data) > 0); $this->assertEqual($data[imdbID], 'ofdb:1545-210858'); $this->assertPattern('/Luis Guzmán/s', $data[cast]); }
function testData() { // Star Wars: Episode 1 // http://www.amazon.de/Star-Wars-Episode-Bedrohung-Einzel-DVD/dp/B0009HBEHW/ref=sr_1_2/303-6664842-9566627?ie=UTF8&s=dvd&qid=1185389090&sr=1-2 $id = 'B0009HBEHW'; $data = engineGetData($id, 'amazonaws'); #$this->assertNoErrors(); $this->assertTrue(sizeof($data) > 0); # dump($data); $this->assertPattern('/Star Wars/', $data[title]); # $this->assertEqual($data[subtitle], 'Die dunkle Bedrohung (Einzel-DVD)'); $this->assertPattern('#http://.+.images\\-amazon.com/images/#', $data[coverurl]); $this->assertEqual($data[director], 'George Lucas'); $this->assertEqual($data[language], 'deutsch, englisch'); $this->assertEqual($data[year], 2001); $this->assertTrue($data[runtime] > 100); $this->assertTrue($data[rating] >= 6); #[genres] => $this->assertPattern('/Ewan McGregor/', $data[cast]); $this->assertPattern('/Naboo/', $data[plot]); }
function testMovie() { // Star Wars: Episode I // http://www.dvdfr.com/dvd/f2869_star_wars_-_episode_i_-_la_menace_fantome.html // http://www.dvdfr.com/dvd/dvd.php?id=2869 $id = 'dvdfr:2869'; $data = engineGetData($id, 'dvdfr'); #$this->assertNoErrors(); $this->assertTrue(sizeof($data) > 0); #dump($data); /* Array ( [title] => Star Wars - Episode I - La Menace Fantôme [subtitle] => Star Wars: Episode I - The Phantom Menace [country] => USA [year] => 1999 [coverurl] => http://www.dvdfr.com/images/dvd/cover_200x280/2/2869.jpg [runtime] => 130 [director] => George Lucas [plot] => Premier volet de la nouvelle trilogie dont l'action se déroule avant les épisodes que le monde entier connaît par coeur. Faites connaissance avec Anakin Skywalker, 9 ans, en qui le jeune Obi Wan Kenobi et son maître voient "l'élu" qui apportera l'équilibre dans la force. [cast] => Liam Neeson::::dvdfr:10977 Ewan McGregor::::dvdfr:9192 Natalie Portman::::dvdfr:6177 Jake Lloyd::::dvdfr:11160 Ian McDiarmid::::dvdfr:24388 ) */ $this->assertEqual($data[title], 'Star Wars - Episode I - La Menace Fantôme'); $this->assertEqual($data[subtitle], 'Star Wars: Episode I - The Phantom Menace'); $this->assertEqual($data[year], 1999); $this->assertEqual($data[coverurl], 'http://images.dvdfr.com/images/dvd/cover_200x280/2/2869.jpg'); $this->assertEqual($data[runtime], 130); $this->assertEqual($data[director], 'George Lucas'); $this->assertEqual($data[country], 'USA'); $this->assertPattern('/Liam Neeson.*Ewan McGregor.*Natalie Portman/s', $data[cast]); $this->assertPattern('/Anakin Skywalker.*le jeune Obi Wan Kenobi/', $data[plot]); /* Array ( [title] => Star Wars: Episode I [subtitle] => The Phantom Menace [year] => 1999 [coverurl] => http://ia.imdb.com/media/imdb/01/I/47/66/60m.jpg [mpaa] => Rated PG for sci-fi action/violence. [bbfc] => U [runtime] => 133 [director] => George Lucas [rating] => 6.3 [country] => USA [language] => english [genres] => Array ( [0] => Action [1] => Adventure [2] => Fantasy [3] => Sci-Fi ) [cast] => Liam Neeson::Qui-Gon Jinn::imdb:nm0000553 Ewan McGregor::Obi-Wan Kenobi::imdb:nm0000191 Natalie Portman::Queen Padmé Amidala::imdb:nm0000204 Jake Lloyd::Anakin Skywalker::imdb:nm0005157 Pernilla August::Shmi Skywalker::imdb:nm0000278 Frank Oz::Yoda::imdb:nm0000568 Ian McDiarmid::Senator Palpatine::imdb:nm0001519 Oliver Ford Davies::Gov. Sio Bibble::imdb:nm0203882 Ray Park::Darth Maul::imdb:nm0661917 Hugh Quarshie::Capt. Panaka::imdb:nm0702934 Ahmed Best::Jar Jar Binks::imdb:nm0078886 Anthony Daniels::C-3PO::imdb:nm0000355 Kenny Baker::R2-D2::imdb:nm0048652 Terence Stamp::Supreme Chancellor Valorum::imdb:nm0000654 Brian Blessed::Boss Nass::imdb:nm0000306 Andrew Secombe::Watto::imdb:nm0781181 Lewis Macleod::Sebulba::imdb:nm0533914 Steve Speirs::Capt. Tarpals::imdb:nm0818648 Silas Carson::Viceroy Nute Gunray/Ki-Adi-Mundi/Lott Dodd/Radiant VII Pilot::imdb:nm0141324 Ralph Brown::Ric Olié::imdb:nm0114460 Celia Imrie::Fighter Pilot Bravo 5::imdb:nm0408309 Benedict Taylor::Fighter Pilot Bravo 2::imdb:nm0852028 Karol Cristina da Silva::Rabé::imdb:nm0196263 Clarence Smith::Fighter Pilot Bravo 3::imdb:nm0807734 Samuel L. Jackson::Mace Windu::imdb:nm0000168 Dominic West::Palace guard::imdb:nm0922035 Liz Wilson::Eirtaé (as Friday 'Liz' Wilson)::imdb:nm0933770 Candice Orwell::Yané::imdb:nm0651425 Sofia Coppola::Saché::imdb:nm0001068 Keira Knightley::Sabé::imdb:nm0461136 Bronagh Gallagher::Radiant VII captain::imdb:nm0302345 John Fensom::TC-14::imdb:nm0271993 Greg Proops::Beed (voice)::imdb:nm0698681 Scott Capurro::Fode::imdb:nm0135750 Margaret Towner::Jira::imdb:nm0870026 Dhruv Chanchani::Kitster::imdb:nm0151268 Oliver Walpole::Seek::imdb:nm0909488 Katie Lucas::Amee (as Jenna Green)::imdb:nm0337964 Megan Udall::Melee::imdb:nm0879818 Hassani Shapi::Eeth Koth::imdb:nm0788434 Gin Clarke::Adi Gallia (as Gin)::imdb:nm0164778 Khan Bonfils::Saesee Tiin::imdb:nm0094416 Michelle Taylor::Yarael Poof::imdb:nm1180158 Michaela Cottrell::Even Piell::imdb:nm0183169 Dipika O'Neill Joti::Depa Billaba::imdb:nm0642086 Phil Eason::Yaddle::imdb:nm0247500 Mark Coulier::Aks Moe::imdb:nm0183418 Lindsay Duncan::TC-14 (voice)::imdb:nm0242026 Peter Serafinowicz::Darth Maul (voice)::imdb:nm0784818 James Taylor::Rune Haako::imdb:nm0852511 Chris Sanders::Daultay Dofine::imdb:nm0761497 Toby Longworth::Sen. Lott Dodd/Gragra (voice)::imdb:nm0519528 Marc Silk::Aks Moe (voice)::imdb:nm0798025 Amanda Lucas::Tey How/Diva Funquita (voice) (as Tyger)::imdb:nm0878741 Amy Allen::Twi'Lek Senatorial Aide (DVD deleted scenes) (uncredited)::imdb:nm1116989 Don Bies::Pod race mechanic (uncredited)::imdb:nm0081636 Trisha Biggar::Orn Free Taa's aide (uncredited)::imdb:nm0081773 Jerome Blake::Rune Haako/Mas Amedda/Oppo Rancisis/Orn Free Taa (uncredited)::imdb:nm0086592 Ben Burtt::Naboo Courier (uncredited)::imdb:nm0123785 Doug Chiang::Flag bearer (uncredited)::imdb:nm0156956 Rob Coleman::Pod race spectator in Jabba's Private Box (uncredited)::imdb:nm0171197 Roman Coppola::Senate guard (uncredited)::imdb:nm0178910 Russell Darling::Naboo Royal Security Guard (uncredited)::imdb:nm0201402 Warwick Davis::Wald/Pod race spectator/Mos Espa Citizen (uncredited)::imdb:nm0001116 C. Michael Easton::Pod race spectator (uncredited)::imdb:nm0247694 Joss Gower::Naboo fighter pilot (uncredited)::imdb:nm0332980 Raymond Griffiths::GONK Droid (uncredited)::imdb:nm0341739 Nathan Hamill::Pod race spectator/Naboo palace guard (uncredited)::imdb:nm0357686 Tim Harrington::Extra (Naboo Security Gaurd) (uncredited)::imdb:nm0364360 Jack Haye::Pod race spectator in Jabba's Private Box (uncredited)::imdb:nm0370849 Nifa Hindes::Ann Gella (uncredited)::imdb:nm0385539 Nishan Hindes::Tann Gella (uncredited)::imdb:nm0385540 John Knoll::Lt. Rya Kirsch (Bravo 4)/Flag bearer (uncredited)::imdb:nm0461306 Kamay Lau::Sei Taria - Senators Aide (uncredited)::imdb:nm2151895 Dan Madsen::Kaadu handler (uncredited)::imdb:nm0535186 Iain McCaig::Orn Free Taa's aide (uncredited)::imdb:nm0564572 Rick McCallum::Naboo courier (uncredited)::imdb:nm0564768 Jeff Olson::Pod race spectator in Jabba's Private Box (uncredited)::imdb:nm0647926 Lorne Peterson::Mos Espa citizen (uncredited)::imdb:nm0677285 Alan Ruscoe::Plo Koon/Bib Foruna/Daultay Dofine (uncredited)::imdb:nm0750603 Steve Sansweet::Naboo courier (uncredited)::imdb:nm0763109 Mike Savva::Naboo Royal Guard (uncredited)::imdb:nm1979766 Christian Simpson::Bravo 6 (uncredited)::imdb:nm0800939 Paul Martin Smith::Naboo courier (uncredited)::imdb:nm0809551 Scott Squires::Naboo speeder driver (uncredited)::imdb:nm0820140 Tom Sylla::Battle Droid (voice) (uncredited)::imdb:nm0843143 Bill Tlusty::Chokk, Jabba's Bodyguard (uncredited)::imdb:nm0864754 Danny Wagner::Mawhonic (uncredited)::imdb:nm0905855 Matthew Wood::Bib Fortuna/Voice of Ody Mandrell (uncredited)::imdb:nm0003214 [plot] => The evil Trade Federation, led by Nute Gunray (Carson) is planning to take over the peaceful world of Naboo. Jedi's Qui-Gon Jinn (Neeson) and Obi-Wan Kenobi (McGregor) are sent to confront the leaders. But not everything goes to plan. The two Jedis escape, and along with their new Gungan friend, Jar Jar Binks (Best) head to Naboo to warn Queen Amidala (Portman), but droids have already started to capture Naboo and the Queen is not safe there. Eventually they land on Tatooine, where they become friends with a young boy known as Anakin Skywalker (Lloyd). Qui-Gon is curious about the boy, and sees a bright future for him. The group must now find a way of getting to Coruscant and to finally solve this trade dispute, but there is someone else hiding in the shadows. Are the sith really extinct? Is the Queen who she really says she is? and what's so special about this young boy? All these questions and more in the first chapter of the epic Star Wars saga. ) */ }
function FetchSaveMovie($id, $lookup) { $debug = 0; $video = runSQL('SELECT * FROM ' . TBL_DATA . ' WHERE id = ' . $id); // get fields (according to list) from db to be saved later if ($debug) { echo "\n=================== Video DB Data ============================\n"; print_r($video[0]); echo "\n=================== Video DB Data ============================\n"; } $imdbID = $video[0]['imdbID']; echo "Movie/imdb -- " . $video[0]['title'] . "/" . $video[0]['imdbID'] . "\n"; if (empty($imdbID)) { echo "No imdbID\n"; return; } if (empty($engine)) { $engine = engineGetEngine($imdbID); } if ($debug) { echo "IMDBID = {$imdbID}, engine = {$engine}\n"; } $imdbdata = engineGetData($imdbID, $engine); # removed due to performance issues of is_utf8 // fix erroneous IMDB encoding issues if (!is_utf8($imdbdata)) { echo "Applying encoding fix\n"; $imdbdata = fix_utf8($imdbdata); } if (empty($imdbdata[title])) { echo "Fetch failed , try again...\n"; $imdbdata = engineGetData($imdbID, $engine); } if (empty($imdbdata[title])) { echo "Fetch failed again , next movie"; return; } if ($debug) { echo "\n=================== IMDB Data ============================\n"; print_r($imdbdata); echo "\n=================== IMDB Data ============================\n"; } if (!empty($imdbdata[title])) { // // NOTE: comment out any of the following lines if you do not want them updated // $video[0][title] = $imdbdata[title]; $video[0][subtitle] = $imdbdata[subtitle]; $video[0][year] = $imdbdata[year]; $video[0][imgurl] = $imdbdata[coverurl]; $video[0][runtime] = $imdbdata[runtime]; $video[0][director] = $imdbdata[director]; $video[0][rating] = $imdbdata[rating]; $video[0][country] = $imdbdata[country]; $video[0][language] = $imdbdata[language]; $video[0][actors] = $imdbdata[cast]; $video[0][plot] = $imdbdata[plot]; } if (count($genres) == 0 || $lookup > 1) { $genres = array(); $gnames = $imdbdata['genres']; if (isset($gnames)) { foreach ($gnames as $gname) { // check if genre is found- otherwise fail silently if (is_numeric($genre = getGenreId($gname))) { $genres[] = $genre; } else { echo "MISSING GENRE {$gname}\n"; } } } } // custom filds , not working for now for ($i = 1; $i <= 4; $i++) { $custom = 'custom' . $i; $type = $config[$custom . 'type']; if (!empty($type)) { // copy imdb data into corresponding custom field $video[0][$custom] = $imdbdata[$type]; echo "CUSTOM {$custom} {$type} = {$imdbdata[$type]}\n"; } } // -------- SAVE $SETS = prepareSQL($video[0]); if ($debug) { echo "\n=================== Final Data ============================\n"; echo "SETS = {$SETS} \n"; echo "\n=================== Final Data ============================\n"; } $id = updateDB($SETS, $id); // save genres setItemGenres($id, $genres); // set seen for currently logged in user set_userseen($id, $seen); }
function testSeriesEpisode3() { //Pushing Daisies - Episode 3 // http://www.imdb.com/title/tt1039379/ $id = '1039379'; $data = engineGetData($id, 'imdb'); // was not detected as tv episode $this->assertEqual($data['istv'], 1); $this->assertTrue($data['runtime'] >= 40); $this->assertTrue($data['runtime'] <= 50); }
if (isset(${$tempFieldName}) && ${$tempFieldName} == 1) { $overwrites[] = $field; } } $imdb_set_fields = $overwrites; // valid input values for lookup > 2 are either 5 (add missing) or 6 (overwrite) $lookup -= 4; } // lookup imdb if ($lookup && $imdbID) { // get engine from id if (empty($engine)) { $engine = engineGetEngine($imdbID); } // get external data $imdbdata = engineGetData($imdbID, $engine); // lookup cover if (empty($imgurl) || $lookup > 1) { $imgurl = $imdbdata['coverurl']; } // lookup genres if (count($genres) == 0 || $lookup > 1) { $genres = array(); $gnames = $imdbdata['genres']; if (isset($gnames)) { foreach ($gnames as $gname) { // check if genre is found- otherwise fail silently if (is_numeric($genre = getGenreId($gname))) { $genres[] = $genre; } }
// matching at least required year? if (!empty($required_year) && (int) $year < $required_year) { continue; } } if (empty($rating) || $rating >= $required_rating) { $available = count(runSQL("SELECT * FROM " . TBL_DATA . " WHERE imdbID = '{$id}'")) > 0; if ($available) { $add_movie = $title; } else { $add_movie = '<a class="green" href="../edit.php?save=1&mediatype=' . MEDIA_WISHLIST . '&lookup=1&imdbID=' . $id . '&title=' . urlencode($title) . '" target="_blank">' . $title . ' <img src="../images/add.gif" border="0"/></a>'; } $add_movie = 'Recommended: ' . $add_movie . " (IMDB Id {$id}) {$rating}<br/>\n"; echo $add_movie; if ($download && !$available) { engineGetData($id); } } } } echo "<br/>\n\n"; } } else { ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?> "> <table> <tr valign="top"> <td>
echo " <tr>"; echo " <th>Title</th> <th>Year</th> <th>Rating</th> <th>Id</th>"; echo " </tr>"; foreach ($data as $recommended) { $available = count(runSQL("SELECT * FROM " . TBL_DATA . " WHERE imdbID like '%" . $recommended['id'] . "'")) > 0; if (!$available) { $recommended['title'] = '<a class="green" href="../edit.php?save=1&mediatype=' . MEDIA_WISHLIST . '&lookup=1&imdbID=' . $recommended['id'] . '&title=' . urlencode($recommended['title']) . '" target="_blank">' . $recommended['title'] . ' <img src="../images/add.gif" border="0"/></a>'; } echo "<tr>"; echo "<td align=left width=\"65%\">{$recommended['title']}</td>"; echo "<td align=right width=\"10%\">{$recommended['year']}</td>"; echo "<td align=right width=\"10%\">{$recommended['rating']}</td>"; echo "<td align=right width=\"15%\">{$recommended['id']}</td>"; echo "</tr>"; if ($download && !$available) { engineGetData($recommended['id']); } } echo "</table>"; echo "<br/>"; } } else { ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?> "> <table> <tr valign="top"> <td> Limit to movies to no earlier then
function InsertMovie($imdb_id, &$ret_title, $seen, $mediatype) { $imdb_set_fields = array('md5', 'title', 'subtitle', 'language', 'diskid', 'mediatype', 'comment', 'disklabel', 'imdbID', 'year', 'imgurl', 'director', 'actors', 'runtime', 'country', 'plot', 'filename', 'filesize', 'filedate', 'audio_codec', 'video_codec', 'video_width', 'video_height', 'istv', 'custom1', 'custom2', 'custom3', 'custom4'); //fetching all the data $imdbdata = engineGetData($imdb_id); if ($imdbdata['title'] == '') { return 0; } //sorting needed things //genres-------------------------- $genres = array(); $gnames = $imdbdata['genres']; if (isset($gnames)) { foreach ($gnames as $gname) { // check if genre is found- otherwise fail silently if (is_numeric($genre = getGenreId($gname))) { $genres[] = $genre; } } } //-------------------------------- //actors $actors = $imdbdata['cast']; //movie owner--------------------- if (check_permission(PERM_WRITE, $_COOKIE['VDBuserid'])) { $owner_id = $_COOKIE['VDBuserid']; } else { $owner_id = 0; } //-------------------------------- //cover $imgurl = $imdbdata['coverurl']; // lookup all other fields foreach (array_keys($imdbdata) as $name) { if (in_array($name, array('coverurl', 'genres', 'cast', 'id'))) { continue; } ${$name} = $imdbdata[$name]; } //year if (empty($year)) { $year = '0000'; } // set owner if (!empty($owner_id)) { $SETS = 'owner_id = ' . addslashes($owner_id); } $imdbID = $imdb_id; // update all fields according to list foreach ($imdb_set_fields as $name) { // sanitize input ${$name} = removeEvilTags(${$name}); // make sure no formatting contained in basic data if (in_array($name, array('title', 'subtitle'))) { ${$name} = trim(strip_tags(${$name})); // string leading articles? if ($config['removearticles']) { foreach ($articles as $article) { if (preg_match("/^{$article}+/i", ${$name})) { ${$name} = trim(preg_replace("/(^{$article})(.+)/i", "\$2, \$1", ${$name})); break; } } } } $SET = "{$name} = '" . addslashes(${$name}) . "'"; if (empty(${$name})) { if (in_array($name, $db_null_fields)) { $SET = "{$name} = NULL"; } elseif (in_array($name, $db_zero_fields)) { $SET = "{$name} = 0"; } } if ($SETS) { $SETS .= ', '; } $SETS .= $SET; } //inserting into database-------------------- $INSERT = 'INSERT INTO ' . TBL_DATA . ' SET ' . $SETS . ', created = NOW()'; //print_r($INSERT); //echo "<br><br>"; $id = runSQL($INSERT); // save genres setItemGenres($id, $genres); //------------------------------------------- // insert userseen data $INSERTSEEN = 'INSERT INTO `userseen` (`video_id`, `user_id`) VALUES (' . $id . ',' . $owner_id . ')'; runSQL($INSERTSEEN); $ret_title = $title; return 1; }