| ]*>(.*?)<\/td>/i',$ary[1],$ary2, PREG_SET_ORDER))
{
foreach ($ary2 as $row)
{
$actor = trim(strip_tags($row[2]));
$actorid = "";
if (!empty($row[1]))
{
if (preg_match('#href="view.php\?page=person&id=([0-9]*)#i', $row[1], $idAry))
{
$actorid = $ofdbscraperIdPrefix.$idAry[1];
}
}
$character = "";
if (!empty($row[3]))
{
if (preg_match('#class="Normal">... ([^<]*)<#i', $row[3], $charAry))
{
$character = trim(strip_tags($charAry[1]));
}
}
$data['cast'] .= "$actor::$character::$actorid\n";
}
}
}
// Genres
$genres = array(
'Amateur' => '',
'Eastern' => '',
'Experimentalfilm' => '',
'Mondo' => '',
'Kampfsport' => 'Sport',
'Biographie' => 'Biography',
'Katastrophen' => 'Thriller',
'Krimi' => 'Crime',
'Science-Fiction' => 'Sci-Fi',
'Kinder-/Familienfilm' => 'Family',
'Dokumentation' => 'Documentary',
'Action' => 'Action',
'Drama' => 'Drama',
'Abenteuer' => 'Adventure',
'Historienfilm' => 'History',
'Kurzfilm' => 'Short',
'Liebe/Romantik' => 'Romance',
'Heimatfilm' => 'Romance',
'Grusel' => 'Horror',
'Horror' => 'Horror',
'Erotik' => 'Adult',
'Hardcore' => 'Adult',
'Sex' => 'Adult',
'Musikfilm' => 'Musical',
'Animation' => 'Animation',
'Fantasy' => 'Fantasy',
'Trash' => 'Horror',
'Komödie' => 'Comedy',
'Krieg' => 'War',
'Mystery' => 'Mystery',
'Thriller' => 'Thriller',
'Tierfilm' => 'Documentary',
'Western' => 'Western',
'TV-Serie' => '',
'TV-Mini-Serie' => '',
'Sportfilm' => 'Sport',
'Splatter' => 'Horror',
'Manga/Anime' => 'Animation'
);
if (preg_match('/>Genre\(s\)\:.*?(.*?)<\/b>/i', $resp['data'], $ary))
{
if (preg_match_all('/(.*?)<\/a>/i',$ary[1],$ary2, PREG_SET_ORDER))
{
foreach($ary2 as $row) {
$genre = trim(html_entity_decode($row[1]));
$genre = strip_tags($genre);
if (!$genre) continue;
if (isset($genres[$genre])) $data['genres'][] = $genres[$genre];
}
}
}
// Fetch Version
$resp = httpClient(ofdbscraperVersionUrl($id, $vid), $cache);
if (!$resp['success']) $CLIENTERROR .= $resp['error']."\n";
$resp['data'] = preg_replace('/[\r\n\t]/',' ', $resp['data']);
// FSK
$fsks = array(
'FSK o.A.' => '0',
'FSK 6' => '6',
'FSK 12' => '12',
'FSK 16' => '16',
'FSK 18' => '18',
'Keine Jugendfreigabe' => '18',
'SPIO/JK' => '18',
'juristisch geprüft' => '',
'ungeprüft' => ''
);
if (preg_match('/>Freigabe:<.*?(.*?)<\/tr>/i', $resp['data'], $ary))
{
$fsk = trim(html_entity_decode($ary[1]));
$fsk = strip_tags($fsk);
if (isset($fsks[$fsk])) $data['fsk'] = $fsks[$fsk];
}
// Languages
// Languages (as Array)
$laguages = array(
'arabisch' => 'arabic',
'bulgarisch' => 'bulgarian',
'chinesisch' => 'chinese',
'tschechisch' => 'czech',
'dänisch' => 'danish',
'holändisch' => 'dutch',
'englisch' => 'english',
'französisch' => 'french',
'deutsch' => 'german',
'griechisch' => 'greek',
'ungarisch' => 'hungarian',
'isländisch' => 'icelandic',
'indisch' => 'indian',
'israelisch' => 'israeli',
'italienisch' => 'italian',
'japanisch' => 'japanese',
'koreanisch' => 'korean',
'norwegisch' => 'norwegian',
'polnisch' => 'polish',
'portugisisch' => 'portuguese',
'rumänisch' => 'romanian',
'russisch' => 'russian',
'serbisch' => 'serbian',
'spanisch' => 'spanish',
'schwedisch' => 'swedish',
'thailändisch' => 'thai',
'türkisch' => 'turkish',
'vietnamesisch' => 'vietnamese',
'kantonesisch' => 'cantonese',
'katalanisch' => 'catalan',
'zypriotisch' => 'cypriot',
'zyprisch' => 'cypriot',
'esperanto' => 'esperanto',
'gälisch' => 'gaelic',
'hebräisch' => 'hebrew',
'hindi' => 'hindi',
'jüdisch' => 'jewish',
'lateinisch' => 'latin',
'mandarin' => 'mandarin',
'serbokroatisch' => 'serbo-croatian',
'somalisch' => 'somali'
);
$lang_list = array();
// Runtime
if (preg_match('/>Laufzeit:<.*?(.*?)\s*Min/i', $resp['data'], $ary))
{
$ary[1] = preg_replace('/:.*/','', $ary[1]);
$data['runtime'] = trim($ary[1]);
}
return $data;
}
/**
* Get Url to visit OFDB for a specific actor
*
* @author Chinamann
* @param string $name The actor's name
* @param string $id The actor's external id
* @return string The visit URL
*/
function ofdbscraperActorUrl($name, $id)
{
global $ofdbscraperServer;
global $ofdbscraperIdPrefix;
if ($id) {
$id = preg_replace('/^'.$ofdbscraperIdPrefix.'/', '', $id);
} else {
$id = ofdbscraperGetActorId($name);
}
// now we have for shure an id
return ($id!=0) ? $ofdbscraperServer.'/view.php?page=person&id='.$id : '';
}
/**
* Parses Actor-Details
*
* Find image and detail URL for actor.
*
* @author Chinamann
* @param string $name Name of the actor
* @param string $id Prefixed ofdb actor id
* @return array array with Actor-URL and Thumbnail
*/
function ofdbscraperActor($name, $id)
{
global $ofdbscraperServer;
if ($id) {
$id = preg_replace('/^'.$ofdbscraperIdPrefix.'/', '', $id);
} else {
$id = ofdbscraperGetActorId($name);
}
// now we have for shure an id
$folderId = ($id < 1000) ? 0 : substr($id,0,strlen($id)-3);
$imgUrl = $ofdbscraperServer.'/images/person/'.$folderId.'/'.$id.'.jpg';
$ary = array();
$ary[0][0] = ofdbscraperActorUrl($name, $id);
$ary[0][1] = $imgUrl;
return $ary;
}
function ofdbscraperGetActorId($name)
{
global $ofdbscraperServer;
// try to guess the id -> first actor found with this name
$url = $ofdbscraperServer.'/view.php?page=liste&Name='.urlencode(html_entity_decode_all($name));
$resp = httpClient($url, $cache);
if (!$resp['success']) $CLIENTERROR .= $resp['error']."\n";
$resp['data'] = preg_replace('/[\r\n\t]/',' ', $resp['data']);
return (preg_match('#view.php?page=person&id=([0-9]+)#i', $resp['data'], $ary)) ? $ary[1] : 0;
}
/**
* Get an array of all previous prefixes for the ImdbId
*
* @author Chinamann
* @return array Associative array with ImdbId prefixes
*/
function ofdbscraperImdbIdPrefixes()
{
global $ofdbscraperIdPrefix;
return array($ofdbscraperIdPrefix);
}
function ofdbscraperDbg($text,$append = true)
{
file_append('debug.txt', $text, $append);
}
?>
|