From: Vincent Date: Sun, 1 Nov 2020 13:30:28 +0000 (+0100) Subject: . X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=d5afa760a7d725de80f71ca337a75aedb2d7db1e;p=tortuga-home.git . --- diff --git a/.idea/workspace.xml b/.idea/workspace.xml index baaccae..16e899e 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,9 +3,8 @@ - - - + + @@ -888,14 +887,7 @@ - - - - 1583413557785 - 1583566913948 @@ -1233,7 +1225,14 @@ - @@ -1283,10 +1282,10 @@ - + - + diff --git a/config/tv.php b/config/tv.php index 0a61ab6..14beac9 100644 --- a/config/tv.php +++ b/config/tv.php @@ -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 { diff --git a/scripts/lib/lib.php b/scripts/lib/lib.php index b6ea927..fef067d 100644 --- a/scripts/lib/lib.php +++ b/scripts/lib/lib.php @@ -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"; diff --git a/scripts/lib/shield.php b/scripts/lib/shield.php index bc16aac..2c906fc 100644 --- a/scripts/lib/shield.php +++ b/scripts/lib/shield.php @@ -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)); } diff --git a/scripts/shield.php b/scripts/shield.php index 068cc3c..a9b52c9 100644 --- a/scripts/shield.php +++ b/scripts/shield.php @@ -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 ''; \ No newline at end of file