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

index baaccaed390879d2c7ff0cedc57e2a9225ccd92e..16e899e653c9d674fc641282ab4fbbd0b0feef0b 100644 (file)
@@ -3,9 +3,8 @@
   <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/bureau.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/bureau.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/config/rooms.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/rooms.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/tv.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/tv.php" 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/shield.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/shield.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/scripts/shield.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/shield.php" afterDir="false" />
     </list>
       <workItem from="1603811262372" duration="1988000" />
       <workItem from="1603958541180" duration="5032000" />
       <workItem from="1604042543878" duration="11137000" />
-      <workItem from="1604152329376" duration="17258000" />
-    </task>
-    <task id="LOCAL-00310" summary=".">
-      <created>1583413557785</created>
-      <option name="number" value="00310" />
-      <option name="presentableId" value="LOCAL-00310" />
-      <option name="project" value="LOCAL" />
-      <updated>1583413557786</updated>
+      <workItem from="1604152329376" duration="23940000" />
     </task>
     <task id="LOCAL-00311" summary=".">
       <created>1583566913948</created>
       <option name="project" value="LOCAL" />
       <updated>1604224463669</updated>
     </task>
-    <option name="localTasksCounter" value="359" />
+    <task id="LOCAL-00359" summary=".">
+      <created>1604228663244</created>
+      <option name="number" value="00359" />
+      <option name="presentableId" value="LOCAL-00359" />
+      <option name="project" value="LOCAL" />
+      <updated>1604228663244</updated>
+    </task>
+    <option name="localTasksCounter" value="360" />
     <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="132" y="0" width="737" height="502" key="CommitChangelistDialog2" timestamp="1604224431367">
+    <state x="132" y="0" width="737" height="502" key="CommitChangelistDialog2" timestamp="1604228652265">
       <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="1604224431367" />
+    <state x="132" y="0" width="737" height="502" key="CommitChangelistDialog2/0.0.1707.920@0.0.1707.920" timestamp="1604228652265" />
     <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="635" y="216" key="FileChooserDialogImpl" timestamp="1604227698339">
index 0a61ab6c83ae0d79356d55cae1a8e454896e3347..14beac9b2675ec5a3c29000c829b11163f081f9f 100644 (file)
@@ -18,54 +18,56 @@ if (!$mapdvb) {
 }
 
 $tv = array(
-    'Replay' => array('freebox' => 'replay', 'shield' => 'tv:replay'),
-    'Netflix' => array('freebox' => 'netflix', 'shield' => 'netflix'),
+    'Replay' => array('freebox' => 'replay', 'shield' => 'mycanal:replay:home'),
+    'Netflix' => array('freebox' => 'netflix', 'shield' => 'netflix:home'),
     'Infos',
-    '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'),
+    'France Info' => array('stream' => 'tvheadend:franceinfo:', 'channel' => 27, 'shield' => 'mycanal:live:670'),
+    'Cnews' => array('stream' => 'tvheadend:CNEWS', 'channel' => 16, 'shield' => 'mycanal:live:480'),
+    'BFM TV' => array('stream' => 'tvheadend:BFM TV', 'channel' => 15, 'shield' => 'mycanal:live:633'),
+    'BFM Business' => array('stream' => 'tvheadend:BFM Paris', 'channel' => 347, 'shield' => 'mycanal:live:645'),
+    'LCI' => array('stream' => 'tvheadend:LCI', 'channel' => 26, 'shield' => 'mycanal:live:553'),
+    'Euronews' => array('stream' => 'fbx:205:sd', 'channel' => 345, 'shield' => 'mycanal:live:324'),
     'Généralistes',
