From: Vincent Date: Thu, 17 Dec 2020 09:11:30 +0000 (+0100) Subject: . X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=21108d89d7ee5c2b0eb601be94d6f3b570893fbd;p=tortuga-home.git . --- diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 00a1b33..e1288fa 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,12 +3,11 @@ - - - + + diff --git a/scripts/cron/cron.php b/scripts/cron/cron.php index b5b96ce..0776f56 100644 --- a/scripts/cron/cron.php +++ b/scripts/cron/cron.php @@ -198,8 +198,10 @@ function cronSqueezeCheckPlayers($cronmin) $players = ['Salon' => 'salon', 'Bureau' => 'bureau']; foreach ($players as $player => $device) { if (getSqueezePlayerStatus($player) === -1) { - shieldRunAppAndBackHome('sbplayer', $device, 1, true); - sleep(5); + if(!shieldPlayingVideo($device)) { + shieldRunAppAndBackHome('sbplayer', $device, 1, true); + sleep(5); + } } } } diff --git a/scripts/lib/shield.php b/scripts/lib/shield.php index 60751fd..3e026e1 100644 --- a/scripts/lib/shield.php +++ b/scripts/lib/shield.php @@ -36,10 +36,20 @@ function shieldWakeup($device = null) function shieldRunActivity($device = null) { $device = getDevice($device); + $onlySound = in_array(shieldGetCurrentApp($device), ['spotify']); + if ($device['id'] === 'salon') { - harmonyActivity('tv'); + if ($onlySound) { + harmonyActivity('musique'); + } else { + harmonyActivity('tv'); + } } else if ($device['id'] === 'bureau' || $device['id'] === 'bureausun') { - execScene('bureau/media/play'); + if ($onlySound) { + execScene('bureau/sound/on'); + } else { + execScene('bureau/media/play'); + } } } @@ -147,7 +157,7 @@ function shieldFranceTv($device = null) shieldLaunchApp('fr.francetv.pluzz/fr.francetv.androidtv.main.MainActivity', $device); } -function shieldLaunchApp($activity, $device=null) +function shieldLaunchApp($activity, $device = null) { shieldHome($device); @@ -157,7 +167,7 @@ function shieldLaunchApp($activity, $device=null) if (strpos($activity, '.') === false) { $activity = shieldGetAppId($activity); } - shieldCommand('shell monkey', '-p ' . $activity.' 1', $device); + shieldCommand('shell monkey', '-p ' . $activity . ' 1', $device); } else { shieldCommand('shell am start', '-n ' . $activity, $device); } @@ -256,6 +266,12 @@ function shieldGetApps() ]; } +function shieldPlayingVideo($device = null) +{ + $videoApps = ['kodi', 'vlc', 'mycanal', 'netflix', 'arte', 'francetv', 'gamecast', 'twitch', 'youtube', 'dailymotion', 'vimeo', 'steamlink']; + return in_array(shieldGetCurrentApp($device), $videoApps); +} + function shieldRunAppAndBackHome($app, $device = null, $waitBeforeBack = 1, $backToSleep = true) { @@ -267,10 +283,10 @@ function shieldRunAppAndBackHome($app, $device = null, $waitBeforeBack = 1, $bac $s = 'maskShield' . ucfirst($d['id']) . 'Wakeup'; setState($s, '1'); } - echo 'shieldLaunchApp :: '.$app."\n"; + echo 'shieldLaunchApp :: ' . $app . "\n"; shieldLaunchApp($app, $device); sleep($waitBeforeBack); - echo 'shieldHome'."\n"; + echo 'shieldHome' . "\n"; shieldHome($device); if ($backToSleep) { shieldSleep($device); @@ -334,7 +350,6 @@ function shieldGetCurrentApp($device = null) } - function _adb($command, $params = '', $device = null) { $c = _adbcmd($command, $params, $device); diff --git a/scripts/lib/squeezebox.php b/scripts/lib/squeezebox.php index 47378cd..4fbdcde 100644 --- a/scripts/lib/squeezebox.php +++ b/scripts/lib/squeezebox.php @@ -110,7 +110,7 @@ function squeezePlayByName($musicName, $player, $volume = null, $playIfSync = tr } else if ($player == $squeezeboxPlayers['Salle de bains']) { execScene('sdb/ampli/on'); } else if ($player == $squeezeboxPlayers['Bureau']) { - exec('bureau/sound/on'); + execScene('bureau/sound/on'); setState('maskShieldBureauWakeup', '1'); } else if ($player == $squeezeboxPlayers['Chambre']) { denon(true); diff --git a/scripts/remoteinfos.php b/scripts/remoteinfos.php index cd22a3a..b40ddff 100644 --- a/scripts/remoteinfos.php +++ b/scripts/remoteinfos.php @@ -1,5 +1,7 @@