]> _ Git - tortuga-home.git/commitdiff
.
authorVincent <vincent@enhydra.fr>
Sun, 1 Nov 2020 09:54:21 +0000 (10:54 +0100)
committerVincent <vincent@enhydra.fr>
Sun, 1 Nov 2020 09:54:21 +0000 (10:54 +0100)
.idea/workspace.xml
config/remote.php
config/tv.php
scripts/lib/shield.php
scripts/lib/tmdb.php
scripts/shield.php

index e1541d381c9b6a6f2dabae8ff5a76b4630086a5a..c89f585988fb2dd7bc52a5f1e8295f22098883d1 100644 (file)
@@ -3,8 +3,10 @@
   <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$/config/global.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/global.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/config/remote.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/remote.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/config/tv.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/tv.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/tmdb.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/tmdb.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/scripts/shield.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/shield.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
         <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="1603646440968" duration="3909000" />
       <workItem from="1603811262372" duration="1988000" />
       <workItem from="1603958541180" duration="5032000" />
-      <workItem from="1604042543878" duration="5459000" />
-    </task>
-    <task id="LOCAL-00308" summary=".">
-      <created>1583065717346</created>
-      <option name="number" value="00308" />
-      <option name="presentableId" value="LOCAL-00308" />
-      <option name="project" value="LOCAL" />
-      <updated>1583065717347</updated>
+      <workItem from="1604042543878" duration="11137000" />
+      <workItem from="1604152329376" duration="14038000" />
     </task>
     <task id="LOCAL-00309" summary=".">
       <created>1583309116308</created>
       <option name="project" value="LOCAL" />
       <updated>1603961859962</updated>
     </task>
-    <option name="localTasksCounter" value="357" />
+    <task id="LOCAL-00357" summary=".">
+      <created>1604143127017</created>
+      <option name="number" value="00357" />
+      <option name="presentableId" value="LOCAL-00357" />
+      <option name="project" value="LOCAL" />
+      <updated>1604143127018</updated>
+    </task>
+    <option name="localTasksCounter" value="358" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
     <state x="872" y="161" key="#Plugins/0.0.2560.1040@0.0.2560.1040" timestamp="1596008801840" />
-    <state x="198" y="0" width="745" height="567" key="CommitChangelistDialog2" timestamp="1603961854066">
-      <screen x="0" y="0" width="2560" height="1040" />
+    <state x="740" y="229" key="#com.jetbrains.php.refactoring.extractMethod.PhpExtractMethodDialog#function0" timestamp="1604146905948">
+      <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="132" y="0" width="737" height="502" key="CommitChangelistDialog2" timestamp="1604143114614">
+      <screen x="0" y="0" width="1707" height="920" />
+    </state>
+    <state x="132" y="0" width="737" height="502" key="CommitChangelistDialog2/0.0.1707.920@0.0.1707.920" timestamp="1604143114614" />
     <state x="701" y="75" key="CommitChangelistDialog2/0.0.1920.1160@0.0.1920.1160" timestamp="1602171117745" />
     <state x="198" y="0" width="745" height="567" key="CommitChangelistDialog2/0.0.2560.1040@0.0.2560.1040" timestamp="1603961854066" />
     <state x="1114" y="443" key="NewPhpFileDialog" timestamp="1603958673068">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
     <state x="781" y="165" key="SettingsEditor/0.0.2560.1040@0.0.2560.1040" timestamp="1596008871908" />
+    <state width="498" height="446" key="SwitcherDM" timestamp="1604161134101">
+      <screen x="0" y="0" width="1707" height="920" />
+    </state>
+    <state width="498" height="446" key="SwitcherDM/0.0.1707.920@0.0.1707.920" timestamp="1604161134101" />
     <state x="655" y="270" width="816" height="530" key="Vcs.Push.Dialog.v2" timestamp="1595521362224">
       <screen x="0" y="0" width="1920" height="1160" />
     </state>
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
     <state x="977" y="257" width="607" height="536" key="find.popup/0.0.2560.1040@0.0.2560.1040" timestamp="1603559077781" />
