]> _ Git - tortuga-home.git/commitdiff
.
authorVincent <vincent@enhydra.fr>
Mon, 14 Dec 2020 09:32:37 +0000 (10:32 +0100)
committerVincent <vincent@enhydra.fr>
Mon, 14 Dec 2020 09:32:37 +0000 (10:32 +0100)
.idea/workspace.xml
config/global.php
scripts/cron/cron.php
scripts/lib/shield.php
scripts/lib/squeezebox.php
scripts/shield.php
servers/logcat.php

index 5752476e6dbf0441650c19d8c0276d4aa43f7175..00a1b33c44a909b964f9d87c638bf843ee0aa7e0 100644 (file)
@@ -3,8 +3,12 @@
   <component name="ChangeListManager">
     <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/lib/pc.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/pc.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/lib/scenes.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/scenes.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/config/global.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/global.php" 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/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/shield.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/shield.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/servers/logcat.php" beforeDir="false" afterPath="$PROJECT_DIR$/servers/logcat.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
         <option name="Make" enabled="true" />
       </method>
     </configuration>
+    <configuration default="true" type="ArquillianJUnit" factoryName="" nameIsGenerated="true">
+      <option name="arquillianRunConfiguration">
+        <value>
+          <option name="containerStateName" value="" />
+        </value>
+      </option>
+      <option name="TEST_OBJECT" value="class" />
+      <method v="2">
+        <option name="Make" enabled="true" />
+      </method>
+    </configuration>
     <configuration default="true" type="ArquillianTestNG" factoryName="">
       <option name="arquillianRunConfiguration">
         <value>
       <workItem from="1607439614302" duration="1182000" />
       <workItem from="1607546452054" duration="634000" />
       <workItem from="1607872973632" duration="1438000" />
-      <workItem from="1607932840253" duration="607000" />
-    </task>
-    <task id="LOCAL-00372" summary=".">
-      <created>1604521524933</created>
-      <option name="number" value="00372" />
-      <option name="presentableId" value="LOCAL-00372" />
-      <option name="project" value="LOCAL" />
-      <updated>1604521524933</updated>
+      <workItem from="1607932840253" duration="4147000" />
     </task>
     <task id="LOCAL-00373" summary=".">
       <created>1604522275963</created>
       <option name="project" value="LOCAL" />
       <updated>1607546493722</updated>
     </task>
-    <option name="localTasksCounter" value="421" />
+    <task id="LOCAL-00421" summary=".">
+      <created>1607933724635</created>
+      <option name="number" value="00421" />
+      <option name="presentableId" value="LOCAL-00421" />
+      <option name="project" value="LOCAL" />
+      <updated>1607933724636</updated>
+    </task>
+    <option name="localTasksCounter" value="422" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
index 1549b8fc108b2548ad8cade1f0b4e69d04b03731..2bc3162a0d54a4f4699c60c92fdedb8348d7cebc 100644 (file)
@@ -24,7 +24,8 @@ $squeezeboxPlayers = array(
     'Lit Jérôme' => 'b8:27:eb:62:d3:ce',
     'Lit Vincent' => 'b8:27:eb:40:0e:e9',
     //'Bureau' => 'b8:27:eb:f6:1d:30',
-    'Bureau' => 'cc:cc:2d:2a:b5:35',
+    //'Bureau' => 'cc:cc:2d:2a:b5:35',
+    'Bureau' => '7e:23:f6:33:1d:3b',
 );
 
 $phones = array('vincent' => array(
index 7e7a35c3b055a2697b62f1fe48ec4d177ccb6e58..b5b96ce830e951a835428ab23f48f7f6b0805915 100644 (file)
@@ -21,6 +21,9 @@ function cronOneLoop($cronmin)
     if ($cronmin % 10 == 0) {
         cronSqueezeFavorites($cronmin);
     }
+    if ($cronmin % 20 == 0) {
+        cronSqueezeCheckPlayers($cronmin);
+    }
 
     if ($cronmin % 2 == 0) {
         cronPing($cronmin);
@@ -189,6 +192,18 @@ function cronSqueezeFavorites($cronmin)
     }
 }
 
+function cronSqueezeCheckPlayers($cronmin)
+{
+    _logSection('Check squeezebox players');
+    $players = ['Salon' => 'salon', 'Bureau' => 'bureau'];
+    foreach ($players as $player => $device) {
+        if (getSqueezePlayerStatus($player) === -1) {
+            shieldRunAppAndBackHome('sbplayer', $device, 1, true);
+            sleep(5);
+        }
+    }
+}
+
 function cronWeather($cronmin)
 {
     _logSection('Weather');
index 70277b5d840e7c0e3b5b16c28132088a62ab1e52..60751fd76696bcfecd3523388d29cdc3caf7bc27 100644 (file)
@@ -147,10 +147,20 @@ function shieldFranceTv($device = null)
     shieldLaunchApp('fr.francetv.pluzz/fr.francetv.androidtv.main.MainActivity', $device);
 }
 
-function shieldLaunchApp($activity, $device)
+function shieldLaunchApp($activity, $device=null)
 {
     shieldHome($device);
-    shieldCommand('shell am start', '-n ' . $activity, $device);
+
+    echo $activity;
+
+    if (strpos($activity, '/') === false) {
+        if (strpos($activity, '.') === false) {
+            $activity = shieldGetAppId($activity);
+        }
+        shieldCommand('shell monkey', '-p ' . $activity.' 1', $device);
+    } else {
+        shieldCommand('shell am start', '-n ' . $activity, $device);
+    }
 }
 
 function shieldMyCanal($channel = false, $type = 'live', $device = null)
@@ -202,7 +212,7 @@ function shieldVLC($file, $device = null)
 
 function shieldListApps($device = null)
 {
-    shieldCommand('shell pm list', 'packages -f', $device);
+    echo shieldCommand('shell pm list', 'packages -f', $device);
 }
 
 function shieldFindIntents($app, $device)
@@ -240,9 +250,35 @@ function shieldGetApps()
         'dailymotion' => 'com.dailymotion.dailymotion',
         'vimeo' => 'com.vimeo.android.videoapp',
         'plex' => 'com.plexapp.android',
+        'sbplayer' => 'com.angrygoat.android.sbplayer',
+        'spotify' => 'com.spotify.tv.android',
+        'steamlink' => 'com.valvesoftware.steamlink',
     ];
 }
 
