From: vincent Date: Tue, 8 Mar 2022 14:27:06 +0000 (+0100) Subject: . X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=6e1a9f7155ebe170219ed767a0e55c28485f75b8;p=tortuga-home.git . --- diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 84d19f4..8e401c3 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,8 +3,9 @@ - + + diff --git a/config/tv.php b/config/tv.php index fda8ca8..4503421 100644 --- a/config/tv.php +++ b/config/tv.php @@ -46,6 +46,7 @@ foreach ($replays as $name => $replay) { } $tv = array( + 'Connexion MyCanal' => array('freebox' => 'replay', 'shield' => 'mycanal:connect:home'), 'Replay' => array('freebox' => 'replay', 'shield' => 'mycanal:replay:home'), 'Netflix' => array('freebox' => 'netflix', 'shield' => 'netflix:home'), 'Infos', diff --git a/scripts/lib/shield.php b/scripts/lib/shield.php index 5f239af..4395bd5 100644 --- a/scripts/lib/shield.php +++ b/scripts/lib/shield.php @@ -178,10 +178,41 @@ function shieldLaunchApp($activity, $device = null) } } +function shieldMyCanalConnect($device = null, $force = false) +{ + $d = getDevice($device); + $state = 'mycanallastconnect_' . $d['id']; + $limit = time() - 3600 * 24 * 2; + if (!$force && getState($state, 0) > $limit) { + return; + } + shieldClearAppData('mycanal', $device); + shieldLaunchApp('mycanal', $device); + sleep(7); + shieldKey(['ok'], $device); + sleep(4); + shieldKey(['down', 'down', 'ok', 'down', 'ok'], $device); + sleep(3); + shieldText('fbx18439571', $device); + shieldKey(['back', 'down'], $device); + shieldText('paogaiho', $device); + shieldKey(['back', 'ok']); + sleep(11); + shieldKey(['down', 'ok', 'up', 'ok']); + setState($state, time()); + sleep(5); + return true; +} + function shieldMyCanal($channel = false, $type = 'live', $device = null) { shieldRunActivity($device); - shieldKill('mycanal', $device); + if ($type === 'connect') { + return shieldMyCanalConnect($device, true); + } else { + shieldMyCanalConnect($device); + } + if ($type === 'replay') { if ($channel === 'arte') { shieldArte($device); @@ -199,8 +230,9 @@ function shieldMyCanal($channel = false, $type = 'live', $device = null) } setPlaying('mycanal', $device); + shieldKill('mycanal', $device); shieldHome($device); - shieldCommand('shell am start', '-a android.intent.action.VIEW -f 0x10808000 -d ' . $url . ' com.canal.android.canal/com.canal.app.common.legacy.DeepLinkActivity', $device); + return shieldCommand('shell am start', '-a android.intent.action.VIEW -f 0x10808000 -d ' . $url . ' com.canal.android.canal/com.canal.mycanal.legacy.DeepLinkActivity', $device); } function shieldKodi($file, $device = null) @@ -236,8 +268,8 @@ function shieldListApps($device = null) function shieldFindIntents($app, $device = null) { $app = shieldGetAppId($app); - shieldCommand('shell pm dump', $app, $device); - shieldCommand('shell pm dump', $app . ' | grep -A 1 "MAIN" | grep ' . $app . ' | awk \'{print $2}\' | grep ' . $app, $device); + echo shieldCommand('shell pm dump', $app, $device); + echo shieldCommand('shell pm dump', $app . ' | grep -A 1 "MAIN" | grep ' . $app . ' | awk \'{print $2}\' | grep ' . $app, $device); } function shieldGetAppId($id = null) @@ -362,12 +394,16 @@ function shieldGetCurrentApp($device = null) return null; } +function shieldClearAppData($app, $device = null) +{ + return shieldCommand('shell pm clear', shieldGetAppId($app)); +} function _adb($command, $params = '', $device = null) { $c = _adbcmd($command, $params, $device); $output = `$c`; - // echo $c . ' :: ' . $output . "\n"; + //echo $c . ' :: ' . $output . "\n"; return $output; } diff --git a/scripts/shield.php b/scripts/shield.php index 7966ec5..2696577 100644 --- a/scripts/shield.php +++ b/scripts/shield.php @@ -24,8 +24,10 @@ if (isset($_GET['key'])) { shieldKodi($_GET['kodi'], $device); } else if (isset($_GET['mycanal'])) { $e = explode(':', $_GET['mycanal']); - shieldMyCanal($e[1], $e[0], $device); + echo shieldMyCanal($e[1], $e[0], $device); } else if (isset($_GET['runappback'])) { shieldRunAppAndBackHome($_GET['runappback'], $device); +} else if (isset($_GET['clear'])) { + echo shieldClearAppData($_GET['clear'], $device); } echo ''; \ No newline at end of file