Commit 15cfa454 authored by Nico Schallehn's avatar Nico Schallehn

test

parent 33a7003f
...@@ -45,6 +45,11 @@ class Media { ...@@ -45,6 +45,11 @@ class Media {
} }
} }
public function config_show(){ public function config_show(){
}
public function config($Action){
switch ($Action){
case "show":
//var_dump($this->config); //var_dump($this->config);
echo $this->Console->getColoredString("Folgende Config ist geladen:","black", "light_gray").PHP_EOL.PHP_EOL; echo $this->Console->getColoredString("Folgende Config ist geladen:","black", "light_gray").PHP_EOL.PHP_EOL;
echo "Config erstellt: ".date("H:i:s d.m.Y ",$this->config["configChangeTime"]) .PHP_EOL; echo "Config erstellt: ".date("H:i:s d.m.Y ",$this->config["configChangeTime"]) .PHP_EOL;
...@@ -52,21 +57,34 @@ class Media { ...@@ -52,21 +57,34 @@ class Media {
if($value["HDDdir"] != NULL){ if($value["HDDdir"] != NULL){
echo "HDD ".$key.": Mount: ".$value["HDDdir"].PHP_EOL; echo "HDD ".$key.": Mount: ".$value["HDDdir"].PHP_EOL;
echo " FolderFilme: ".$value["FolderFilme"].PHP_EOL; echo " FolderFilme: ".$value["FolderFilme"].PHP_EOL;
echo " Folder3D : ".$value["Folder3D"].PHP_EOL.PHP_EOL; echo " Folder3D : ".$value["Folder3D"].PHP_EOL;
} }
} }
echo PHP_EOL; echo PHP_EOL;
return 0; return 0;
} break;
public function config_save(){ case "save":
$dateihandle = fopen($this->configfile,"w"); $dateihandle = fopen($this->configfile,"w");
fwrite($dateihandle, json_encode($this->config, JSON_PRETTY_PRINT)); fwrite($dateihandle, json_encode($this->config, JSON_PRETTY_PRINT));
fclose($dateihandle); fclose($dateihandle);
break;
}
}
public function filme(){
//var_dump($this->config);
echo $this->Console->getColoredString("Folgende Config ist geladen:","black", "light_gray").PHP_EOL.PHP_EOL;
echo "Config erstellt: ".date("H:i:s d.m.Y ",$this->config["configChangeTime"]) .PHP_EOL;
foreach ($this->config["HDD"] as $key => $value) {
if($value["HDDdir"] != NULL){
echo "HDD ".$key.": Mount: ".$value["HDDdir"].PHP_EOL;
echo " FolderFilme: ".$value["FolderFilme"].PHP_EOL;
echo " Folder3D : ".$value["Folder3D"].PHP_EOL;
}
}
echo PHP_EOL;
return 0;
} }
......
...@@ -8,14 +8,8 @@ $Console->clearscreen(); ...@@ -8,14 +8,8 @@ $Console->clearscreen();
$Media = new Media("config.json"); $Media = new Media("config.json");
$exit = false; $exit = false;
do{ do{
echo $Console->getColoredString("Benutzung:", "black", "light_gray") .PHP_EOL.PHP_EOL; echo $Console->getColoredString("Benutzung:", "black", "light_gray") .PHP_EOL.PHP_EOL;
...@@ -29,16 +23,15 @@ do{ ...@@ -29,16 +23,15 @@ do{
$name = trim(fgets(STDIN)); $name = trim(fgets(STDIN));
$Console->clearscreen(); $Console->clearscreen();
//echo "Hallo $name \n"; //echo "Hallo $name \n";
switch ($name){ $nameArr = explode(" ", $name);
switch ($name[0]){
case "filme": case "filme":
echo $Console->getColoredString("Filme", "black", "light_gray") .PHP_EOL; echo $Console->getColoredString("Filme", "black", "light_gray") .PHP_EOL;
break; break;
case "config save": case "config":
$Media->config_save(); $Media->config($name[1]);
break;
case "config show":
$Media->config_show();
break; break;
case "exit": case "exit":
$exit = true; $exit = true;
......
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