-    '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'),
+    'TF1' => array('stream' => 'tvheadend:TF1', 'channel' => 1, 'shield' => 'mycanal:live:312'),
+    'France 2' => array('stream' => 'tvheadend:France 2', 'channel' => 2, 'shield' => 'mycanal:live:26'),
+    'France 3' => array('stream' => 'tvheadend:F3 Paris Ile-de-France', 'channel' => 3, 'shield' => 'mycanal:live:543'),
+    'France 5' => array('stream' => 'tvheadend:France 5', 'channel' => 5, 'shield' => 'mycanal:live:545'),
+    'M6' => array('stream' => 'tvheadend:M6', 'channel' => 6, 'shield' => 'mycanal:live:313'),
+    'Canal +' => array('stream' => 'tvheadend:CANAL+', 'channel' => 4, 'shield' => 'mycanal:live:601'),
+    'Arte' => array('stream' => 'tvheadend:Arte', 'channel' => 7, 'shield' => 'mycanal:live:154'),
+    'C8' => array('stream' => 'tvheadend:C8', 'channel' => 8, 'shield' => 'mycanal:live:450'),
+    'W9' => array('stream' => 'tvheadend:W9', 'channel' => 9, 'shield' => 'mycanal:live:296'),
+    'TMC' => array('stream' => 'tvheadend:TMC', 'channel' => 10, 'shield' => 'mycanal:live:584'),
+    'TFX' => array('stream' => 'tvheadend:TFX', 'channel' => 11, 'shield' => 'mycanal:live:570'),
+    'NRJ12' => array('stream' => 'tvheadend:NRJ12', 'channel' => 12, 'shield' => 'mycanal:live:568'),
+    'LCP' => array('stream' => 'tvheadend:LCP', 'channel' => 13, 'shield' => 'mycanal:live:554'),
+    'France 4' => array('stream' => 'tvheadend:France 4', 'channel' => 14, 'shield' => 'mycanal:live:544'),
+    'CStar' => array('stream' => 'tvheadend:CSTAR', 'channel' => 17, 'shield' => 'mycanal:live:513'),
+    'Gulli' => array('stream' => 'tvheadend:Gulli', 'channel' => 18, 'shield' => 'mycanal:live:549'),
+    'RMC Story' => array('stream' => 'tvheadend:RMC STORY', 'channel' => 23, 'shield' => 'mycanal:live:571'),
+    'RMC Découverte' => array('stream' => 'tvheadend:RMC Découverte', 'channel' => 24, 'shield' => 'mycanal:live:595'),
+    'Chérie 25' => array('stream' => 'tvheadend:Chérie 25', 'channel' => 25, 'shield' => 'mycanal:live:440'),
+    'Paris première' => array('stream' => 'fbx:213:ld', 'channel' => 28, 'shield' => 'mycanal:live:294'),
+    'RTL9' => array('stream' => 'fbx:210:ld', 'channel' => 29, 'shield' => 'mycanal:live:505'),
+    '6ter' => array('stream' => 'tvheadend:6ter', 'channel' => 22, 'shield' => 'mycanal:live:521'),
+    'TF1 Séries Films' => array('stream' => 'tvheadend:TF1 Séries Films', 'channel' => 20, 'shield' => 'mycanal:live:526'),
     'Monde',
