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

test

parent 33a7003f
......@@ -45,6 +45,33 @@ class Media {
}
}
public function config_show(){
}
public function config($Action){
switch ($Action){
case "show":
//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;
break;
case "save":
$dateihandle = fopen($this->configfile,"w");
fwrite($dateihandle, json_encode($this->config, JSON_PRETTY_PRINT));
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;
......@@ -52,21 +79,12 @@ class Media {
if($value["HDDdir"] != NULL){
echo "HDD ".$key.": Mount: ".$value["HDDdir"].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;
return 0;
}
public function config_save(){
$dateihandle = fopen($this->configfile,"w");
fwrite($dateihandle, json_encode($this->config, JSON_PRETTY_PRINT));
fclose($dateihandle);
return 0;
}
......
......@@ -8,14 +8,8 @@ $Console->clearscreen();
$Media = new Media("config.json");
$exit = false;
do{
echo $Console->getColoredString("Benutzung:", "black", "light_gray") .PHP_EOL.PHP_EOL;
......@@ -28,17 +22,16 @@ do{
echo "Bitte Befehl eingeben: ";
$name = trim(fgets(STDIN));
$Console->clearscreen();
//echo "Hallo $name \n";
switch ($name){
//echo "Hallo $name \n";
$nameArr = explode(" ", $name);
switch ($name[0]){
case "filme":
echo $Console->getColoredString("Filme", "black", "light_gray") .PHP_EOL;
break;
case "config save":
$Media->config_save();
break;
case "config show":
$Media->config_show();
case "config":
$Media->config($name[1]);
break;
case "exit":
$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