+function shieldRunAppAndBackHome($app, $device = null, $waitBeforeBack = 1, $backToSleep = true)
+{
+
+    if (shieldIsAwake($device)) {
+        $backToSleep = false;
+    }
+    if ($backToSleep) {
+        $d = getDevice($device);
+        $s = 'maskShield' . ucfirst($d['id']) . 'Wakeup';
+        setState($s, '1');
+    }
+    echo 'shieldLaunchApp :: '.$app."\n";
+    shieldLaunchApp($app, $device);
+    sleep($waitBeforeBack);
+     echo 'shieldHome'."\n";
+    shieldHome($device);
+    if ($backToSleep) {
+        shieldSleep($device);
+        sleep(1);
+        setState($s, '0');
+    }
+}
+
 function shieldHome($device = null)
 {
     shieldWakeup($device);
@@ -298,11 +334,12 @@ function shieldGetCurrentApp($device = null)
 }
 
 
+
 function _adb($command, $params = '', $device = null)
 {
     $c = _adbcmd($command, $params, $device);
     $output = `$c`;
-    // echo $c . ' :: ' . $output . "\n";
+    echo $c . ' :: ' . $output . "\n";
     return $output;
 }
 
index 63efbaa8fdda8e75ee57a8fb5d0fcc05183b57c0..47378cdc80ff0bcff0f1625c86f6a05ce47e449b 100644 (file)
@@ -24,10 +24,14 @@ function stopAllSqueezebox()
 function getSqueezePlayerStatus($player = '')
 {
     $res = _squeezeRequest('mode ?', $player);
+    if (null === $res) {
+        return -1;
+    }
+
     if (!isset($res['result']) || !isset($res['result']['_mode'])) {
         return false;
     }
-    return $res['result']['_mode'] == 'play';
+    return $res['result']['_mode'] == 'play' ? 1 : 0;
 }
 
 function stopSqueezebox($player)
index c33f62488c62e1f811c555d40b863f5bcd19e6e4..4c5d3668eb4c61fcdd6d5c81b6b0553b405f43ce 100644 (file)
@@ -30,5 +30,7 @@ if (isset($_GET['key'])) {
 } else if (isset($_GET['mycanal'])) {
     $e = explode(':', $_GET['mycanal']);
     shieldMyCanal($e[1], $e[0]);
+} else if (isset($_GET['runappback'])) {
+    shieldRunAppAndBackHome($_GET['runappback']);
 }
 echo '</pre>';
\ No newline at end of file
index 7ec133476a1e2268c3825686e71933a908881caf..90344a0c8538e36f217bf9c1251d56d170c54474 100644 (file)
@@ -26,7 +26,7 @@ $cases = [
         if (getState($state, '0') == '1') {
             setState($state, '0');
         } else {
-            if (!getSqueezePlayerStatus($squeezePlayer)) {
+            if (getSqueezePlayerStatus($squeezePlayer) === 0) {
                 shieldRunActivity($device);
             } else {
                 execScene('bureau/sound/on');