VLC
|
getURL('http://localhost/popup/app_mediabrowser.html?play=Ly4vcmFpbi8', 0);
//$play_terminal = "MAIN";
//$url=BASE_URL.ROOTHTML.'popup/app_mediabrowser.html?ajax=1&play_terminal='.$play_terminal.'&command=play&play=Ly4vcmFpbi8';
//getURL($url, 0);
|
test
|
getURL ("http://192.168.1.206:7070/requests/status.xml?command=app_mediabrowser.html?play=Ly4vcmFpbi8");
|
timeNow
|
|
Volume VLC media 50%
|
$play_terminal = "MEDIA";
$url=BASE_URL.ROOTHTML.'popup/app_player.html?ajax=1&play_terminal='.$play_terminal.'&command=volume&volume=50';
getURL($url, 0);
|
Volume VLC MEDIA 75%
|
$play_terminal = "MEDIA";
$url=BASE_URL.ROOTHTML.'popup/app_player.html?ajax=1&play_terminal='.$play_terminal.'&command=volume&volume=75';
getURL($url, 0);
|
Volume40
|
$vol=40;
exec("amixer -c 0 set 'Line Out',0 ". $vol. "%");
say("Моя громкость изменилась до ".$vol." процентов",2);
|
Volume80
|
$vol=80;
exec("amixer -c 0 set 'Line Out',0 ". $vol. "%");
say("Моя громкость изменилась до ".$vol." процентов",2);
|
Виключення MEEDIA
|
getURL ("http://192.168.1.159:1234/poweroff");
|
Вимкнення
|
$filename = ROOT . '/database_backup/db.sql';
$mysqlDumpPath = '/usr/bin/mysqldump';
$mysqlDumpParam = ' --user=' . DB_USER . ' --password=' . DB_PASSWORD;
$mysqlDumpParam .= ' --no-create-db --add-drop-table --databases ' . DB_NAME;
if (file_exists($filename)) rename($filename, $filename . '.prev');
exec($mysqlDumpPath . $mysqlDumpParam . ' > ' . $filename);
say('Подготовка к выключению', 2);
setTimeout('shutdownTimer',"safe_exec('shutdown -h now');", 15);
|
гучність MEDIA 30%
|
getURL ("http://192.168.1.159:1234/set?vol=30");
|
гучність MEDIA 50%
|
getURL ("http://192.168.1.159:1234/set?vol=50");
|
Король и Шут
|
$play_terminal = "MEDIA";
$url=BASE_URL.ROOTHTML.'popup/app_player.html?ajax=1&play_terminal='.$play_terminal.'&command=volume&volume=30';
getURL($url, 0);
getURL('http://localhost/popup/app_101ru.html?ajax=1&op=playstation&id=150', 0);
|
Король и Шут(OFF)
|
getURL("http://localhost/popup/app_player.html?ajax=1&command=close",0);
|
Настюшка візьми трубку
|
$vol=100;
exec("amixer -c 0 set 'Line Out',0 ". $vol. "%");
say("Настюшка возьми трубку",10);
sleep(10);
$vol=gg("ThisComputer.setvolumeLevel");
if($vol>100){
$vol=100;
sg("ThisComputer.setvolumeLevel",$vol);
}
if($vol<1){
$vol=1;
sg("ThisComputer.setvolumeLevel",$vol);
}
$vol=round($vol);
exec("amixer -c 0 sset 'Line Out',0 ". $vol. "%");
|
Параметри системи Orange Pi Zero
|
$temp0 = file_get_contents ("/sys/class/thermal/thermal_zone0/temp");
sg('pctemp',$temp0);
//CPU temp
$cpu_temp=shell_exec('cat /sys/class/thermal/thermal_zone0/temp') / 1000;
$cpu_temp=round($cpu_temp,1);
sg("CPU_temp",$cpu_temp);
//CPU usage
$cpu_usage=exec("top -bn 1 | awk '{print $9}' | tail -n +8 | awk '{s+=$1} END {print s}'");
sg("CPU_usage",$cpu_usage);
//System uptime
$sys_uptime=shell_exec("uptime");
$sys_uptime = explode(" up ", $sys_uptime);
$sys_uptime = explode(",", $sys_uptime[1]);
$sys_uptime = $sys_uptime[0].", ".$sys_uptime[1];
sg("System_uptime",$sys_uptime);
//Memory usage/total
$mem_total=exec("cat /proc/meminfo | grep MemTotal | awk '{print $2}'");
$mem_usage=$mem_total - exec("cat /proc/meminfo | grep MemFree | awk '{print $2}'");
$sys_memory=round($mem_usage * 100 / $mem_total, 1);
sg("System_memory",$sys_memory);
//Memory Card
$bytes = disk_free_space(".");
$si_prefix = array( 'B', 'KB', 'MB', 'GB', 'TB', 'EB', 'ZB', 'YB' );
$base = 1024;
$class = min((int)log($bytes , $base) , count($si_prefix) - 1);
$temp = round($bytes / pow($base,$class)) . ' ' . $si_prefix[$class];
sg('System_freespace',$temp);
//CPU 1 5 15
$cpu_load=shell_exec('cat /proc/loadavg');
$pos1 = strpos($cpu_load," ");
$pos2 = strpos($cpu_load," ",$pos1+1);
$pos3 = strpos($cpu_load," ",$pos2+1);
$cpu_load1 = substr($cpu_load,0,$pos1);
$cpu_load5 = substr($cpu_load,$pos1+1,$pos2-$pos1-1);
$cpu_load15 = substr($cpu_load,$pos2+1,$pos3-$pos2-1);
sg("cpu_load1",$cpu_load1);
sg("cpu_load5",$cpu_load5);
sg("cpu_load15",$cpu_load15);
//mem info
$mem_info=shell_exec('cat /proc/meminfo');
$pos1 = strpos($mem_info,"MemTotal");
$pos2 = strpos($mem_info,"MemFree");
$pos3 = strpos($mem_info,"Cached");
$pos4 = strpos($mem_info,"SwapTotal");
$pos5 = strpos($mem_info,"SwapFree");
$mem_total = substr($mem_info,$pos1+11,13)*1;
$mem_free = substr($mem_info,$pos2+11,13)*1;
$mem_cached = substr($mem_info,$pos3+11,13)*1;
$mem_swap_total = substr($mem_info,$pos4+11,13)*1;
$mem_swap_free = substr($mem_info,$pos5+11,13)*1;
$mem_swap_used = $mem_swap_total - $mem_swap_free;
$mem_used = $mem_total - $mem_free - $mem_cached;
sg("mem_total",$mem_total);
sg("mem_free",$mem_free);
sg("mem_cached",$mem_cached);
sg("mem_swap_total",$mem_swap_total);
sg("mem_swap_free",$mem_swap_free);
sg("mem_swap_used",$mem_swap_used);
sg("mem_used",$mem_used);
$sd_info=shell_exec('df /');
$pos0 = strpos($sd_info,"dev");
$pos1 = strpos($sd_info," ",$pos0+5);
$pos2 = strpos($sd_info," ",$pos1+3);
$pos3 = strpos($sd_info," ",$pos2+3);
$pos4 = strpos($sd_info," ",$pos3+4);
$sd_total = substr($sd_info,$pos1,$pos2-$pos1)*1;
$sd_used = substr($sd_info,$pos2,$pos3-$pos2)*1;
$sd_free = substr($sd_info,$pos3,$pos4-$pos3)*1;
sg("sd_total",$sd_total);
sg("sd_used",$sd_used);
sg("sd_free",$sd_free);
|
Перезавантаження
|
say("Подготовка к перезагрузке",2);
$filename = ROOT . '/database_backup/db.sql';
$mysqlDumpPath = "/usr/bin/mysqldump";
$mysqlDumpParam = " --user=" . DB_USER . " --password=" . DB_PASSWORD;
$mysqlDumpParam .= " --no-create-db --add-drop-table --databases " . DB_NAME;
if (file_exists($filename)) rename($filename, $filename . '.prev');
exec($mysqlDumpPath . $mysqlDumpParam . " > " . $filename);
setTimeout("shutdownTimer","safe_exec('reboot');",15);
|
Погода домашня метеостанція
|
$status="";
$status.="Сегодня ".gg("cherkassi.conditionrus").".";
say($status,2);
$status="";
$w=round(gg("Outdoor.Temperature"));
$tempw=$w;
if($tempw >= 11 and $tempw <= 14){
$tempcels=" градусов ";
}
else{
while ($tempw > 9){
$tempw=$tempw-10;
}
if($tempw == 0 or $tempw >= 5 and $tempw <= 9){
$tempcels= градусов ; }
if($tempw == 1){
$tempcels= градус ; }
if($tempw >= 2 and $tempw <= 4){
$tempcels= градуса ; }
}
$tNew = abs((float)getGlobal('Outdoor.Temperature'));
$status.=' Температура '.getGlobal('Outdoor.Temperature')." ".$tempcels." цельсия";
say($status,2);
$tempw="";
$tempcels="";
$status="";
$h=round(gg("Outdoor.Humidity"));
$tempw=$h;
if($tempw >= 11 and $tempw <= 14){
$tempcels=" процентов ";
}
else{
while ($tempw > 9){
$tempw=$tempw-10;
}
if($tempw == 0 or $tempw >= 5 and $tempw <= 9){
$tempcels= процентов ; }
if($tempw == 1){
$tempcels= процент ; }
if($tempw >= 2 and $tempw <= 4){
$tempcels= процента ; }
}
$status.="Относительная влажность ".gg("Outdoor.Humidity")." ".$tempcels. ".";
say($status,2);
$tempw="";
$tempcels="";
$status="";
$pressure=(float)gg("Outdoor.Pressure");
if ($pressure<740) {
$status.=' Атмосферное давление пониженное';
} elseif ($pressure>760) {
$status.=' Атмосферное давление повышенное.';
} else {
$status.=' Атмосферное давление нормальное.';
}
say($status,0);
$status="";
//ветер
$WindSpeed=(float)gg("yw_mycity.wind_speed");
if ($WindSpeed<1) {
$status.=' Ветра нет.';
} elseif ($WindSpeed<3) {
$status.=' Ветер слабый.';
} elseif ($WindSpeed<6) {
$status.=' Ветер сильный.';
} elseif ($WindSpeed<9) {
$status.=' Ветер очень сильный.';
} else {
$status.=' Ветер очень! Очень сильный.';
}
say($status,0);
|
Ранок будній день
|
// ВИМК звукової доріжки rain
$play_terminal = "MAIN";
$url=BASE_URL.ROOTHTML.'popup/app_player.html?ajax=1&play_terminal='.$play_terminal.'&command=close';
getURL($url, 0);
sleep(10);
// ВМК ноутбука MEDIA
// ВМК фільму на MEDIA
sleep(40);
// Гучність MEDIA 50 %
getURL ("http://192.168.1.159:1234/set?vol=50");
sleep(10);
// Гучність VLC плеера MEDIA 75 %
$play_terminal = "MEDIA";
$url=BASE_URL.ROOTHTML.'popup/app_player.html?ajax=1&play_terminal='.$play_terminal.'&command=volume&volume=75';
getURL($url, 0);
|
як бодька
|
$vol=100;
exec("amixer -c 0 set 'Line Out',0 ". $vol. "%");
say("добре,набереш коли нада виходить ",10);
sleep(10);
$vol=gg("ThisComputer.setvolumeLevel");
if($vol>100){
$vol=100;
sg("ThisComputer.setvolumeLevel",$vol);
}
if($vol<1){
$vol=1;
sg("ThisComputer.setvolumeLevel",$vol);
}
$vol=round($vol);
exec("amixer -c 0 sset 'Line Out',0 ". $vol. "%");
|
Як відчувається температура на вулиці 1
|
$t = gg('cherkassi.temp'); // температура на улице
$h = gg('cherkassi.humidity'); // влажность на улице %
$w = gg('cherkassi.wind_speed'); // данные о ветре из прогноза OpenWeather m/s
$w=$w*3.6/1.609;//m/s -> mph
$tF = $t *1.8+32; // перевод температуры в Farenheit
if ($t > 26.6){
// Считаем HeatIndex по Rothfusz
$_f=-42.379 + 2.04901523*$tF + 10.14333127*$h - 0.22475541*$tF*$h - 0.00683783*$tF*$tF - 0.05481717*$h*$h + 0.00122874*$tF*$tF*$h + 0.00085282*$tF*$h*$h -0.00000199*$tF*$tF*$h*$h;
if(($tF<112)&&($h<13)){
// If the RH is less than 13% and the temperature is between 80 and 112 degrees F, then the following adjustment is subtracted from HI:
$_f=$_f-((13-$h)/4)*sqrt((17-abs($tF-95.))/17);
}
if(($tF<88)&&($h>85)){
// On the other hand, if the RH is greater than 85% and the temperature is between 80 and 87 degrees F, then the following adjustment is added to HI:
//ADJUSTMENT = [(RH-85)/10] * [(87-T)/5]
$_f=$_f+(($h-85)/10)*((87-$tF)/5);
}
}else if ($t <= 10){
// Считаем фактор WindChild
$_f = 35.74+(0.6215*$tF)-(35.75*pow($w,0.16))+((0.4275*$tF)*pow($w,0.16));
}else{
//считаем по упрощенной формуле
$_f = 0.5*($tF+61+(($tF-68)*1.2)+($h*0.094));
}
// переводим в цельсии
$rf = round(($_f-32)/1.8,1);
echo 't= '.$t.'C h= '.$h.'% w='.round($w,2).' mph realfeel t='.$rf.'C';
sg("ThisComputer.reelFeel",$rf);
$status="";
$status.="Реальная температура ".gg('cherkassi.temp'). " градуса." ;
$status.=" ощущается как ".gg('ThisComputer.reelFeel'). "." ;
say($status,2);
|