-    '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'));
-
+    'TV5 Monde' => array('stream' => 'fbx:206:sd', 'channel' => 1, 'shield' => 'mycanal:live:520'),
+    'France 24' => array('stream' => 'tvheadend:France 24', 'channel' => 340, 'shield' => 'mycanal:live:310'),
+);
 $shortcuts['sub-tv'] = array();
 $tvplayer = config('TVPLAYER');
 foreach ($tv as $name => $service) {
-    if ($tvplayer != 'freebox' && isset($service['freebox'])) {
-        continue;
-    }
+
     if (is_numeric($name)) {
         $shortcuts['sub-tv'][] = array('type' => 'separator', 'label' => $service);
     } else {
-        if ($tvplayer == 'freebox') {
+        if ($tvplayer === 'shield') {
+            if (isset($service['shield'])) {
+                $e = explode(':', $service['shield'], 2);
+                $shortcuts['sub-tv'][] = array('type' => 'shield', 'url' => 'scripts/shield.php?' . $e[0] . '=' . $e[1], 'label' => $name);
+            }
+        } else if ($tvplayer == 'freebox') {
             if (isset($service['channel'])) {
                 $shortcuts['sub-tv'][] = array('type' => 'freebox', 'url' => 'scripts/freeboxchannel.php?channel=' . $service['channel'], 'label' => $name);
             } else {
index b6ea927224ccfc82f6301600f6e1038b969c9e9d..fef067d920850a2e4d34641e179e9949f1e85d12 100644 (file)
@@ -291,7 +291,7 @@ function shortcut($s, $hash)
     } elseif ($s['type'] == 'media') {
         $attrs['href'] = isset($s['path']) ? $s['path'] : $s['url'];
         $attrs['class'] = 'media';
-    } elseif ($s['type'] == 'freebox') {
+    } elseif ($s['type'] == 'freebox' || $s['type']==='shield') {
         $attrs['href'] = $s['url'];
         $attrs['class'] = 'ajax';
         $attrs['data-remote'] = "1";
index bc16aac566dd191fd952013a7282f562bd09e45d..2c906fc192403bc99e27e023842c4331a5234e9a 100644 (file)
@@ -50,18 +50,25 @@ function shieldKey($keys)
         };
         $cmds[] = 'input keyevent ' . $key;
     }
-    shieldCommand('shell', '"' . implode(' && ', $cmds) . '"');
+    shieldCommand('shell', ' "' . implode(' && ', $cmds) . '"');
 }
 
 function shieldNetflix($id = null)
 {
     shieldHome();
     $url = 'http://www.netflix.com/';
-    if (null !== $id) {
+    if (null !== $id && $id !== 'home') {
         $url .= 'watch/' . $id;
     }
+    if ($id === 'home') {
+        shieldKill('netflix');
+    }
     //_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');
     _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');
+    if ($id === 'home') {
+        sleep(6);
+        shieldKey(['ok', 'down']);
+    }
 }
 
 
@@ -95,7 +102,7 @@ function shieldLaunchApp($activity)
     _adb('shell am start', '-n ' . $activity);
 }
 
-function shieldTv($channel = false, $type = 'live')
+function shieldMyCanal($channel = false, $type = 'live')
 {
     if ($type === 'replay') {
         if ($channel === 'arte') {
@@ -105,32 +112,16 @@ function shieldTv($channel = false, $type = 'live')
         }
     }
 
-    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);
+    $url = 'https://www.canalplus.com/live/?channel=' . $channel;
+    _adb('shell am start', '-a android.intent.action.VIEW -f 0x10808000 -d ' . $url . ' com.canal.android.canal/com.canal.app.common.legacy.DeepLinkActivity');
 }
 
 
 function shieldGetKeysToTvChannel($channel)
 {
 
+    $favorites = ['tf1', 'france2', 'france3', 'arte', 'tv5monde', 'bfmtv', 'franceinfo', 'france24'];
+
     $canalchannels = ['tf1', 'france2', 'france3', 'canalplus',
         'france5', 'm6', 'arte', 'polarplus',
         'warnertv', 'serieclub', 'tvbreizh', 'rtl9',
@@ -153,6 +144,9 @@ function shieldGetKeysToTvChannel($channel)
         'lci', 'franceinfo', 'lcp', 'france24',
         'euronews', 'cnn', 'bbcworldnews', 'bfmbusiness',
     ];
+    if (in_array($channel, $favorites)) {
+        return hieldGetKeysToChannel($channel, $channel, 4, ['ok']);
+    }
     return shieldGetKeysToChannel($canalchannels, $channel, 4, ['ok']);
 }
 
@@ -218,12 +212,24 @@ function shieldListApps()
 function shieldFindIntents($app)
 {
     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];
+
+    $app = shieldGetAppId($app);
     _adb('shell pm dump', $app);
     _adb('shell pm dump', $app . ' | grep -A 1 "MAIN" | grep ' . $app . ' | awk \'{print $2}\' | grep ' . $app);
 }
 
+function shieldGetAppId($id = null)
+{
+    $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'];
+    if (null === $id) {
+        return $apps;
+    }
+    if (isset($apps[$id])) {
+        return $apps[$id];
+    }
+    return $id;
+}
+
 function shieldHome()
 {
     $res = shieldKey('home');
@@ -231,13 +237,10 @@ function shieldHome()
     return $res;
 }
 
-function shieldKill()
+function shieldKill($app)
 {
     shieldConnect();
-    $tokill = ['com.canal.android.canal'];
-    foreach ($tokill as $item) {
-        _adb('shell am', 'force-stop ' . $item);
-    }
+    _adb('shell am', 'force-stop ' . shieldGetAppId($app));
 }
 
 
index 068cc3c5d571bae1b348a9df611019f6970b9979..a9b52c9f44929b716f13e0db736e5e8d99875854 100644 (file)
@@ -17,11 +17,16 @@ if (isset($_GET['key'])) {
     shieldFindIntents($_GET['intents']);
 } elseif (isset($_GET['tv'])) {
     shieldTv($_GET['tv']);
+} elseif (isset($_GET['live'])) {
+    shieldTv($_GET['live']);
 } else if (isset($_GET['replay'])) {
     shieldTv($_GET['replay'], 'replay');
 } else if (isset($_GET['vlc'])) {
     shieldVLC($_GET['vlc']);
-}else if (isset($_GET['kodi'])) {
+} else if (isset($_GET['kodi'])) {
     shieldKodi($_GET['kodi']);
+} else if (isset($_GET['mycanal'])) {
+    $e = explode(':', $_GET['mycanal']);
+    shieldMyCanal($e[1], $e[0]);
 }
 echo '</pre>';
\ No newline at end of file