]> _ Git - tortuga-home.git/commitdiff
.
authorVincent <vincent@enhydra.fr>
Sat, 14 Nov 2020 14:42:13 +0000 (15:42 +0100)
committerVincent <vincent@enhydra.fr>
Sat, 14 Nov 2020 14:42:13 +0000 (15:42 +0100)
.idea/workspace.xml
scripts/lib/shield.php

index 99ed3d4fc79072ca998e556704c1cb3b9458f69a..a0cff7bbbf1100b8924e032ed07dc5cf5e51f342 100644 (file)
@@ -2,14 +2,7 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
-      <change afterPath="$PROJECT_DIR$/scripts/lib/proc.php" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/servers/logcat.php" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/servers/logcatb.php" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/servers/logcats.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/lib/lib.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/lib.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/lib/off.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/off.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$/scripts/lib/shield.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/shield.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
       <workItem from="1605087787424" duration="33487000" />
       <workItem from="1605261347643" duration="1199000" />
       <workItem from="1605342171398" duration="4613000" />
-      <workItem from="1605355486465" duration="7740000" />
-    </task>
-    <task id="LOCAL-00341" summary=".">
-      <created>1599316711212</created>
-      <option name="number" value="00341" />
-      <option name="presentableId" value="LOCAL-00341" />
-      <option name="project" value="LOCAL" />
-      <updated>1599316711212</updated>
+      <workItem from="1605355486465" duration="8720000" />
     </task>
     <task id="LOCAL-00342" summary=".">
       <created>1599417770384</created>
       <option name="project" value="LOCAL" />
       <updated>1605261980842</updated>
     </task>
-    <option name="localTasksCounter" value="390" />
+    <task id="LOCAL-00390" summary=".">
+      <created>1605363332633</created>
+      <option name="number" value="00390" />
+      <option name="presentableId" value="LOCAL-00390" />
+      <option name="project" value="LOCAL" />
+      <updated>1605363332633</updated>
+    </task>
+    <option name="localTasksCounter" value="391" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
       <screen x="0" y="0" width="1707" height="920" />
     </state>
     <state x="740" y="229" key="#com.jetbrains.php.refactoring.extractMethod.PhpExtractMethodDialog#function0/0.0.1707.920@0.0.1707.920" timestamp="1604146905948" />
-    <state x="198" y="0" width="737" height="502" key="CommitChangelistDialog2" timestamp="1605261958132">
+    <state x="198" y="0" width="737" height="502" key="CommitChangelistDialog2" timestamp="1605363327295">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
     <state x="132" y="0" width="737" height="502" key="CommitChangelistDialog2/0.0.1707.920@0.0.1707.920" timestamp="1605086955514" />
     <state x="701" y="75" key="CommitChangelistDialog2/0.0.1920.1160@0.0.1920.1160" timestamp="1605188136787" />
-    <state x="198" y="0" width="745" height="567" key="CommitChangelistDialog2/0.0.2560.1040@0.0.2560.1040" timestamp="1605261958132" />
+    <state x="198" y="0" width="745" height="567" key="CommitChangelistDialog2/0.0.2560.1040@0.0.2560.1040" timestamp="1605363327295" />
     <state x="952" y="244" key="FileChooserDialogImpl" timestamp="1605104496549">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
index a9c355407a58bfb400095bada585374f1ad960f8..c56d43665efdcdc91313649106d0d667aee6ed46 100644 (file)
@@ -18,11 +18,17 @@ function shieldConnect($force = false, $device = null)
 
 function shieldSleep($device = null)
 {
+    if (!shieldIsAwake($device)) {
+        return;
+    }
     shieldKey('sleep', $device);
 }
 
 function shieldWakeup($device = null)
 {
+    if (shieldIsAwake($device)) {
+        return;
+    }
     shieldKey('wakeup', $device);
     `curl 'http://192.168.13.60:9000/plugins/Extensions/settings/plugins/CastBridge/settings/basic.html?playerid=b8%3A27%3Aeb%3Af6%3A1d%3A30' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Accept-Language: fr-FR,en;q=0.5' --compressed -H 'Content-Type: application/x-www-form-urlencoded' -H 'Origin: http://192.168.13.60:9000' -H 'Connection: keep-alive' -H 'Referer: http://192.168.13.60:9000/plugins/Extensions/settings/plugins/CastBridge/settings/basic.html' -H 'Cookie: Squeezebox-player=b8%3A27%3Aeb%3Af6%3A1d%3A30; Squeezebox-enableHiDPI=1; Squeezebox-expandPlayerControl=true; Squeezebox-expanded-MY_MUSIC=0; Squeezebox-expanded-RADIO=1; Squeezebox-expanded-PLUGIN_MY_APPS_MODULE_NAME=1; Squeezebox-expanded-FAVORITES=1; Squeezebox-expanded-PLUGINS=0; Squeezebox-playersettings=settings/player/basic.html%3F; Squeezebox-advancedsettings=plugins/CastBridge/settings/basic.html%3F; Squeezebox-expanded-activePlugins=1; Squeezebox-expanded-inactivePlugins=1; Squeezebox-expanded-otherPlugins0=1; securitytoken=1b5a6a8ddf493f1bf1f0787e0de41708' -H 'Upgrade-Insecure-Requests: 1' --data-raw 'saveSettings=1&useAJAX=0&page=PLUGIN_CASTBRIDGE&playerid=b8%3A27%3Aeb%3Af6%3A1d%3A30&player=b8%3A27%3Aeb%3Af6%3A1d%3A30&autorun=on&bin=squeeze2cast-armv6hf&opts=&debugs=&log_limit=-1&configfile=castbridge.xml&autosave=on&upnp_socket=%3F&xmlparams=1&prevseldevice=.common.&seldevice=.common.&codecs=aac%2Cogg%2Cops%2Cogf%2Cflc%2Calc%2Cwav%2Caif%2Cpcm%2Cmp3&sample_rate=96000&encode_mode=thru&encode_level=&encode_bitrate=&encode_rate=&encode_size=&server=%3F&enabled=1&remove_timeout=0&volume_on_play=1&media_volume=50&send_metadata=1&send_coverart=1&enabled.79a3f5f078d67e3b25a6b3dedc624e18=1&enabled.c4f32d227235313d8c59eff43a01350c=1'`;
 }
@@ -40,7 +46,7 @@ function shieldRunActivity($device = null)
 function shieldCommand($command, $params, $device = null)
 {
     shieldConnect(false, $device);
-    _adb($command, $params, $device);
+    return _adb($command, $params, $device);
 }
 
 function shieldText($text, $device = null)
@@ -265,18 +271,26 @@ function shieldLogcat($cases = [], $device = null)
 {
     shieldConnect(false, $device);
     $proc = new proc();
-    $cmd=_adbcmd('logcat', '', $device);
-    echo $cmd."\n";
+    $cmd = _adbcmd('logcat', '', $device);
+    echo $cmd . "\n";
     $proc->open($cmd);
     $proc->on($cases);
     $proc->run();
 }
 
+function shieldIsAwake($device = null)
+{
+    $out = shieldCommand('shell', 'dumpsys power', $device);
+    return strpos($out, 'Display Power: state=ON') !== false;
+}
+
 
 function _adb($command, $params = '', $device = null)
 {
     $c = _adbcmd($command, $params, $device);
-    echo $c . ' :: ' . `$c` . "\n";
+    $output = `$c`;
+    echo $c . ' :: ' . $output . "\n";
+    return $output;
 }
 
 function _adbcmd($command, $params, $device = null)