Commit 8c4669b7 authored by Nico Schallehn's avatar Nico Schallehn

test mit serien und mediainfo

parent df28eafc
......@@ -343,6 +343,64 @@ class Media {
echo "Not Found!".PHP_EOL;
}
}
private function gibMediaInfo($Datei, &$DataArray){
$array["size"] = $this->getfileSize($Datei);
if(!file_exists('/tmp/'.$array["imdbID"].(!$array["3d"]==""?"3d":"").'.xml')){
$befehl = 'mediainfo --Output=XML "'.$Datei.'" > /tmp/'.$array["imdbID"].(!$array["3d"]==""?"3d":"").(isset($array["Season"])?"S".$array["Season"]."E".$array["Episode"]:"").'.xml';
exec($befehl);
}
$xmlstring = file_get_contents('/tmp/'.$array["imdbID"].(!$array["3d"]==""?"3d":"").(isset($array["Season"])?"S".$array["Season"]."E".$array["Episode"]:"").'.xml'); //TODO Testen ob 3d Geht....
$xml = simplexml_load_string($xmlstring);
$json = json_encode($xml,JSON_PRETTY_PRINT);
$array2 = json_decode($json,TRUE);
foreach ($array2["File"]["track"] as $key => $value) {
//echo " ".$key." ".$value["@attributes"]["type"].PHP_EOL;
switch ($value["@attributes"]["type"]) {
case "General":
$array["vcodec"] = str_replace("Matroska", "mkv", $value["Format"]);
$array["duration"] = $this->getRunTime($value["Duration"]);
$array["totalbitrate"] = round(trim(str_replace(" ", "",str_replace("Mbps", "", $value["Overall_bit_rate"])))*1024,0);
break;
case "Video":
$array["width"] = trim(str_replace(" ", "",str_replace("pixels", "",$value["Width"])));
//TODO Resolution aus diesen werten neusetzen
$array["height"] = trim(str_replace(" ", "",str_replace("pixels", "",$value["Height"])));
break;
case "Audio":
if(isset($value["Language"])){
if(($value["Language"] == "Deutsch") OR ($value["Language"] == "German")){
$array["acodecger"] = $value["Format"];
$array["abitrateger"] = round(trim(str_replace(" ", "",str_replace("Kbps", "",$value["Bit_rate"]))),0);
$array["channelsger"] = str_replace(" channels", "",$value["Channel_s_"]);
if(!is_numeric($array["channelsger"])){
$array["channelsger"] = substr($array["channelsger"],strripos( $array["channelsger"],"/")+1);
if(!is_numeric($array["channelsger"])){
echo $this->Console->error("channelsger ist nicht Numerisch!").PHP_EOL;
file_put_contents("./phpTestout/imdbID/".$array["imdbID"].".txt", "channelsger ist nicht Numerisch!".PHP_EOL, FILE_APPEND);
return false;
}
}
}
else if(($value["Language"] == "Englisch") OR ($value["Language"] == "English")){
$array["acodeceng"] = $value["Format"];
$array["abitrateeng"] = round(trim(str_replace(" ", "",str_replace("Kbps", "",$value["Bit_rate"]))),0);
$array["channelseng"] = str_replace(" channels", "",$value["Channel_s_"]);
if(!is_numeric($array["channelseng"])){
$array["channelseng"] = substr($array["channelseng"],strripos( $array["channelseng"],"/")+1);
if(!is_numeric($array["channelseng"])){
echo $this->Console->error("channelseng ist nicht Numerisch!").PHP_EOL;
file_put_contents("./phpTestout/imdbID/".$array["imdbID"].".txt", "channelseng ist nicht Numerisch!".PHP_EOL, FILE_APPEND);
return false;
}
}
}
}
break;
}
}
}
/**
* @param imdbID
* @param DataArray
......@@ -477,6 +535,17 @@ class Media {
}
echo "imdbID: ".$array["imdbID"].">".$array["Season"].">".$array["Episode"].PHP_EOL;
if(!($minimal =="nfo")){
if(($minimal =="check") OR ($minimal =="einlesen")){
}
if(($minimal =="checkfile") OR ($minimal =="einlesen")){
echo " Hole Daten von mediainfo... ";
$array = gibMediaInfo($Pfad.$Filename,$array);
echo " done!".PHP_EOL;
}
}
return $array;
}
......@@ -578,60 +647,8 @@ class Media {
if(($minimal =="checkfile") OR ($minimal =="einlesen")){
// werte von MediaInfo holen...
echo " Hole Daten von mediainfo... ";
$array["size"] = $this->getfileSize($Pfad.$FilenameOrg);
if(!file_exists('/tmp/'.$array["imdbID"].(!$array["3d"]==""?"3d":"").'.xml')){
$befehl = 'mediainfo --Output=XML "'.$Pfad.$FilenameOrg.'" > /tmp/'.$array["imdbID"].(!$array["3d"]==""?"3d":"").'.xml';
exec($befehl);
}
$xmlstring = file_get_contents('/tmp/'.$array["imdbID"].(!$array["3d"]==""?"3d":"").'.xml'); //TODO Testen ob 3d Geht....
$xml = simplexml_load_string($xmlstring);
$json = json_encode($xml,JSON_PRETTY_PRINT);
$array2 = json_decode($json,TRUE);
foreach ($array2["File"]["track"] as $key => $value) {
//echo " ".$key." ".$value["@attributes"]["type"].PHP_EOL;
switch ($value["@attributes"]["type"]) {
case "General":
$array["vcodec"] = str_replace("Matroska", "mkv", $value["Format"]);
$array["duration"] = $this->getRunTime($value["Duration"]);
$array["totalbitrate"] = round(trim(str_replace(" ", "",str_replace("Mbps", "", $value["Overall_bit_rate"])))*1024,0);
break;
case "Video":
$array["width"] = trim(str_replace(" ", "",str_replace("pixels", "",$value["Width"])));
//TODO Resolution aus diesen werten neusetzen
$array["height"] = trim(str_replace(" ", "",str_replace("pixels", "",$value["Height"])));
break;
case "Audio":
if(isset($value["Language"])){
if(($value["Language"] == "Deutsch") OR ($value["Language"] == "German")){
$array["acodecger"] = $value["Format"];
$array["abitrateger"] = round(trim(str_replace(" ", "",str_replace("Kbps", "",$value["Bit_rate"]))),0);
$array["channelsger"] = str_replace(" channels", "",$value["Channel_s_"]);
if(!is_numeric($array["channelsger"])){
$array["channelsger"] = substr($array["channelsger"],strripos( $array["channelsger"],"/")+1);
if(!is_numeric($array["channelsger"])){
echo $this->Console->error("channelsger ist nicht Numerisch!").PHP_EOL;
file_put_contents("./phpTestout/imdbID/".$array["imdbID"].".txt", "channelsger ist nicht Numerisch!".PHP_EOL, FILE_APPEND);
return false;
}
}
}
else if(($value["Language"] == "Englisch") OR ($value["Language"] == "English")){
$array["acodeceng"] = $value["Format"];
$array["abitrateeng"] = round(trim(str_replace(" ", "",str_replace("Kbps", "",$value["Bit_rate"]))),0);
$array["channelseng"] = str_replace(" channels", "",$value["Channel_s_"]);
if(!is_numeric($array["channelseng"])){
$array["channelseng"] = substr($array["channelseng"],strripos( $array["channelseng"],"/")+1);
if(!is_numeric($array["channelseng"])){
echo $this->Console->error("channelseng ist nicht Numerisch!").PHP_EOL;
file_put_contents("./phpTestout/imdbID/".$array["imdbID"].".txt", "channelseng ist nicht Numerisch!".PHP_EOL, FILE_APPEND);
return false;
}
}
}
}
break;
}
}
$array = gibMediaInfo($Pfad.$FilenameOrg,$array);
echo " done!".PHP_EOL;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment