2010-03-29, 10:51
It looks like a bug in XBMC. But they are refactoring scrapers to add-ons so i don't know if they will fix it soon.
Enochian Wrote:Hi,
Due to the lightning strike my last post got deleted, so I'm reposting it:
I finally found some time to do the following changes to my scraper:
- Added scraping of apple movie trailers
- Added setting to select apple trailer quality (480p, 720p, 1080p)
- Added nfo support
- small bug fix with movie year
If you enable both youtube and apple trailers, the youtube trailer will be used as backup if no apple trailer is found.
The nfo support will search for a moviemeter url in .nfo files, if it finds one it will use this movie for scraping, if not is will search the normal way.
You can download it here: http://www.megaupload.com/?d=W2J04Q11
Quote:<?php
//search
$search = strtolower($_GET["search"]);
//Movie and year separation
if(preg_match("#(.*)\(([0-9]{4})\)#", $search, $match)){
$movie = $match[1];
$year = $match[2];
} else {
$movie = $search;
}
//Movie title fix for search
if(preg_match("#the #", $movie)){
$movie = str_replace("the ", "", $movie).", the";
}
//Movie title fixes
if($movie == "neverending story, the"){
$movie = "the neverending story";
}
//Movie followup
if(preg_match("# 2#", $movie)){
$followup = "2";
} else if(preg_match("# 3#", $movie)){
$followup = "3";
} else if(preg_match("# 4#", $movie)){
$followup = "4";
} else if(preg_match("# 5#", $movie)){
$followup = "5";
} else if(preg_match("# 6#", $movie)){
$followup = "6";
} else if(preg_match("# 7#", $movie)){
$followup = "7";
} else if(preg_match("# 8#", $movie)){
$followup = "8";
} else if(preg_match("# VII#", $movie)){
$followup = "VII";
} else if(preg_match("# VI#", $movie)){
$followup = "VI";
} else if(preg_match("# V#", $movie)){
$followup = "V";
} else if(preg_match("# IV#", $movie)){
$followup = "IV";
} else if(preg_match("# III#", $movie)){
$followup = "III";
} else if(preg_match("# II#", $movie)){
$followup = "II";
} else {
$followup = "";
}
?>
<?php
require("xmlrpc.inc");
require("xmlrpcs.inc");
require("xmlrpc_wrappers.inc");
//-----------------------------------------------------------------------------------------------
// Default config
//-----------------------------------------------------------------------------------------------
$client = new xmlrpc_client("http://www.moviemeter.nl/ws");
$client->return_type = 'phpvals';
$api_key = 'the_api_key for moviemeter api!';
//-----------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------
// Set Session
//-----------------------------------------------------------------------------------------------
$message = new xmlrpcmsg("api.startSession", array(new xmlrpcval($api_key, "string")));
$resp = $client->send($message);
if($resp->faultCode()) {
die('error: '. $resp->faultString());
} else {
$session_info = $resp->value();
$session_key = $session_info['session_key'];
}
//-----------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------
// Search film output $results
//-----------------------------------------------------------------------------------------------
$message = new xmlrpcmsg("film.search", array(new xmlrpcval($session_key, "string"), new xmlrpcval($movie, "string")));
$resp = $client->send($message);
if($resp->faultCode()) {
die('error: '. $resp->faultString());
} else {
$results = $resp->value();
// if 1 result
if(count($results) == 1){
$matches = "<a href=movie.php?id=".$results[0]["filmId"].">".$results[0]["title"]." (".$results[0]["year"].")</a><br>";
// more then 1 result
} else {
foreach($results as $k => $v){
// match on title
if(strtolower($results[$k]["title"]) == $movie){
$matches_title[] = $results[$k]["year"]."|"."<a href=movie.php?id=".$results[$k]["filmId"].">".$results[$k]["title"]." (".$results[$k]["year"].")</a><br>";
// match on alternative_title
} else if(strtolower($results[$k]["alternative_title"]) == $movie){
$matches_title[] = $results[$k]["year"]."|"."<a href=movie.php?id=".$results[$k]["filmId"].">".$results[$k]["alternative_title"]." (".$results[$k]["year"].")</a><br>";
// match on title + alternative_title
} else if(strtolower($results[$k]["alternative_title"])." ".strtolower($results[$k]["title"]) == $movie){
$matches_title[] = "<a href=movie.php?id=".$results[$k]["filmId"].">".$results[$k]["title"]." (".$results[$k]["year"].")</a><br>";
// match on part of title if $followup is found
} else if($followup <> "" && preg_match("#".$movie."#", strtolower($results[$k]["title"]))){
$matches_title[] = "<a href=movie.php?id=".$results[$k]["filmId"].">".$results[$k]["title"]." (".$results[$k]["year"].")</a><br>";
// match on year if given
} else if($v["year"] == $year && $year <> ""){
$matches_year[] = "<a href=movie.php?id=".$results[$k]["filmId"].">".$results[$k]["title"]." (".$results[$k]["year"].")</a><br>";
// others
} else if($year == ""){
$matches_overig[] = $results[$k]["year"]."|"."<a href=movie.php?id=".$results[$k]["filmId"].">".$results[$k]["title"]." (".$results[$k]["year"].")</a><br>";
}
}
}
// output matches
if($matches <> ""){
echo $matches;
} else if($matches_title <> "" && count($matches_title) > 0){
rsort($matches_title);
foreach($matches_title as $k=>$v){
$org = $v;
$v = explode("|", $v);
$v = $v[1];
if($v == ""){
$v = $org;
}
echo $v;
}
} else if($matches_year <> "" && count($matches_year) > 0){
foreach($matches_year as $k=>$v){
echo $v;
}
} else if($matches_overig <> "" && count($matches_overig) > 0){
rsort($matches_overig);
foreach($matches_overig as $k=>$v){
$v = explode("|", $v);
$v = $v[1];
echo $v;
}
}
}
//-----------------------------------------------------------------------------------------------
?>
redje Wrote:did any of you manage to get the trailer button working with moviemeter? As far as i can see no trailer-links are being downloaded into the database. Would this be possible....other scrapers seem to be using this feature of xbmc. Would be nice to integrate them into the library....thnx