From 10c4c14890edf7b071ec46d91bdc0dd5e31820c7 Mon Sep 17 00:00:00 2001 From: Vincent Date: Sun, 25 Aug 2019 14:50:17 +0200 Subject: [PATCH] . --- .idea/workspace.xml | 30 ++++++++++++++++++------------ config/global.php | 25 +++++++++++++------------ scripts/lib/lib.php | 4 ++-- scripts/lib/mediarasp.php | 4 +--- scripts/lib/scenes.php | 2 +- scripts/lib/squeezebox.php | 4 ++++ scripts/raspberrycast.php | 2 +- 7 files changed, 40 insertions(+), 31 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 8065092..7a049f9 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,9 +3,12 @@ - + + + + diff --git a/config/global.php b/config/global.php index a287c73..df15881 100644 --- a/config/global.php +++ b/config/global.php @@ -28,18 +28,19 @@ $phones = array('vincent' => array( ); $devices = [ - 'cerveau' => ['host' => '192.168.13.60', 'user' => 'pi', 'password' => 'atacama'], - 'litvincent' => ['host' => '192.168.13.61', 'user' => 'pi', 'password' => 'atacama'], - 'litjerome' => ['host' => '192.168.13.62', 'user' => 'pi', 'password' => 'atacama'], - 'sdb' => ['host' => '192.168.13.63', 'user' => 'pi', 'password' => 'atacama'], - 'entree' => ['host' => '192.168.13.64', 'user' => 'pi', 'password' => 'atacama'], - 'jarvis' => ['host' => '192.168.13.60', 'user' => 'jarvis', 'password' => 'atacama'], - 'minitel1' => ['host' => '192.168.13.65', 'user' => 'pi', 'password' => 'atacama'], - 'salon' => ['host' => '192.168.13.66', 'user' => 'pi', 'password' => 'atacama'], - 'bureau' => ['host' => '192.168.13.67', 'user' => 'pi', 'password' => 'atacama'], - 'cuisine' => ['host' => '192.168.13.68', 'user' => 'pi', 'password' => 'atacama'], - 'bureausun' => ['host' => '192.168.13.70', 'user' => 'pi', 'password' => 'atacama'], - 'avion' => ['host' => '192.168.13.5', 'user' => 'Tortuga', 'password' => 's77vpo*wu', 'mac' => 'E0:D5:5E:68:67:B9'], + 'cerveau' => ['id'=>'cerveau','host' => '192.168.13.60', 'user' => 'pi', 'password' => 'atacama'], + 'litvincent' => ['id'=>'litvincent','host' => '192.168.13.61', 'user' => 'pi', 'password' => 'atacama'], + 'litjerome' => ['id'=>'litjerome','host' => '192.168.13.62', 'user' => 'pi', 'password' => 'atacama'], + 'sdb' => ['id'=>'sdb','host' => '192.168.13.63', 'user' => 'pi', 'password' => 'atacama'], + 'entree' => ['id'=>'entree','host' => '192.168.13.64', 'user' => 'pi', 'password' => 'atacama'], + 'jarvis' => ['id'=>'jarvis','host' => '192.168.13.60', 'user' => 'jarvis', 'password' => 'atacama'], + 'minitel1' => ['id'=>'minitel1','host' => '192.168.13.65', 'user' => 'pi', 'password' => 'atacama'], + 'salon' => ['id'=>'salon','host' => '192.168.13.66', 'user' => 'pi', 'password' => 'atacama'], + 'bureau' => ['id'=>'bureau','host' => '192.168.13.67', 'user' => 'pi', 'password' => 'atacama'], + 'cuisine' => ['id'=>'cuisine','host' => '192.168.13.68', 'user' => 'pi', 'password' => 'atacama'], + 'bureausun' => ['id'=>'bureausun','host' => '192.168.13.70', 'user' => 'pi', 'password' => 'atacama'], + 'lit' => ['id'=>'lit','host' => '192.168.13.71', 'user' => 'pi', 'password' => 'atacama'], + 'avion' => ['id'=>'avion','host' => '192.168.13.5', 'user' => 'Tortuga', 'password' => 's77vpo*wu', 'mac' => 'E0:D5:5E:68:67:B9'], ]; // Browse media files on NAS diff --git a/scripts/lib/lib.php b/scripts/lib/lib.php index c43a57f..2b7c871 100644 --- a/scripts/lib/lib.php +++ b/scripts/lib/lib.php @@ -412,7 +412,7 @@ function volume($volume, $increase = '') } elseif ($p == 'raspberrycast') { $d = 'RaspberryCast'; } elseif ($p == 'mediarasp') { - $d = 'OMX'; + $d = 'VLC'; } } @@ -434,7 +434,7 @@ function volume($volume, $increase = '') case 'RaspberryCast': return raspberryCast('sound?vol=' . ($increase == '-' ? 'less' : 'more')); case 'OMX': - return OMXCmd(['action' => 'shortcut', 'shortcut' => $increase], $device); + return VLCCmd(['action' => 'shortcut', 'shortcut' => $increase], $device); } } diff --git a/scripts/lib/mediarasp.php b/scripts/lib/mediarasp.php index 48f95de..faf933c 100644 --- a/scripts/lib/mediarasp.php +++ b/scripts/lib/mediarasp.php @@ -318,6 +318,7 @@ function mediaRaspCommons($device) } else if ($device == 'bureau') { execScene('bureau/media/play'); stopSqueezebox($squeezeboxPlayers['Bureau']); + sshCommand('/usr/local/bin/soundtohdmi', $device); } else if ($device == 'sdb') { execScene('sdb/ampli/on'); } @@ -477,7 +478,6 @@ function VLCCmd($params, $device = null, $timeout = 5) $query = 'requests/status.xml'; } $url = 'http://' . $d['host'] . ':8754/' . $query; - // echo $url.': '.print_r($params,true); $client = getMediaRaspClient(); try { $response = $client->get($url, ['query' => $params, 'timeout' => $timeout, 'auth' => ['', 'atacama']]); @@ -486,7 +486,6 @@ function VLCCmd($params, $device = null, $timeout = 5) echo $d['host'] . print_r($params) . ':' . $e->getMessage(); return false; } - } function VLCPlay($fileorstream, $device = null, $timeout = 5) @@ -499,7 +498,6 @@ function VLCPlay($fileorstream, $device = null, $timeout = 5) return VLCCmd(['command' => 'in_play', 'input' => $fileorstream], $device, $timeout); } - function OMXCmd($params, $device = null, $timeout = 5) { global $devices; diff --git a/scripts/lib/scenes.php b/scripts/lib/scenes.php index 070c1f9..fdf7f6f 100644 --- a/scripts/lib/scenes.php +++ b/scripts/lib/scenes.php @@ -735,7 +735,7 @@ function cheminee($lightId, $room = 'salon', $program = 'fire', $brightness = 1) function killCheminee($room) { // Kill current animation - $kill = "/bin/kill $(ps aux | grep '[c]heminee_running/" . $room . "' | awk '{print $2}')"; + $kill = 'id -u -n;/bin/kill $(ps aux | grep \'[c]heminee_running/' . $room . '\' | awk \'{print $2}\') 2>&1'; $res = `$kill`; echo 'Kill cheminée ' . $room . ' :: ' . $res; return $res; diff --git a/scripts/lib/squeezebox.php b/scripts/lib/squeezebox.php index 83273dc..1547a05 100644 --- a/scripts/lib/squeezebox.php +++ b/scripts/lib/squeezebox.php @@ -87,6 +87,7 @@ function squeezePlayByName($musicName, $player, $volume = null, $playIfSync = tr if ($player == $squeezeboxPlayers['Salle de bains']) { execScene('sdb/ampli/on'); } + squeezeRequest('pause', $player); if (null !== $volume) { if (config('VOLUME_DEVICE') == 'SqueezeboxPlayer') { @@ -102,6 +103,9 @@ function squeezePlayByName($musicName, $player, $volume = null, $playIfSync = tr echo $player . ':' . $command . '
'; squeezeRequest($command, $player); } + if ($player == $squeezeboxPlayers['Bureau']) { + sshCommand('/usr/local/bin/soundtojack', 'bureau'); + } } function _player($player = null) diff --git a/scripts/raspberrycast.php b/scripts/raspberrycast.php index f475456..47072c8 100644 --- a/scripts/raspberrycast.php +++ b/scripts/raspberrycast.php @@ -4,6 +4,6 @@ require_once "import.php"; if ($_GET['action'] == 'init') { setPlaying('raspberrycast:' . $_GET['url'], $_GET['device']); execScene($_GET['device'] . '/media/play'); - VLCCmd([ 'command' => 'pl_stop'], $_GET['device']); + VLCCmd(['command' => 'pl_stop'], $_GET['device']); stopSqueezebox($_GET['device']); } \ No newline at end of file -- 2.39.5