+    <state x="512" y="211" key="run.anything.popup" timestamp="1604146410464">
+      <screen x="0" y="0" width="1707" height="920" />
+    </state>
+    <state x="512" y="211" key="run.anything.popup/0.0.1707.920@0.0.1707.920" timestamp="1604146410464" />
     <state x="90" y="196" width="672" height="678" key="search.everywhere.popup" timestamp="1604043317166">
       <screen x="0" y="0" width="1707" height="920" />
     </state>
index f9feb36771182e5f7b54acdd313cc8332a88cc51..4d7d039e6650d9e88a9510fe775f2792ce35d852 100644 (file)
@@ -21,6 +21,27 @@ $bricksFreebox = ['type' => 'freebox', 'width' => 6, 'height' => 4, 'bricks' =>
     ['type' => 'remote-channels', 'width' => 1, 'height' => 3, 'top' => 0, 'left' => 5],
 ]];
 
+$bricksShield = ['type' => 'freebox', 'width' => 6, 'height' => 4, 'bricks' => [
+    ['type' => 'remote-volume', 'width' => 1, 'height' => 3, 'top' => 1, 'left' => 0],
+    ['type' => 'remote-rew', 'width' => 1, 'height' => 1, 'top' => 0, 'left' => 0],
+    ['type' => 'remote-playpause', 'width' => 2, 'height' => 1, 'top' => 0, 'left' => 1],
+    ['type' => 'remote-rec', 'width' => 1, 'height' => 1, 'top' => 0, 'left' => 4],
+    ['type' => 'remote-light-up', 'width' => 1, 'height' => 1, 'top' => 1, 'left' => 4],
+    ['type' => 'remote-light-down', 'width' => 1, 'height' => 1, 'top' => 2, 'left' => 4],
+    ['type' => 'remote-fwd', 'width' => 1, 'height' => 1, 'top' => 0, 'left' => 3],
+    ['type' => 'remote-free', 'width' => 2, 'height' => 1, 'top' => 3, 'left' => 4],
+    ['type' => 'remote-up', 'width' => 1, 'height' => 1, 'top' => 1, 'left' => 2],
+    ['type' => 'remote-left', 'width' => 1, 'height' => 1, 'top' => 2, 'left' => 1],
+    ['type' => 'remote-down', 'width' => 1, 'height' => 1, 'top' => 3, 'left' => 2],
+    ['type' => 'remote-right', 'width' => 1, 'height' => 1, 'top' => 2, 'left' => 3],
+    ['type' => 'remote-red', 'width' => 1, 'height' => 1, 'top' => 1, 'left' => 1],
+    ['type' => 'remote-blue', 'width' => 1, 'height' => 1, 'top' => 1, 'left' => 1 + 2],
+    ['type' => 'remote-green', 'width' => 1, 'height' => 1, 'top' => 1 + 2, 'left' => 1],
+    ['type' => 'remote-yellow', 'width' => 1, 'height' => 1, 'top' => 1 + 2, 'left' => 1 + 2],
+    ['type' => 'remote-ok', 'width' => 1, 'height' => 1, 'top' => 2, 'left' => 2],
+    ['type' => 'remote-channels', 'width' => 1, 'height' => 3, 'top' => 0, 'left' => 5],
+]];
+
 $bricksSqueezebox = ['type' => 'squeezebox', 'width' => 6, 'height' => 4, 'bricks' => [
     ['type' => 'remote-volume', 'width' => 1, 'height' => 3, 'top' => 0, 'left' => 0],
     ['type' => 'remote-rew', 'width' => 1, 'height' => 1, 'top' => 0, 'left' => 1],
@@ -74,4 +95,5 @@ $shortcuts['remote-squeezebox'] = [['type' => 'bricks', 'bricks' => $bricksSquee
 $shortcuts['remote-raspberrycast'] = [['type' => 'bricks', 'bricks' => $bricksRaspberryCast]];
 $shortcuts['remote-mediarasp'] = [['type' => 'bricks', 'bricks' => $bricksMediarasp]];
 $shortcuts['remote-freebox'] = [['type' => 'bricks', 'bricks' => $bricksFreebox]];
-$shortcuts['remote-omxtv'] = [['type' => 'bricks', 'bricks' => $bricksOMXRaspTV]];
\ No newline at end of file
+$shortcuts['remote-omxtv'] = [['type' => 'bricks', 'bricks' => $bricksOMXRaspTV]];
+$shortcuts['remote-shield'] = [['type' => 'bricks', 'bricks' => $bricksShield]];
\ No newline at end of file
index 1a8d7aa7be27931facd7e945ef92562097beb93b..0a61ab6c83ae0d79356d55cae1a8e454896e3347 100644 (file)
@@ -18,44 +18,43 @@ if (!$mapdvb) {
 }
 
 $tv = array(
-    'Replay' => array('freebox' => 'replay'),
-    'Netflix' => array('freebox' => 'netflix'),
+    'Replay' => array('freebox' => 'replay', 'shield' => 'tv:replay'),
+    'Netflix' => array('freebox' => 'netflix', 'shield' => 'netflix'),
     'Infos',
-    'France Info' => array('stream' => 'tvheadend:franceinfo:', 'channel' => 27),
-    'Cnews' => array('stream' => 'tvheadend:CNEWS', 'channel' => 16),
-    'BFM TV' => array('stream' => 'tvheadend:BFM TV', 'channel' => 15),
-    'BFM Business' => array('stream' => 'tvheadend:BFM Paris', 'channel' => 347),
-    'LCI' => array('stream' => 'tvheadend:LCI', 'channel' => 26),
-    'Euronews' => array('stream' => 'fbx:205:sd', 'channel' => 345),
+    'France Info' => array('stream' => 'tvheadend:franceinfo:', 'channel' => 27,'shield'=>'tv:live:franceinfo'),
+    'Cnews' => array('stream' => 'tvheadend:CNEWS', 'channel' => 16,'shield'=>'tv:live:cnews'),
+    'BFM TV' => array('stream' => 'tvheadend:BFM TV', 'channel' => 15,'shield'=>'tv:live:bfmtv'),
+    'BFM Business' => array('stream' => 'tvheadend:BFM Paris', 'channel' => 347,'shield'=>'tv:live:paris'),
+    'LCI' => array('stream' => 'tvheadend:LCI', 'channel' => 26,'shield'=>'tv:live:lci'),
+    'Euronews' => array('stream' => 'fbx:205:sd', 'channel' => 345,'shield'=>'tv:live:euronews'),
     'Généralistes',
-    'TF1' => array('stream' => 'tvheadend:TF1', 'channel' => 1),
-    'France 2' => array('stream' => 'tvheadend:France 2', 'channel' => 2),
-    'France 3' => array('stream' => 'tvheadend:F3 Paris Ile-de-France', 'channel' => 3),
-    'France 5' => array('stream' => 'tvheadend:France 5', 'channel' => 5),
-    'M6' => array('stream' => 'tvheadend:M6', 'channel' => 6),
-    'Canal +' => array('stream' => 'tvheadend:CANAL+', 'channel' => 4),
-    'Arte' => array('stream' => 'tvheadend:Arte', 'channel' => 7),
-    'C8' => array('stream' => 'tvheadend:C8', 'channel' => 8),
-    'W9' => array('stream' => 'tvheadend:W9', 'channel' => 9),
-    'TMC' => array('stream' => 'tvheadend:TMC', 'channel' => 10),
-    'TFX' => array('stream' => 'tvheadend:TFX', 'channel' => 11),
-    'NRJ12' => array('stream' => 'tvheadend:NRJ12', 'channel' => 12),
-    'LCP' => array('stream' => 'tvheadend:LCP', 'channel' => 13),
-    'France 4' => array('stream' => 'tvheadend:France 4', 'channel' => 14),
-    'CStar' => array('stream' => 'tvheadend:CSTAR', 'channel' => 17),
-    'Gulli' => array('stream' => 'tvheadend:Gulli', 'channel' => 18),
-    'France Ô' => array('stream' => 'tvheadend:France Ô', 'channel' => 19),
-    'RMC Story' => array('stream' => 'tvheadend:RMC STORY', 'channel' => 23),
-    'RMC Découverte' => array('stream' => 'tvheadend:RMC Découverte', 'channel' => 24),
-    'Chérie 25' => array('stream' => 'tvheadend:Chérie 25', 'channel' => 25),
-    'Paris première' => array('stream' => 'fbx:213:ld', 'channel' => 28),
-    'RTL9' => array('stream' => 'fbx:210:ld', 'channel' => 29),
-    '6ter' => array('stream' => 'tvheadend:6ter', 'channel' => 22),
-    'TF1 Séries Films' => array('stream' => 'tvheadend:TF1 Séries Films', 'channel' => 20),
+    'TF1' => array('stream' => 'tvheadend:TF1', 'channel' => 1,'shield'=>'tv:live:tf1'),
+    'France 2' => array('stream' => 'tvheadend:France 2', 'channel' => 2,'shield'=>'tv:live:france2'),
+    'France 3' => array('stream' => 'tvheadend:F3 Paris Ile-de-France', 'channel' => 3,'shield'=>'tv:live:france3'),
+    'France 5' => array('stream' => 'tvheadend:France 5', 'channel' => 5,'shield'=>'tv:live:france5'),
+    'M6' => array('stream' => 'tvheadend:M6', 'channel' => 6,'shield'=>'tv:live:m6'),
+    'Canal +' => array('stream' => 'tvheadend:CANAL+', 'channel' => 4,'shield'=>'tv:live:canalplus'),
+    'Arte' => array('stream' => 'tvheadend:Arte', 'channel' => 7,'shield'=>'tv:live:arte'),
+    'C8' => array('stream' => 'tvheadend:C8', 'channel' => 8,'shield'=>'tv:live:c8'),
+    'W9' => array('stream' => 'tvheadend:W9', 'channel' => 9,'shield'=>'tv:live:w9'),
+    'TMC' => array('stream' => 'tvheadend:TMC', 'channel' => 10,'shield'=>'tv:live:tmc'),
+    'TFX' => array('stream' => 'tvheadend:TFX', 'channel' => 11,'shield'=>'tv:live:tfx'),
+    'NRJ12' => array('stream' => 'tvheadend:NRJ12', 'channel' => 12,'shield'=>'tv:live:nrj12'),
+    'LCP' => array('stream' => 'tvheadend:LCP', 'channel' => 13,'shield'=>'tv:live:lcp'),
+    'France 4' => array('stream' => 'tvheadend:France 4', 'channel' => 14,'shield'=>'tv:live:france4'),
+    'CStar' => array('stream' => 'tvheadend:CSTAR', 'channel' => 17,'shield'=>'tv:live:cstar'),
+    'Gulli' => array('stream' => 'tvheadend:Gulli', 'channel' => 18,'shield'=>'tv:live:gulli'),
+    'RMC Story' => array('stream' => 'tvheadend:RMC STORY', 'channel' => 23,'shield'=>'tv:live:rmcstory'),
+    'RMC Découverte' => array('stream' => 'tvheadend:RMC Découverte', 'channel' => 24,'shield'=>'tv:live:rmcdecouverte'),
+    'Chérie 25' => array('stream' => 'tvheadend:Chérie 25', 'channel' => 25,'shield'=>'tv:live:cherie25'),
+    'Paris première' => array('stream' => 'fbx:213:ld', 'channel' => 28,'shield'=>'tv:live:parispremiere'),
+    'RTL9' => array('stream' => 'fbx:210:ld', 'channel' => 29,'shield'=>'tv:live:rtl9'),
+    '6ter' => array('stream' => 'tvheadend:6ter', 'channel' => 22,'shield'=>'tv:live:6ter'),
+    'TF1 Séries Films' => array('stream' => 'tvheadend:TF1 Séries Films', 'channel' => 20,'shield'=>'tv:live:tf1seriesfilms'),
     'Monde',
-    'TV5 Monde' => array('stream' => 'fbx:206:sd', 'channel' => 1),
-    'France 24' => array('stream' => 'tvheadend:France 24', 'channel' => 340),
-    'TVE I' => array('stream' => 'fbx:306:sd', 'channel' => 537));
+    'TV5 Monde' => array('stream' => 'fbx:206:sd', 'channel' => 1,'shield'=>'tv:live:tv5monde'),
+    'France 24' => array('stream' => 'tvheadend:France 24', 'channel' => 340,'shield'=>'tv:live:france24'),
+    'TVE I' => array('stream' => 'fbx:306:sd', 'channel' => 537,'shield'=>'tv:live:tvei'));
 
 $shortcuts['sub-tv'] = array();
 $tvplayer = config('TVPLAYER');
index a3f9f8a7a6584b13eccd42beaa7b4d9eea1f600d..ca9275f5a27849ae0d6815f0ea36978e04a2e65e 100644 (file)
@@ -6,9 +6,8 @@ function shieldConnect()
 {
     global $shieldConnect;
     if (!$shieldConnect) {
-        //_adb('kill-server');
-        //_adb('start-server');
-        //_adb('connect', SHIELD_HOST);
+        $shieldConnect = true;
+        _adb('connect', SHIELD_HOST);
     }
 }
 
@@ -23,7 +22,7 @@ function shieldText($text)
     shieldCommand('shell', 'input text ' . $text);
 }
 
-function shieldKey($key)
+function shieldKey($keys)
 {
     $map = ['right' => 'KEYCODE_DPAD_RIGHT',
         'up' => 'KEYCODE_DPAD_UP',
@@ -38,11 +37,20 @@ function shieldKey($key)
         'play' => 'KEYCODE_MEDIA_PLAY',
         'pause' => 'KEYCODE_MEDIA_PAUSE',
         'stop' => 'KEYCODE_MEDIA_STOP',
+        'space' => 'KEYCODE_SPACE',
     ];
-    if (isset($map[$key])) {
-        $key = $map[$key];
+    if (!is_array($keys)) {
+        $keys = [$keys];
     }
-    shieldCommand('shell', 'input keyevent ' . $key);
+
+    $cmds = [];
+    foreach ($keys as $key) {
+        if (isset($map[$key])) {
+            $key = $map[$key];
+        };
+        $cmds[] = 'input keyevent ' . $key;
+    }
+    shieldCommand('shell', '"' . implode(' && ', $cmds) . '"');
 }
 
 function shieldNetflix($id = null)
@@ -56,20 +64,156 @@ function shieldNetflix($id = null)
     _adb('shell am start', ' -c android.intent.category.LEANBACK_LAUNCHER -a android.intent.action.VIEW -f 0x10808000 -e source 30 -d ' . $url . ' com.netflix.ninja/.MainActivity');
 }
 
-function shieldTVChannel()
+
+function shieldTVCommand($cmd)
+{
+    $e = explode(':', $cmd);
+    if ($e[0] === 'netflix') {
+        shieldNetflix(isset($e[1]) ? $e[1] : null);
+    } else if ($e[0] === 'tv') {
+        if ($e[1] === 'replay') {
+            shieldTV(false, 'replay');
+        } else if ($e[1] === 'live') {
+            shieldTV($e[2], 'live');
+        }
+    }
+}
+
+function shieldArte()
+{
+    return shieldLaunchApp('tv.arte.plus7/.leanback.MainActivity');
+}
+
+function shieldFranceTv()
+{
+    return shieldLaunchApp('fr.francetv.pluzz/fr.francetv.androidtv.main.MainActivity');
+}
+
+function shieldLaunchApp($activity)
 {
+    shieldHome();
+    _adb('shell am start', '-n ' . $activity);
+}
+
+function shieldTv($channel = false, $type = 'live')
+{
+    if ($type === 'replay') {
+        if ($channel === 'arte') {
+            return shieldArte();
+        } else if ($channel === 'francetv') {
+            return shieldFranceTv();
+        }
+    }
+
+    shieldHome();
+    $url = 'mycanaltvlauncher://startapp';
+    _adb('shell am start', '-a android.intent.action.VIEW -f 0x10808000 -d ' . $url . ' com.canal.android.canal/com.canal.ui.tv.TvMainActivity');
+    sleep(1);
+    $keys = ['left', 'left', 'left', 'left', 'left', 'left', 'up', 'up', 'up', 'up', 'up', 'up', 'down'];
 
+    if ($type === 'live') {
+        $keys = array_merge($keys, ['down', 'right', 'down']);
+        if ($channel) {
+            $keys = array_merge($keys, shieldGetKeysToTvChannel($channel));
+
+        }
+    } else if ($type === 'replay') {
+        $keys = array_merge($keys, ['down', 'down', 'right', 'down', 'down']);
+        if ($channel) {
+            $keys = array_merge($keys, shieldGetKeysToReplayChannel($channel));
+        }
+    }
+
+    shieldKey($keys);
+}
+
+
+function shieldGetKeysToTvChannel($channel)
+{
+
+    $canalchannels = ['tf1', 'france2', 'france3', 'canalplus',
+        'france5', 'm6', 'arte', 'polarplus',
+        'warnertv', 'serieclub', 'tvbreizh', 'rtl9',
+        'ab1', 'novelas', 'tf1seriesfilms', 'infosportplus',
+        'eurosport1', 'eurosport2', 'automoto', 'equidia',
+        'lequipetv', 'comedieplus', 'olympiatv', 'nonstoppeople',
+        'parispremiere', 'teva', 'bet', 'c8',
+        'w9', 'tmc', 'tfx', 'nrj12',
+        'cstar', '6ter', 'rmcstory', 'cherie25',
+        'tv5monde', 'planeteplus', 'planetepluscrime', 'planeteplusae',
+        'voyage', 'museumtv', 'nationalgeographic', 'nationalgeographicwild',
+        '', '', '', '',
+        'rmcdecouverte', '', '', '',
+        '', '', '', '',
+        '', '', '', '',
+        '', 'france4', 'gulli', '',
+        '', '', '', '',
+        '', '', '', '',
+        '', 'lachainemeteo', 'cnews', 'bfmtv',
+        'lci', 'franceinfo', 'lcp', 'france24',
+        'euronews', 'cnn', 'bbcworldnews', 'bfmbusiness',
+    ];
+    return shieldGetKeysToChannel($canalchannels, $channel, 4, ['ok']);
+}
+
+function shieldGetKeysToReplayChannel($channel)
+{
+
+    $replaychannels = ['tf1', 'france2', 'france3', 'france5', 'm6',
+        'arte', 'polarplus', 'warnertv', 'serieclub', 'hello',
+        'tvbreizh', 'rtl9', 'ab1', 'novelas', 'eurosport',
+        'automoto', 'equidia', 'comedieplus', 'olympiatv', 'nonstoppeople',
+        'parispremiere', 'teva', 'bet', 'c8', 'w9',
+        'cstar', '6ter', 'planeteplus', 'voyage', 'museumtv',
+        'nationalgeographic', 'nationalgeographicwild', '', '', '',
+        'rmcdecouverte', '', '', '', '',
+        '', '', '', '', '',
+        '', '', '', 'france4', 'gulli',
+
+    ];
+    return shieldGetKeysToChannel($replaychannels, $channel, 5, ['ok']);
+}
+
+function shieldGetKeysToChannel($list, $channel, $perline = 4, $sendAfter = [])
+{
+    $res = [];
+    $index = array_search($channel, $list);
+    if ($index === false) {
+        return $res;
+    }
+
+    $col = $index % $perline;
+    $lines = ($index - $col) / $perline;
+
+    for ($i = 0; $i < $lines; $i++) {
+        $res[] = 'down';
+    }
+    for ($i = 0; $i < $col; $i++) {
+        $res[] = 'right';
+    }
+    $res[] = array_merge($res, $sendAfter);
+    return $res;
+}
+
+function shieldVLC($file)
+{
+    shieldHome();
+    $url = 'smb://Share:dcfyjbcyckwydtgufjx@192.168.13.4/Share/' . $file;
+    _adb('shell am start', '-a android.intent.action.VIEW  -d \'"' . $url . '"\' -n org.xbmc.kodi/.Splash');
 }
 
 function shieldListApps()
 {
+    shieldConnect();
     _adb('shell pm list', 'packages -f');
 }
 
 function shieldFindIntents($app)
 {
-    $apps = ['netflix' => 'com.netflix.ninja', 'mycanal' => 'com.canal.android.canal'];
+    shieldConnect();
+    $apps = ['kodi' => 'org.xbmc.kodi', 'vlc' => 'org.videolan.vlc', 'netflix' => 'com.netflix.ninja', 'mycanal' => 'com.canal.android.canal', 'arte' => 'tv.arte.plus7', 'francetv' => 'fr.francetv.pluzz'];
     $app = $apps[$app];
+    _adb('shell pm dump', $app);
     _adb('shell pm dump', $app . ' | grep -A 1 "MAIN" | grep ' . $app . ' | awk \'{print $2}\' | grep ' . $app);
 }
 
@@ -82,7 +226,8 @@ function shieldHome()
 
 function shieldKill()
 {
-    $tokill = ['com.netflix.ninja'];
+    shieldConnect();
+    $tokill = ['com.canal.android.canal'];
     foreach ($tokill as $item) {
         _adb('shell am', 'force-stop ' . $item);
     }
index 13ec69423725c9a693e4d94b2339af469f93fa1a..d5e85df66e99d1096dfab3a1fba4e3e04b094604 100644 (file)
@@ -131,12 +131,14 @@ class tvShowLibrary extends mediaLibrary
                     @rename($f->getPathname(), str_replace('.tmbd.id', '.tmdb.id', $f->getPathname()));
                     continue;
                 }
-                if ($f->isDir() || ($f->getFilename() != '.tmdb.id')) {
+                if ($f->isDir() || strpos($f->getFilename(), '.tmdb.id') === false) {
                     continue;
                 }
+                $file = str_replace('.tmdb.id', '', $f->getPathname());
+                $dir = file_exists($file) && is_file($file) ? file_get_contents($file) : $f->getPath();
 
                 $id = file_get_contents($f->getPathname());
-                $this->tvShows[] = ['type' => 'tvshow', 'dir' => $f->getPath(), 'data' => $this->getTVShowByID($id), 'id' => $id, 'mtime' => $this->dirfilemtime($f->getPath(), true)];
+                $this->tvShows[] = ['type' => 'tvshow', 'dir' => $dir, 'data' => $this->getTVShowByID($id), 'id' => $id, 'mtime' => $this->dirfilemtime($f->getPath(), true)];
             }
         }
 
@@ -195,6 +197,14 @@ class tvShowLibrary extends mediaLibrary
     public function shortcut($tvShow, $prefix, &$res)
     {
         global $videoExt;
+
+
+        $e = explode(':', $tvShow['dir']);
+        if ($e[0] === 'netflix') {
+            $res['shortcuts'][] = ['label' => $tvShow['data']['name'], 'type' => 'media', 'path' => $tvShow['dir'], 'poster' => $this->_poster($tvShow['data']['poster_path'])];
+            return;
+        }
+
         $subname = $prefix . 'tvshow-' . $tvShow['id'];
         $res['shortcuts'][] = ['label' => $tvShow['data']['name'], 'type' => 'sub', 'sub' => $subname, 'poster' => $this->_poster($tvShow['data']['poster_path'])];
 
index 65d331b6bc553384cf80b9df1d8b3c185bdef9ab..d92ec3a06f509d7fac12c873af8be16765eae5af 100644 (file)
@@ -13,5 +13,13 @@ if (isset($_GET['key'])) {
     if ($_GET['action'] == 'apps') {
         shieldListApps();
     }
+} else if (isset($_GET['intents'])) {
+    shieldFindIntents($_GET['intents']);
+} elseif (isset($_GET['tv'])) {
+    shieldTv($_GET['tv']);
+} else if (isset($_GET['replay'])) {
+    shieldTv($_GET['replay'], 'replay');
+} else if (isset($_GET['vlc'])) {
+    shieldVLC($_GET['vlc']);
 }
 echo '</pre>';
\ No newline at end of file