From: Vincent Date: Sun, 25 Apr 2021 10:58:00 +0000 (+0200) Subject: . X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=a99a59dfb5d6d14377cef36c685aa8ca1f2f420f;p=tortuga-home.git . --- diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 89359c9..26b3fbb 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,10 +3,14 @@ - - - - + + + + + + + + diff --git a/config/music.php b/config/music.php index aee8a22..31fca75 100644 --- a/config/music.php +++ b/config/music.php @@ -110,12 +110,22 @@ function audioElement($subitem, $app = 'favorites') $shortcuts['music'] = [ ['type' => 'volume', 'volume' => '3%', 'increase' => '+', 'label' => ''], ['type' => 'volume', 'volume' => '3%', 'increase' => '-', 'label' => ''], - ['type' => 'light', 'scene' => 'home/music/synchro/soiree', 'label' => 'Synchro Soirée'], + ['type' => 'sub', 'label' => 'Synchro', 'sub' => 'synchro'], ['type' => 'sub', 'label' => 'Radios', 'sub' => 'radio'], ['type' => 'sub', 'label' => 'Musique', 'sub' => 'playlists'], ['type' => 'sub', 'label' => 'Ambiance', 'sub' => 'ambiance'], ]; +$shortcuts['sub-synchro'] = [ + ['type' => 'back', 'label' => 'Synchro'], + ['type' => 'light', 'scene' => 'home/music/synchro/soiree', 'label' => 'Soirée'], + ['type' => 'light', 'scene' => 'home/music/synchro/salon-cuisine', 'label' => 'Salon Cuisine'], + ['type' => 'light', 'scene' => 'home/music/synchro/chambre-sdb', 'label' => 'Chambre SDB'], + ['type' => 'light', 'scene' => 'home/music/synchro/all', 'label' => 'Tout'], + ['type' => 'light', 'scene' => 'home/music/synchro/bureau-wc', 'label' => 'Bureau WC'], + ['type' => 'light', 'scene' => 'home/music/synchro/off', 'label' => 'Off'], +]; + if ($podcasts !== false) { $shortcuts['music'][] = ['type' => 'sub', 'label' => 'Podcasts', 'sub' => 'podcasts']; } \ No newline at end of file diff --git a/images/rooms/medium/salon.jpg b/images/rooms/medium/salon.jpg index 5d92fc5..58ec7bc 100644 Binary files a/images/rooms/medium/salon.jpg and b/images/rooms/medium/salon.jpg differ diff --git a/images/rooms/originaux/salon.jpg b/images/rooms/originaux/salon.jpg index 5d92fc5..58ec7bc 100644 Binary files a/images/rooms/originaux/salon.jpg and b/images/rooms/originaux/salon.jpg differ diff --git a/images/rooms/small/salon.jpg b/images/rooms/small/salon.jpg index 5d92fc5..58ec7bc 100644 Binary files a/images/rooms/small/salon.jpg and b/images/rooms/small/salon.jpg differ diff --git a/scripts/lib/scenes.php b/scripts/lib/scenes.php index 8591f0d..3e0f9c3 100644 --- a/scripts/lib/scenes.php +++ b/scripts/lib/scenes.php @@ -332,7 +332,22 @@ $scenes = [ ['type' => 'ecomode', 'mode' => '1'], ], 'home/music/synchro/soiree' => [ - ['type' => 'function', 'function' => 'synchroSoiree'], + ['type' => 'function', 'function' => 'syncMusic', 'args' => [['Salon', 'Cuisine', 'Bureau', 'WC']]], + ], + 'home/music/synchro/salon-cuisine' => [ + ['type' => 'function', 'function' => 'syncMusic', 'args' => [['Salon', 'Cuisine']]], + ], + 'home/music/synchro/all' => [ + ['type' => 'function', 'function' => 'syncMusic', 'args' => [['Salon', 'Cuisine', 'Bureau', 'WC', 'Chambre', 'SDB']]], + ], + 'home/music/synchro/chambre-sdb' => [ + ['type' => 'function', 'function' => 'syncMusic', 'args' => [['Chambre', 'SDB']]], + ], + 'home/music/synchro/bureau-wc' => [ + ['type' => 'function', 'function' => 'syncMusic', 'args' => [['Bureau', 'WC']]], + ], + 'home/music/synchro/off' => [ + ['type' => 'function', 'function' => 'stopAllSqueezebox'], ], 'salon/projector/on' => [ ['type' => 'function', 'function' => 'epson', 'args' => [true, true]], @@ -650,12 +665,6 @@ $scenes = [ 'home/hueoff' => [ ['type' => 'hue', 'group' => 17, 'scene' => ['on' => false, 'brightness' => 0, 'effect' => 'none']], ], - 'sdb/radio/sync/salon' => [ - //['type' => 'function', 'function' => 'harmonyActivity', 'args' => ["musique"]], - ['type' => 'function', 'function' => 'squeezeRequest', 'args' => ['sync ' . $squeezeboxPlayers['Salon'], $squeezeboxPlayers['Salle de bains']], 'wait' => 1], - ['type' => 'function', 'function' => 'squeezeRequest', 'args' => ['power 1', $squeezeboxPlayers['Salon']]], - ['type' => 'function', 'function' => 'squeezeRequest', 'args' => ['play', $squeezeboxPlayers['Salon']]] - ], 'wc/on' => [ ['type' => 'function', 'function' => 'wcOn'], ], diff --git a/scripts/lib/squeezebox.php b/scripts/lib/squeezebox.php index 0c82fef..20b488b 100644 --- a/scripts/lib/squeezebox.php +++ b/scripts/lib/squeezebox.php @@ -4,7 +4,7 @@ require_once ROOT . '/config/music.php'; function stopSqueezeboxPlayer($player, $stopIfSync = true, $devices = true) { - if (!$stopIfSync && getState('syncsoiree') == '1') { + if (!$stopIfSync && isSynced($player)) { return; } @@ -47,7 +47,7 @@ function stopAllSqueezebox() foreach ($squeezeboxPlayers as $squeezeboxPlayer) { stopSqueezebox($squeezeboxPlayer); } - setState('syncsoiree', '0'); + squeezeEmptySynced(); } @@ -123,7 +123,7 @@ function _squeezeRequest($params, $player = '') function squeezePlayByName($musicName, $player, $volume = null, $playIfSync = true) { - if (!$playIfSync && getState('syncsoiree') == '1') { + if (!$playIfSync && isSynced($player)) { echo 'sync enabled'; return; } @@ -140,18 +140,12 @@ function squeezePlayByName($musicName, $player, $volume = null, $playIfSync = tr } } - -function _squeezePlay($player = '', $volume = null) +function squeezePlayerOn($player) { global $squeezeboxPlayers; $player = _player($player); - if (null === $player) { - echo 'player null'; - return; - } - if ($player == $squeezeboxPlayers['Salon']) { - denonAVROn('AUX'); + denonAVROn('AUX'); } else if ($player == $squeezeboxPlayers['Salle de bains']) { execScene('sdb/ampli/on'); } else if ($player == $squeezeboxPlayers['Bureau']) { @@ -161,6 +155,17 @@ function _squeezePlay($player = '', $volume = null) } else if ($player == $squeezeboxPlayers['Chambre']) { denon(true); } +} + +function _squeezePlay($player = '', $volume = null) +{ + + if (null === $player) { + echo 'player null'; + return; + } + + squeezePlayerOn($player); if (null !== $volume) { if (config('VOLUME_DEVICE') == 'SqueezeboxPlayer') { @@ -207,20 +212,54 @@ function isMacAddress($mac) function synchroSoiree() { - harmonyActivity('musique'); + syncMusic(['Salon', 'WC', 'Chambre', 'Bureau', 'Cuisine']); +} - $devices = ['WC', 'Chambre', 'Bureau', 'Cuisine']; - $salon = _player('Salon'); - foreach ($devices as $device) { - $player = _player($device); - squeezeRequest('sync ' . $player, $salon); + +function syncMusic($players) +{ + global $squeezeboxPlayers; + $first = true; + + foreach ($players as $player) { + $player = _player($player); + if ($player === $squeezeboxPlayers['WC']) { + + } + squeezePlayerOn($player); + if ($first) { + $firstPlayer = $player; + $first = false; + continue; + } + squeezeRequest('sync ' . $player, $firstPlayer); squeezeRequest('power 1', $player); + squeezeAddSynced($player); } - squeezeRequest('play', 'salon'); + squeezeRequest('play', $firstPlayer); +} - setState('syncsoiree', '1'); +function squeezeAddSynced($player) +{ + $player = _player($player); + $synced = getState('squeezesynced', []); + if (!in_array($player, $synced)) { + $synced[] = $player; + } + setState('squeezesynced', $synced); +} + +function squeezeEmptySynced() +{ + setState('squeezesynced', []); } +function isSynced($player) +{ + $player = _player($player); + $synced = getState('squeezesynced', []); + return in_array($player, $synced); +} function getSqueezeFavorites($root = 0, $app = 'favorites', $level = 0) { diff --git a/style/style.css b/style/style.css index ed44023..07fc0d2 100644 --- a/style/style.css +++ b/style/style.css @@ -61,7 +61,8 @@ body #splash { bottom: 4.41vh; font-size: 5.39vh; } -#mainnav a { +#mainnav a, +#mainnav div { text-align: center; display: block; z-index: 100; @@ -69,18 +70,6 @@ body #splash { text-shadow: 1px 1px rgba(0, 0, 0, 0.5); margin: 0.2em 0; } -#mainnav a .fa-tv { - -webkit-transform: scaleX(0.85); - transform: scaleX(0.85); - -webkit-transform-origin: 0 0; - transform-origin: 0 0; -} -#mainnav a .fa-coffee { - -webkit-transform: scaleX(0.85); - transform: scaleX(0.85); - -webkit-transform-origin: 0 0; - transform-origin: 0 0; -} .fit { transform-origin: 0 0; -webkit-transform-origin: 0 0; diff --git a/style/style.less b/style/style.less index cd74470..d590462 100644 --- a/style/style.less +++ b/style/style.less @@ -78,29 +78,13 @@ body { #mainnav { - a { + a, div { text-align: center; display: block; z-index: 100; color: #fff; text-shadow: 1px 1px rgba(0, 0, 0, 0.5); margin: 0.2em 0; - - .fa-tv { - -webkit-transform: scaleX(0.85); - transform: scaleX(0.85); - - -webkit-transform-origin: 0 0; - transform-origin: 0 0; - } - - .fa-coffee { - -webkit-transform: scaleX(0.85); - transform: scaleX(0.85); - - -webkit-transform-origin: 0 0; - transform-origin: 0 0; - } } } @@ -146,7 +130,7 @@ main { z-index: 1; } -[data-remote-command]{ +[data-remote-command] { cursor: pointer; } @@ -194,7 +178,7 @@ section { color: #fff; background-color: rgba(0, 0, 0, 0.5); height: 12.4em; - cursor:pointer; + cursor: pointer; } &.closed {