]> _ Git - tortuga-home.git/commitdiff
.
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 5 Jul 2023 07:29:45 +0000 (09:29 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 5 Jul 2023 07:29:45 +0000 (09:29 +0200)
.idea/workspace.xml
scripts/cron/cron.php
scripts/homeassistant_device_event.php
scripts/lib/harmony.php
scripts/lib/mediarasp.php
scripts/lib/shield.php
scripts/lib/squeezebox.php
scripts/pcgames.php
scripts/share.php
scripts/switch.php

index fdef2fdfe3180a8a3495e7a88674a8bf5e9fe16e..81902905342ba2963a354dae02236bffb26dcde5 100644 (file)
@@ -7,8 +7,14 @@
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/scripts/cron/cron.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/cron/cron.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/flowerpower.php" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/harmony.php" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/homeassistant_device_event.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/homeassistant_device_event.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/harmony.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/harmony.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/mediarasp.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/mediarasp.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/shield.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/shield.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/squeezebox.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/squeezebox.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/pcgames.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/pcgames.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/share.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/share.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/switch.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/switch.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
       <workItem from="1687359859243" duration="1495000" />
       <workItem from="1688295154056" duration="11039000" />
       <workItem from="1688414368761" duration="11417000" />
-      <workItem from="1688478993471" duration="44520000" />
+      <workItem from="1688478993471" duration="45034000" />
     </task>
     <task id="LOCAL-00502" summary=".">
       <created>1641726946298</created>
       <option name="project" value="LOCAL" />
       <updated>1687259667913</updated>
     </task>
-    <option name="localTasksCounter" value="554" />
+    <option name="localTasksCounter" value="555" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
index de1240f4144bd572217089c392fa5935db47803c..0fcc1d148d398cba0e6dce718f181207cc95b66f 100644 (file)
 
 require_once __DIR__ . "/../import.php";
 
-function cronOneLoop($cronmin)
-{
-    set_time_limit(0);
-
-    echo '------------------------------------' . "\n";
-    _logSection('One Loop // ' . $cronmin);
-    cronHeartbeat($cronmin, false);
-    cronHotWater($cronmin);
-    cronRooms($cronmin);
-    cronWeather($cronmin);
-    cronMagnet($cronmin);
-
-    if ($cronmin % 5 == 0) {
-
-        cronTraffic($cronmin, false);
-        cronVelib($cronmin);
-        cronGuest($cronmin);
-        cronShield($cronmin);
-    }
-    if ($cronmin % 10 == 0) {
-        cronSqueezeFavorites($cronmin);
-    }
-    if ($cronmin % 20 == 0) {
-        cronBackyard($cronmin);
-        cronSqueezeCheckPlayers($cronmin);
-    }
-
-    if ($cronmin % 2 == 0) {
-        cronPing($cronmin);
-    }
-    if ($cronmin % 15 == 0) {
-        cronXPlanet($cronmin);
-        cronPodcasts($cronmin);
-        cronMediaLibrary($cronmin);
-        cronTmdb($cronmin);
-    }
-    cronHarmony($cronmin);
-    cronInterface($cronmin);
-
-    if ($cronmin == 0) {
-        cronEcoMode($cronmin);
-    }
-    if ($cronmin % 5 == 0) {
-        cronTranscode($cronmin);
-    }
-    if ($cronmin % 15 == 0) {
-        cronKodi($cronmin);
-    }
-    cronHeartbeat($cronmin, true);
-    _logSection('End Loop (min:' . $cronmin . ')');
+function cronOneLoop($cronmin) {
+       set_time_limit(0);
+
+       echo '------------------------------------' . "\n";
+       _logSection('One Loop // ' . $cronmin);
+       cronHeartbeat($cronmin, false);
+       cronHotWater($cronmin);
+       cronRooms($cronmin);
+       cronWeather($cronmin);
+       cronMagnet($cronmin);
+
+       if ($cronmin % 5 == 0) {
+
+               cronTraffic($cronmin, false);
+               cronVelib($cronmin);
+               cronGuest($cronmin);
+               cronShield($cronmin);
+       }
+       if ($cronmin % 10 == 0) {
+               cronSqueezeFavorites($cronmin);
+       }
+       if ($cronmin % 20 == 0) {
+               cronBackyard($cronmin);
+               cronSqueezeCheckPlayers($cronmin);
+       }
+
+       if ($cronmin % 2 == 0) {
+               cronPing($cronmin);
+       }
+       if ($cronmin % 15 == 0) {
+               cronXPlanet($cronmin);
+               cronPodcasts($cronmin);
+               cronMediaLibrary($cronmin);
+               cronTmdb($cronmin);
+       }
+       cronHarmony($cronmin);
+       cronInterface($cronmin);
+
+       if ($cronmin == 0) {
+               cronEcoMode($cronmin);
+       }
+       if ($cronmin % 5 == 0) {
+               cronTranscode($cronmin);
+       }
+       if ($cronmin % 15 == 0) {
+               cronKodi($cronmin);
+       }
+       cronHeartbeat($cronmin, true);
+       _logSection('End Loop (min:' . $cronmin . ')');
 }
 
-function cronHotWater($cronmin)
-{
-    _logSection('Hot water');
-    hotwaterCheckMode();
+function cronHotWater($cronmin) {
+       _logSection('Hot water');
+       hotwaterCheckMode();
 }
 
-function cronMagnet($cronmin)
-{
-    //_logSection('Magnet links');
-    //file_get_contents("https://entree.home.tortuga.enhydra.fr/scripts/freeboxapi.php?action=magnets");
+function cronMagnet($cronmin) {
+       //_logSection('Magnet links');
+       //file_get_contents("https://entree.home.tortuga.enhydra.fr/scripts/freeboxapi.php?action=magnets");
 }
 
-function cronXPlanet($cronmin)
-{
-    _logSection('XPlanet');
-    $path = ROOT . '/tools/xplanet/';
-    $suncurve = $path . 'xplanet-suncurve';
-    $earth = $path . 'xplanet-earth';
+function cronXPlanet($cronmin) {
+       _logSection('XPlanet');
+       $path = ROOT . '/tools/xplanet/';
+       $suncurve = $path . 'xplanet-suncurve';
+       $earth = $path . 'xplanet-earth';
 
-    `$suncurve;$earth`;
+       `$suncurve;$earth`;
 }
 
 
-function cronBackyard($cronmin)
-{
-    _logSection('Backyard');
-    $device = 6898;
-    domoticzSwitch($device, getDomoticzDeviceStatus($device) === 'On');
+function cronBackyard($cronmin) {
+       _logSection('Backyard');
+       $device = 6898;
+       domoticzSwitch($device, getDomoticzDeviceStatus($device) === 'On');
 }
 
-function cronShield($cronmin)
-{
-    _logSection('Shield');
-    `/usr/local/bin/adb-connect`;
+function cronShield($cronmin) {
+       _logSection('Shield');
+       `/usr/local/bin/adb-connect`;
 }
 
-function cronGuest($cronmin)
-{
+function cronGuest($cronmin) {
 
-    _logSection('Guest');
-    setState('guest', hasGuest() ? '1' : '0');
+       _logSection('Guest');
+       setState('guest', hasGuest() ? '1' : '0');
 }
 
-function cronInsteon($cronmin)
-{
-    _logSection('Insteon');
-    insteonCommand('knock');
+function cronInsteon($cronmin) {
+       _logSection('Insteon');
+       insteonCommand('knock');
 }
 
-function cronEcoMode($cronmin)
-{
-    _logSection('Ecomode');
-    ecoMode(null, false);
+function cronEcoMode($cronmin) {
+       _logSection('Ecomode');
+       ecoMode(null, false);
 }
 
-function cronTranscode($cronmin)
-{
-    _logSection('Transcode');
-    httpRequest('https://salon.home.tortuga.enhydra.fr/scripts/transcode.php', 'get', [], null, 10, true);
+function cronTranscode($cronmin) {
+       _logSection('Transcode');
+       httpRequest('https://salon.home.tortuga.enhydra.fr/scripts/transcode.php', 'get', [], null, 10, true);
 }
 
-function _logSection($t)
-{
-    echo '------' . $t . ' :: ' . date('Y-m-d H:i:s') . "\n";
+function _logSection($t) {
+       echo '------' . $t . ' :: ' . date('Y-m-d H:i:s') . "\n";
 }
 
-function cronRooms($cronmin)
-{
-    _logSection('Rooms');
+function cronRooms($cronmin) {
+       _logSection('Rooms');
 
-    _logSection('Bureau');
-    updateBureauAuto();
+       _logSection('Bureau');
+       updateBureauAuto();
 
-    _logSection('Chambre');
-    updateChambreAuto();
+       _logSection('Chambre');
+       updateChambreAuto();
 
-    _logSection('Cour');
-    updateCourAuto();
+       _logSection('Cour');
+       updateCourAuto();
 
-    _logSection('Salon');
-    updateSalonAuto();
+       _logSection('Salon');
+       updateSalonAuto();
 
-    _logSection('Cuisine');
-    updateCuisine();
-    _logSection('Planetarium');
-    checkPlanetarium();
-    if ($cronmin % 2) {
-        _logSection('WC VMC');
-        checkWCVMC();
-    }
+       _logSection('Cuisine');
+       updateCuisine();
+       _logSection('Planetarium');
+       checkPlanetarium();
+       if ($cronmin % 2) {
+               _logSection('WC VMC');
+               checkWCVMC();
+       }
 }
 
-function cronMediaLibrary($cronmin)
-{
-    global $directories;
-    _logSection('Media Library');
+function cronMediaLibrary($cronmin) {
+       global $directories;
+       _logSection('Media Library');
 
-    $media = array();
-    $shareroot = '/volume1/Share';
+       $media = array();
+       $shareroot = '/volume1/Share';
 
 
-    foreach ($directories as $name => $directory) {
-        $dir = $shareroot . '/Videos/' . $directory['dir'];
-        if ($directory['context'] == 'tvshow' || $name == 'Films') {
-            continue;
-        }
-        $media[$directory['id']] = array('name' => $name, 'items' => getMediaContents($dir, $directory['context']));
-    }
+       foreach ($directories as $name => $directory) {
+               $dir = $shareroot . '/Videos/' . $directory['dir'];
+               if ($directory['context'] == 'tvshow' || $name == 'Films') {
+                       continue;
+               }
+               $media[$directory['id']] = array('name' => $name, 'items' => getMediaContents($dir, $directory['context']));
+       }
 
-    connectRedis()->igbset('medialibrary', $media);
+       connectRedis()->igbset('medialibrary', $media);
 
-    _getTVShows(true);
-    _getMovies(true);
-    _getMediaRecentAdded(true);
+       _getTVShows(true);
+       _getMovies(true);
+       _getMediaRecentAdded(true);
 }
 
 
-function cronTmdb($cronmin)
-{
-    _logSection('TMDB');
-    _getTVShows(true, false);
-    _getMovies(true, false);
-    _getMediaRecentAdded(true);
-    parseMoviesLibrary();
+function cronTmdb($cronmin) {
+       _logSection('TMDB');
+       _getTVShows(true, false);
+       _getMovies(true, false);
+       _getMediaRecentAdded(true);
+       parseMoviesLibrary();
 }
 
-function cronPing($cronmin)
-{
-    _logSection('Pings');
-    global $devices;
-    setState('vincenthere', ping('192.168.13.20', 5) ? '1' : '0');
-    setState('hasnetwork', ping('1.1.1.1', 3, 443) ? '1' : '0');
-    foreach ($devices as $name => $device) {
-        if (!isset($device['host'])) {
-            continue;
-        }
-        $result = ping($device['host'], 3, 22) ? '1' : '0';
-        setState('device_' . $name . '_awake', $result);
-        echo 'device_' . $name . '_awake : ' . getState('device_' . $name . '_awake') . "\n";
-        if ($result) {
-            sshCommand('pwd', $device['host'], false, false);
-            sshCommand('pwd', $device['host'], false, true);
-        }
-    }
+function cronPing($cronmin) {
+       _logSection('Pings');
+       global $devices;
+       setState('vincenthere', ping('192.168.13.20', 5) ? '1' : '0');
+       setState('hasnetwork', ping('1.1.1.1', 3, 443) ? '1' : '0');
+       foreach ($devices as $name => $device) {
+               if (!isset($device['host'])) {
+                       continue;
+               }
+               $result = ping($device['host'], 3, 22) ? '1' : '0';
+               setState('device_' . $name . '_awake', $result);
+               echo 'device_' . $name . '_awake : ' . getState('device_' . $name . '_awake') . "\n";
+               if ($result) {
+                       sshCommand('pwd', $device['host'], false, false);
+                       sshCommand('pwd', $device['host'], false, true);
+               }
+       }
 }
 
-function cronSqueezeFavorites($cronmin)
-{
-    _logSection('Squeeze Favorites');
-    $favorites = getSqueezeFavorites();
-    if ($favorites !== false && count($favorites) > 0) {
-        connectRedis()->igbset('squeezebox_favorites', $favorites);
-    }
+function cronSqueezeFavorites($cronmin) {
+       _logSection('Squeeze Favorites');
+       $favorites = getSqueezeFavorites();
+       if ($favorites !== false && count($favorites) > 0) {
+               connectRedis()->igbset('squeezebox_favorites', $favorites);
+       }
 }
 
-function cronSqueezeCheckPlayers($cronmin)
-{
-    _logSection('Check squeezebox players');
+function cronSqueezeCheckPlayers($cronmin) {
+       _logSection('Check squeezebox players');
 }
 
-function cronWeather($cronmin)
-{
-    _logSection('Weather');
-    getWeather();
+function cronWeather($cronmin) {
+       _logSection('Weather');
+       getWeather();
 }
 
-function cronVelib($cronmin)
-{
-    _logSection('Velib');
-    velibStations(false);
+function cronVelib($cronmin) {
+       _logSection('Velib');
+       velibStations(false);
 }
 
-function cronTraffic($cronmin, $force = false)
-{
-    _logSection('Traffic');
-    $cache = ROOT . '/cache/traffic.json';
-
-    $hour = date('G');
-    $day = date('w');
-    $limit = 3600;
-    $departure_in = 5;
-
-    if ($day > 0 && $day < 6 && $hour > 6 && $hour < 10) {
-        $limit = 60;
-    }
-    if ($force || !file_exists($cache) || filemtime($cache) < time() - $limit) {
-        $traffic = array('time' => date('H:i', time() + ($departure_in * 60)), 'jams' => trafficJams(), 'car' => itineraryIssy('driving'), 'subway' => itineraryIssy('transit'), 'bike' => itineraryIssy('bicycling'));
-        $json = json_encode($traffic);
-        file_put_contents($cache, $json);
-        if (isset($_GET['force'])) {
-            ob_end_clean();
-            header('Content-type: application/json');
-            echo $json;
-            exit;
-        }
-    }
+function cronTraffic($cronmin, $force = false) {
+       _logSection('Traffic');
+       $cache = ROOT . '/cache/traffic.json';
+
+       $hour = date('G');
+       $day = date('w');
+       $limit = 3600;
+       $departure_in = 5;
+
+       if ($day > 0 && $day < 6 && $hour > 6 && $hour < 10) {
+               $limit = 60;
+       }
+       if ($force || !file_exists($cache) || filemtime($cache) < time() - $limit) {
+               $traffic = array('time' => date('H:i', time() + ($departure_in * 60)), 'jams' => trafficJams(), 'car' => itineraryIssy('driving'), 'subway' => itineraryIssy('transit'), 'bike' => itineraryIssy('bicycling'));
+               $json = json_encode($traffic);
+               file_put_contents($cache, $json);
+               if (isset($_GET['force'])) {
+                       ob_end_clean();
+                       header('Content-type: application/json');
+                       echo $json;
+                       exit;
+               }
+       }
 }
 
-function cronPodcasts($cronmin)
-{
-    checkSpottyLogin();
-    return;
-    _logSection('Podcasts');
-    $podcasts = getSqueezeFavorites(0, 'podcasts');
-    if ($podcasts !== false && count($podcasts) > 0) {
-        connectRedis()->igbset('squeezebox_podcasts', $podcasts);
-    }
+function cronPodcasts($cronmin) {
+       checkSpottyLogin();
+       return;
+       _logSection('Podcasts');
+       $podcasts = getSqueezeFavorites(0, 'podcasts');
+       if ($podcasts !== false && count($podcasts) > 0) {
+               connectRedis()->igbset('squeezebox_podcasts', $podcasts);
+       }
 }
 
-function cronInterface($cronmin)
-{
-    _logSection('Interface');
-    if ((getState('ecomode') == '0' && $cronmin % 3 == 0) || $cronmin % 10 == 0) {
-        $devices = ['salon', 'bureau', 'entree', 'cuisine', 'litvincent', 'litjerome', 'sdb', 'chambre', 'bureausun', 'wc'];
-        foreach ($devices as $device) {
-            file_get_contents('https://' . $device . '.home.tortuga.enhydra.fr/');
-        }
-    }
+function cronInterface($cronmin) {
+       _logSection('Interface');
+       if ((getState('ecomode') == '0' && $cronmin % 3 == 0) || $cronmin % 10 == 0) {
+               $devices = ['salon', 'bureau', 'entree', 'cuisine', 'litvincent', 'litjerome', 'sdb', 'chambre', 'bureausun', 'wc'];
+               foreach ($devices as $device) {
+                       file_get_contents('https://' . $device . '.home.tortuga.enhydra.fr/');
+               }
+       }
 }
 
-function cronHarmony($cronmin)
-{
-    _logSection('Harmony');
-    $currentActivity = getCurrentHarmonyActivity();
-
-    if (!$currentActivity) {
-        return;
-    }
-    if ($currentActivity == 'musique') {
-        setPlaying('squeezebox', 'bureau');
-    } else if ($currentActivity == 'poweroff' || $currentActivity == 'off') {
-        setPlaying('mycanal', 'bureau');
-    }
+function cronHarmony($cronmin) {
+       _logSection('Harmony');
+       $currentActivity = getCurrentHarmonyActivity();
+       if ($currentActivity == HARMONY_MUSIQUE) {
+               setPlaying('squeezebox', 'bureau');
+       } else if ($currentActivity == HARMONY_OFF) {
+               setPlaying('mycanal', 'bureau');
+       }
 }
 
-function cronHeartbeat($cronmin, $devices = false)
-{
-    _logSection('Heartbeat');
-    setState('cron_heartbeat', time());
-    domoticzCmd(null);
-    squeezeRequest(null);
-    hueCommand(null);
-
-    if (!$devices || $cronmin % 5 != 0) {
-        return;
-    }
-    restartDeadDevices();
+function cronHeartbeat($cronmin, $devices = false) {
+       _logSection('Heartbeat');
+       setState('cron_heartbeat', time());
+       domoticzCmd(null);
+       squeezeRequest(null);
+       hueCommand(null);
+
+       if (!$devices || $cronmin % 5 != 0) {
+               return;
+       }
+       restartDeadDevices();
 }
 
-function cronKodi($cronmin)
-{
-    _logSection('Kodi');
-    kodiSyncPlayedStatus();
+function cronKodi($cronmin) {
+       _logSection('Kodi');
+       kodiSyncPlayedStatus();
 }
\ No newline at end of file
index f7ab055881e12d45c384ba109ab459cf3527d9c8..192ef49f80c67a76f94b471ecd6ccb22e01b687c 100644 (file)
@@ -61,7 +61,7 @@ if ($_GET['id'] === $wcswitch) {
                        off('bureau');
                        break;
                case 'slide':
-                       if (getCurrentHarmonyActivity() === 'tv') {
+                       if (getCurrentHarmonyActivity() === HARMONY_TV) {
                                _remoteCmd('pause', 'bureau');
                        } else {
                                stopPlayersIn('bureau');
@@ -75,7 +75,7 @@ if ($_GET['id'] === $wcswitch) {
                        volume(config('VOLUME_STEP'), '-');
                        break;
                case 'tap':
-                       harmonyActivity('musique');
+                       harmonyActivity(HARMONY_MUSIQUE);
                        $lastTap = getState('bureau_squeeze_tap', 0);
                        $musics = ['FIP', 'Samba'];
                        $i = ($lastTap + 1) % count($musics);
index 7a9c2a36868f6e0c28eb62d29f346b988d3d8906..6c0fd1335316b65207f37e5c956cf2948740aeb3 100644 (file)
@@ -1,47 +1,41 @@
 <?php
 
-$harmonymap = ['musique' => 'Musique', 'tv' => 'TV', 'switch' => 'Switch', 'poweroff' => 'power_off'];
+const HARMONY_MUSIQUE = 'Musique';
+const HARMONY_TV = 'TV';
+const HARMONY_SWITCH = 'Switch';
+const HARMONY_OFF = 'power_off';
 function harmonyActivity($activity) {
-       global $harmonymap;
-       if ($activity == 'off') {
-               $activity = 'poweroff';
-       }
-       if ($activity == 'poweroff') {
+       if ($activity == HARMONY_OFF) {
                setPlaying('mycanal', 'bureau');
        }
        $wait = 0;
        $current = getCurrentHarmonyActivity();
-       if ($current == 'poweroff' || !$current) {
-               if ($activity == 'tv') {
+       if ($current == HARMONY_OFF) {
+               if ($activity == HARMONY_TV) {
                        $wait = 10;
                }
        }
-       if ($activity !== 'poweroff') {
+       if ($activity !== HARMONY_OFF) {
                ecoMode('0');
        }
-       if ($activity === 'tv') {
+       if ($activity === HARMONY_TV) {
                shieldWakeup('bureau');
        }
 
-       haAction("select.bureau_activities", 'select_option', null, ['option' => $harmonymap[$activity]]);
+       haAction("select.bureau_activities", 'select_option', null, ['option' => $activity]);
        if ($wait > 0) {
                sleep($wait);
        }
-       if ($activity == 'tv') {
+       if ($activity == HARMONY_TV) {
                runAtEnd('sleep(15);haAction(\'script.bureau_projector_on\');');
        }
 }
 
 
 function getCurrentHarmonyActivity() {
-       global $harmonymap;
-       $a = haGetState('select.bureau_activities');
-       if (in_array($a, $harmonymap)) {
-               return array_search($a, $harmonymap);
-       }
-       return false;
+       return haGetState('select.bureau_activities') ?: HARMONY_OFF;
 }
 
 function stopHarmony() {
-       harmonyActivity('off');
+       harmonyActivity(HARMONY_OFF);
 }
\ No newline at end of file
index 69aa537f2e2d375c3c13ba8627551be3a0ff1ab2..3a07112b80c69f8dbce932d9d9981c1411fb5dfb 100644 (file)
@@ -59,9 +59,9 @@ function remoteCmd($cmd, $device)
         return shieldRemoteCommand($cmd, $device);
     } else if ($device == 'bureau') {
         switch (getCurrentHarmonyActivity()) {
-            case 'musique':
+            case HARMONY_MUSIQUE:
                 return remoteCmdSalonMusique($cmd);
-            case 'tv':
+            case HARMONY_TV:
                 return remoteCmdSalonTV($cmd);
         }
         return false;
index 05f133926877d7daebc65e8485640535efef5a0b..20f48aa4375c72e8901da396dfd3c44a806cde52 100644 (file)
@@ -48,9 +48,9 @@ function shieldRunActivity($device = null, $force = false)
     } else if ($device['id'] === 'bureau' || $device['id'] === 'bureausun') {
         stopPlayersIn('bureau', true, false);
         if ($onlySound) {
-            harmonyActivity('musique');
+            harmonyActivity(HARMONY_MUSIQUE);
         } else {
-            harmonyActivity('tv');
+            harmonyActivity(HARMONY_TV);
             if (getState('bureauPlaying', '0') === '0') {
                 execScene('bureau/media/play');
             }
index 4eb4e4b73cb30d4a28f3581337ef8b6b80f8e7da..ad9fab8c4d5eeb348d90eca9f14ae7ec0a2a271f 100644 (file)
@@ -19,8 +19,8 @@ function stopSqueezeboxPlayer($player, $stopIfSync = true, $devices = true)
         } else if ($room === 'sdb') {
             execScene('sdb/ampli/off');
         } else if ($room === 'bureau') {
-            if (getCurrentHarmonyActivity() === 'musique') {
-                harmonyActivity('off');
+            if (getCurrentHarmonyActivity() === HARMONY_MUSIQUE) {
+                harmonyActivity(HARMONY_OFF);
             }
         } else if ($room === 'chambre') {
             denon(false);
@@ -170,7 +170,7 @@ function squeezePlayerOn($player)
             phoneTask('Tortuga', 'sdb');
         }
     } else if ($player == $squeezeboxPlayers['Bureau']) {
-        harmonyActivity('musique');
+        harmonyActivity(HARMONY_MUSIQUE);
     } else if ($player == $squeezeboxPlayers['Chambre']) {
         denon(true);
     }
index f65781f5862ff4d9587f27f1ec66b2a8f58ea910..871973b03bfdd4742d9a743e05d902928a04dc71 100644 (file)
@@ -2,5 +2,5 @@
 require_once "import.php";
 
 if (config('DEVICE') == 'bureau') {
-    harmonyActivity('tv');
+    harmonyActivity(HARMONY_TV);
 }
\ No newline at end of file
index 0b2f3b23d1fe5e3ee3b7db09c37d2f43bd9e5e7c..ca29e8c25a75d0fde4df2c20c6530cae760876cf 100644 (file)
@@ -14,7 +14,7 @@ function shareIntent($content, $device = null)
         $u = parse_url($content);
         if ($u['host'] == 'open.spotify.com') {
             if ($device == 'bureau') {
-                harmonyActivity('musique');
+                harmonyActivity(HARMONY_MUSIQUE);
             }
             $p = explode('/', trim($u['path'], '/'));
             $spotify = 'spotify:' . implode(':', $p);
index 82936f77a4ce884b0cf6d1369b6e412f0089501c..3a138787e28f56385298f1804a9e0f0c4fde006f 100644 (file)
@@ -2,11 +2,11 @@
 require_once "import.php";
 $device = config('DEVICE');
 if ($device == 'bureau' || $device === 'bureausun') {
-    execScene('bureau/media/play');
-    harmonyActivity('switch');
-}else if($device==='salon'){
-    stopPlayersIn('salon', true, false);
-    denonAVROn('Game');
-    execScene('salon/cinema');
-    epson(true);
+       execScene('bureau/media/play');
+       harmonyActivity(HARMONY_SWITCH);
+} else if ($device === 'salon') {
+       stopPlayersIn('salon', true, false);
+       denonAVROn('Game');
+       execScene('salon/cinema');
+       epson(true);
 }
\ No newline at end of file