]> _ Git - tortuga-home.git/commitdiff
.
authorVincent <vincent@enhydra.fr>
Sun, 1 Nov 2020 17:52:52 +0000 (18:52 +0100)
committerVincent <vincent@enhydra.fr>
Sun, 1 Nov 2020 17:52:52 +0000 (18:52 +0100)
14 files changed:
.idea/workspace.xml
config/remote.php
config/tv.php
scripts/freeboxchannel.php
scripts/lib/bricks.php
scripts/lib/freebox.php
scripts/lib/lib.php
scripts/lib/mediarasp.php
scripts/lib/remoteinfos.php
scripts/lib/shield.php
scripts/lib/tmdb.php
scripts/netflix.php [new file with mode: 0644]
style/style.css
style/style.less

index 16e899e653c9d674fc641282ab4fbbd0b0feef0b..8971d94cf346d80d8769cd803811f13419786de9 100644 (file)
@@ -2,11 +2,20 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
+      <change afterPath="$PROJECT_DIR$/scripts/netflix.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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/freeboxchannel.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/freeboxchannel.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/bricks.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/bricks.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/freebox.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/freebox.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/mediarasp.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/mediarasp.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/remoteinfos.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/remoteinfos.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" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/tmdb.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/tmdb.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/style/style.css" beforeDir="false" afterPath="$PROJECT_DIR$/style/style.css" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/style/style.less" beforeDir="false" afterPath="$PROJECT_DIR$/style/style.less" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
       <workItem from="1603811262372" duration="1988000" />
       <workItem from="1603958541180" duration="5032000" />
       <workItem from="1604042543878" duration="11137000" />
-      <workItem from="1604152329376" duration="23940000" />
-    </task>
-    <task id="LOCAL-00311" summary=".">
-      <created>1583566913948</created>
-      <option name="number" value="00311" />
-      <option name="presentableId" value="LOCAL-00311" />
-      <option name="project" value="LOCAL" />
-      <updated>1583566913949</updated>
-    </task>
-    <task id="LOCAL-00312" summary=".">
-      <created>1583567632871</created>
-      <option name="number" value="00312" />
-      <option name="presentableId" value="LOCAL-00312" />
-      <option name="project" value="LOCAL" />
-      <updated>1583567632871</updated>
+      <workItem from="1604152329376" duration="35013000" />
     </task>
     <task id="LOCAL-00313" summary=".">
       <created>1583689851384</created>
       <option name="project" value="LOCAL" />
       <updated>1604228663244</updated>
     </task>
-    <option name="localTasksCounter" value="360" />
+    <task id="LOCAL-00360" summary=".">
+      <created>1604237429974</created>
+      <option name="number" value="00360" />
+      <option name="presentableId" value="LOCAL-00360" />
+      <option name="project" value="LOCAL" />
+      <updated>1604237429974</updated>
+    </task>
+    <task id="LOCAL-00361" summary=".">
+      <created>1604237480617</created>
+      <option name="number" value="00361" />
+      <option name="presentableId" value="LOCAL-00361" />
+      <option name="project" value="LOCAL" />
+      <updated>1604237480617</updated>
+    </task>
+    <option name="localTasksCounter" value="362" />
     <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="1604228652265">
+    <state x="132" y="0" width="737" height="502" key="CommitChangelistDialog2" timestamp="1604237478231">
       <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="1604228652265" />
+    <state x="132" y="0" width="737" height="502" key="CommitChangelistDialog2/0.0.1707.920@0.0.1707.920" timestamp="1604237478231" />
     <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">
       <screen x="0" y="0" width="1707" height="920" />
     </state>
     <state x="635" y="216" key="FileChooserDialogImpl/0.0.1707.920@0.0.1707.920" timestamp="1604227698339" />
-    <state x="1114" y="443" key="NewPhpFileDialog" timestamp="1603958673068">
-      <screen x="0" y="0" width="2560" height="1040" />
+    <state x="743" y="392" key="NewPhpFileDialog" timestamp="1604238041494">
+      <screen x="0" y="0" width="1707" height="920" />
     </state>
+    <state x="743" y="392" key="NewPhpFileDialog/0.0.1707.920@0.0.1707.920" timestamp="1604238041494" />
     <state x="1114" y="443" key="NewPhpFileDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1603958673068" />
     <state x="781" y="165" key="SettingsEditor" timestamp="1596008871908">
       <screen x="0" y="0" width="2560" height="1040" />
       <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">
+    <state x="90" y="196" width="672" height="678" key="search.everywhere.popup" timestamp="1604252585347">
       <screen x="0" y="0" width="1707" height="920" />
     </state>
-    <state x="90" y="196" width="672" height="678" key="search.everywhere.popup/0.0.1707.920@0.0.1707.920" timestamp="1604043317166" />
+    <state x="90" y="196" width="672" height="678" key="search.everywhere.popup/0.0.1707.920@0.0.1707.920" timestamp="1604252585347" />
+  </component>
+  <component name="XDebuggerManager">
+    <breakpoint-manager>
+      <breakpoints>
+        <line-breakpoint enabled="true" type="php">
+          <url>file://$PROJECT_DIR$/scripts/lib/freebox.php</url>
+          <option name="timeStamp" value="2" />
+        </line-breakpoint>
+      </breakpoints>
+    </breakpoint-manager>
   </component>
   <component name="antWorkspaceConfiguration">
     <option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
index 4d7d039e6650d9e88a9510fe775f2792ce35d852..a48a27b1eb6327c86d71f1030b9f05dab19cd123 100644 (file)
@@ -21,25 +21,20 @@ $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' => [
+$bricksShield = ['type' => 'shield', 'width' => 4, '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-light-down', 'width' => 1, 'height' => 1, 'top' => 1, 'left' => 3],
     ['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],
+    ['type' => 'remote-shield-back', 'width' => 1, 'height' => 1, 'top' => 1, 'left' => 1],
+    ['type' => 'remote-shield-menu', 'width' => 1, 'height' => 1, 'top' => 1 + 2, 'left' => 1],
+    ['type' => 'remote-shield-home', 'width' => 1, 'height' => 1, 'top' => 1 + 2, 'left' => 1 + 2],
+    ['type' => 'remote-shield-ok', 'width' => 1, 'height' => 1, 'top' => 2, 'left' => 2],
 ]];
 
 $bricksSqueezebox = ['type' => 'squeezebox', 'width' => 6, 'height' => 4, 'bricks' => [
index 14beac9b2675ec5a3c29000c829b11163f081f9f..ff0ddf7257568ba98f80800df8c0e95280163085 100644 (file)
@@ -71,7 +71,7 @@ foreach ($tv as $name => $service) {
             if (isset($service['channel'])) {
                 $shortcuts['sub-tv'][] = array('type' => 'freebox', 'url' => 'scripts/freeboxchannel.php?channel=' . $service['channel'], 'label' => $name);
             } else {
-                $shortcuts['sub-tv'][] = array('type' => 'freebox', 'url' => 'scripts/freeboxchannel.php?menu=' . $service['freebox'], 'label' => $name);
+                $shortcuts['sub-tv'][] = array('type' => 'freebox', 'url' => 'scripts/freeboxchannel.php?channel=' . $service['freebox'], 'label' => $name);
             }
         } else {
             $e = explode(':', $service['stream'], 3);
index 9c7d40d7dfa80f8415d5f7bd6f5eda424bd1fa5a..271e6cfa2d4689eb41613f58e30002a39218decc 100644 (file)
@@ -1,18 +1,3 @@
 <?php
 require_once "import.php";
-$currentActivity = getCurrentHarmonyActivity();
-harmonyActivity('tv');
-if (isset($_GET['channel'])) {
-    $commands = array_merge(['ok', 'pause=5'], str_split((string)$_GET['channel']));
-} else if (isset($_GET['menu']) && $_GET['menu'] == 'replay') {
-    $commands = ['right', 'ok', 'pause=5', 'down', 'down', 'down', 'down', 'down'];
-} else if (isset($_GET['menu']) && $_GET['menu'] == 'netflix') {
-    $commands = ['right', 'down', 'down', 'down', 'ok', 'pause=25', 'ok', 'pause=5', 'down'];
-}
-$keys = array_merge(array('home', 'pause=2', 'home', 'pause=1', 'home', 'left', 'right', 'home'), $commands);
-
-if ($currentActivity != 'tv') {
-    sleep(50);
-}
-print_r($keys);
-freeboxKey($keys);
+freeboxChannel($_GET['channel']);
index ddc9b80c2bb1b0211ce4bfaf51ee9a8899fdfa89..84d31dab8c5f9b46d7c7f9e36bcc36906affff5a 100644 (file)
@@ -69,6 +69,11 @@ function getRemoteBlueBrick($brick)
     return _fullBrickButton('search', 'blue', 'background-color:#0F49A8;color:#fff;');
 }
 
+function getRemoteShieldHomeBrick($brick)
+{
+    return _fullBrickButton('home', 'home', 'background-color:#0F49A8;color:#fff;');
+}
+
 function getRemoteYellowBrick($brick)
 {
     return _fullBrickButton('info-circle', 'yellow', 'background-color:#fc0;color:#fff;');
@@ -79,6 +84,16 @@ function getRemoteGreenBrick($brick)
     return _fullBrickButton('bars', 'green', 'background-color:#00B233;color:#fff;');
 }
 
+function getRemoteShieldMenuBrick($brick)
+{
+    return _fullBrickButton('bars', 'menu', 'background-color:#00B233;color:#fff;');
+}
+
+function getRemoteShieldBackBrick($brick)
+{
+    return _fullBrickButton('backspace', 'back', 'background-color:#c00;color:#fff;');
+}
+
 function getRemoteRedBrick($brick)
 {
     return _fullBrickButton('backspace', 'red', 'background-color:#c00;color:#fff;');
@@ -109,6 +124,11 @@ function getRemoteOkBrick($brick)
     return _fullCustomBrickButton('OK', 'select', '', 'arrow');
 }
 
+function getRemoteShieldOkBrick($brick)
+{
+    return _fullBrickButton('circle', 'ok', '','fas','arrow');
+}
+
 function getRemoteTimelineBrick($brick)
 {
     $res = '<div class="remote-timeline"><div class="timeline-time">00:00</div><div class="timeline-progressbar"><div class="timeline-cursor"></div></div><div class="timeline-duration">00:00</div></div>';
@@ -169,7 +189,7 @@ function _fullCustomBrickButton($content, $command, $style = "", $class = '')
     return ['class' => $class, 'content' => '<a class="fullbrickbutton" style="' . $style . '" data-remote-command="' . $command['command'] . '"' . $long . ' href="#">' . $content . '</a>'];
 }
 
-function _fullBrickButton($icon, $command, $style = "", $iconstyle = 'fas')
+function _fullBrickButton($icon, $command, $style = "", $iconstyle = 'fas',$class='')
 {
     if (!is_array($command)) {
         $command = ['command' => $command];
@@ -178,7 +198,7 @@ function _fullBrickButton($icon, $command, $style = "", $iconstyle = 'fas')
     if (isset($command['long'])) {
         $long = ' data-remote-command-long="' . $command['long'] . '"';
     }
-    return '<a class="fullbrickbutton" style="' . $style . '" data-remote-command="' . $command['command'] . '"' . $long . ' href="#"><i class="' . $iconstyle . ' fa-' . $icon . '"></i></a>';
+    return ['class'=>$class,'content'=>'<a class="fullbrickbutton '.$class.'" style="' . $style . '" data-remote-command="' . $command['command'] . '"' . $long . ' href="#"><i class="' . $iconstyle . ' fa-' . $icon . '"></i></a>'];
 }
 
 function _fullArrowBrickButton($icon, $command, $style = "")
index e9933e162d17383372474d856d55f78285367011..d56dbc418713a1a4f7c1e796fc4759dac9aacec9 100644 (file)
@@ -1,5 +1,29 @@
 <?php
 
+function freeboxChannel($channel)
+{
+    if (config('DEVICE') === 'salon') {
+        $currentActivity = getCurrentHarmonyActivity();
+        harmonyActivity('tv');
+    }
+    if ($channel === 'replay') {
+        $commands = ['right', 'ok', 'pause=5', 'down', 'down', 'down', 'down', 'down'];
+    } elseif ($channel === 'netflix') {
+        $commands = ['right', 'down', 'down', 'down', 'ok', 'pause=25', 'ok', 'pause=5', 'down'];
+    } else {
+        $commands = array_merge(['ok', 'pause=5'], str_split((string)$channel));
+    }
+    $keys = array_merge(array('home', 'pause=2', 'home', 'pause=1', 'home', 'left', 'right', 'home'), $commands);
+
+    if (config('DEVICE') === 'salon') {
+        if ($currentActivity != 'tv') {
+            sleep(50);
+        }
+    }
+    print_r($keys);
+    freeboxKey($keys);
+}
+
 function freeboxKey($keys, $long = false)
 {
     foreach ($keys as $key) {
index fef067d920850a2e4d34641e179e9949f1e85d12..aa6b2d633abefe30000884f780385f403ea1bad0 100644 (file)
@@ -291,9 +291,9 @@ function shortcut($s, $hash)
     } elseif ($s['type'] == 'media') {
         $attrs['href'] = isset($s['path']) ? $s['path'] : $s['url'];
         $attrs['class'] = 'media';
-    } elseif ($s['type'] == 'freebox' || $s['type']==='shield') {
+    } elseif ($s['type'] == 'freebox' || $s['type'] === 'shield' || $s['type'] === 'netflix') {
         $attrs['href'] = $s['url'];
-        $attrs['class'] = 'ajax';
+        $attrs['class'] = 'ajax play';
         $attrs['data-remote'] = "1";
     } else if ($s['type'] == 'map') {
         $rand = rand(1, 1000000);
index b8aea7dfd380a2e34471b0c6687e090acd41fcb3..78cd4ab58f7076f527d8f9c9521338d22b2ebce6 100644 (file)
@@ -56,7 +56,9 @@ function remoteCmd($cmd, $device)
         return true;
     }
 
-    if ($device == 'salon') {
+    if ((($p === 'netflix' || $p === 'tv') && config('TVPLAYER') === 'shield') || config('VIDEOPLAYER') === 'shield') {
+        return shieldRemoteCommand($cmd,$device);
+    } else if ($device == 'salon') {
         switch (getCurrentHarmonyActivity()) {
             case 'media':
                 return remoteCmdMedia($cmd, $device);
@@ -325,7 +327,7 @@ function mediaRaspCommons($device)
         if (!isAlive('bureau')) {
             sleep(60);
         }
-        irsend('bureau', 'Projector', 'PowerOn');
+        //irsend('bureau', 'Projector', 'PowerOn');
         sshRunCommand('/usr/local/bin/soundtohdmi', 'bureau', true, true);
     } else if ($device == 'sdb') {
         execScene('sdb/ampli/on');
@@ -518,14 +520,18 @@ function VLCCmd($params, $device = null, $timeout = 5)
 function VLCPlay($fileorstream, $device = null, $timeout = 5)
 {
     $device = getDevice($device);
-    VLCCmd(['command' => 'pl_empty'], $device, $timeout);
-    if (file_exists($fileorstream)) {
-        $fileorstream = 'file://' . $fileorstream;
-    }
-    echo $fileorstream;
-    if ($device === 'bureau') {
-        sshCommand('/usr/local/bin/soundtohdmi', $device, true, true);
+    if (config('VIDEOPLAYER') === 'shield') {
+        return shieldKodi($fileorstream);
+    } else {
+        VLCCmd(['command' => 'pl_empty'], $device, $timeout);
+        if (file_exists($fileorstream)) {
+            $fileorstream = 'file://' . $fileorstream;
+        }
+        echo $fileorstream;
+        if ($device === 'bureau') {
+            sshCommand('/usr/local/bin/soundtohdmi', $device, true, true);
+        }
+        return VLCCmd(['command' => 'in_play', 'input' => $fileorstream], $device, $timeout);
     }
-    return VLCCmd(['command' => 'in_play', 'input' => $fileorstream], $device, $timeout);
 }
 
index d1bf9420905fc280a250dfae2e6573b95dea2349..195ae1420583c3470679b85a1639f1cd3352bf40 100644 (file)
@@ -6,10 +6,20 @@ function remoteInfos()
     $p = $e[0];
     if ($p == 'squeezebox') {
         $res = squeezeboxRemoteInfos();
-    } else if ($p == 'mediarasp') {
-        $res = mediaraspRemoteInfos();
     } else {
-        $res = ['type' => $p, 'can_seek' => false];
+        if (($p === 'netflix' || $p === 'tv') && config('TVPLAYER') === 'shield') {
+            $res = ['type' => 'shield', 'can_seek' => false];
+        }else {
+            if ($p == 'mediarasp') {
+                if(config('VIDEOPLAYER')==='shield'){
+                    $res = ['type' => 'shield', 'can_seek' => false];
+                }else {
+                    $res = mediaraspRemoteInfos();
+                }
+            } else {
+                $res = ['type' => $p, 'can_seek' => false];
+            }
+        }
     }
     $res['playing'] = $playing;
     $res['device'] = config('DEVICE');
index 2c906fc192403bc99e27e023842c4331a5234e9a..2c65d77ba55b5fe3783e1fc9a74e71f8d0a266cd 100644 (file)
@@ -7,7 +7,7 @@ function shieldConnect()
     global $shieldConnect;
     if (!$shieldConnect) {
         $shieldConnect = true;
-        _adb('connect', SHIELD_HOST);
+        //_adb('connect', SHIELD_HOST);
     }
 }
 
@@ -22,22 +22,34 @@ function shieldText($text)
     shieldCommand('shell', 'input text ' . $text);
 }
 
-function shieldKey($keys)
+function shieldKey($keys, $device = true)
 {
-    $map = ['right' => 'KEYCODE_DPAD_RIGHT',
+    $map = [
         'up' => 'KEYCODE_DPAD_UP',
+        'direction-up' => 'KEYCODE_DPAD_UP',
         'left' => 'KEYCODE_DPAD_LEFT',
+        'direction-left' => 'KEYCODE_DPAD_LEFT',
+        'right' => 'KEYCODE_DPAD_RIGHT',
+        'direction-right' => 'KEYCODE_DPAD_RIGHT',
         'down' => 'KEYCODE_DPAD_DOWN',
+        'direction-down' => 'KEYCODE_DPAD_DOWN',
         'wakeup' => 'KEYCODE_WAKEUP',
         'sleep' => 'KEYCODE_SLEEP',
         'enter' => 'KEYCODE_ENTER',
         'ok' => 'KEYCODE_ENTER',
+        'select' => 'KEYCODE_ENTER',
         'back' => 'KEYCODE_BACK',
         'home' => 'KEYCODE_HOME',
-        'play' => 'KEYCODE_MEDIA_PLAY',
-        'pause' => 'KEYCODE_MEDIA_PAUSE',
+        'pause' => 'KEYCODE_MEDIA_PLAY_PAUSE',
         'stop' => 'KEYCODE_MEDIA_STOP',
         'space' => 'KEYCODE_SPACE',
+        'rewind' => 'KEYCODE_MEDIA_REWIND',
+        'fast-rewind' => 'KEYCODE_MEDIA_REWIND',
+        'forward' => 'KEYCODE_MEDIA_FAST_FORWARD',
+        'fast-forward' => 'KEYCODE_MEDIA_FAST_FORWARD',
+        'volume-up' => 'KEYCODE_VOLUME_UP',
+        'volume-down' => 'KEYCODE_VOLUME_DOWN',
+        'volume-mute' => 'KEYCODE_VOLUME_MUTE',
     ];
     if (!is_array($keys)) {
         $keys = [$keys];
@@ -53,13 +65,17 @@ function shieldKey($keys)
     shieldCommand('shell', ' "' . implode(' && ', $cmds) . '"');
 }
 
-function shieldNetflix($id = null)
+function shieldNetflix($id = null, $device = null)
 {
     shieldHome();
+    sleep(1);
+
     $url = 'http://www.netflix.com/';
     if (null !== $id && $id !== 'home') {
         $url .= 'watch/' . $id;
     }
+
+    setPlaying('netflix', $device);
     if ($id === 'home') {
         shieldKill('netflix');
     }
@@ -71,6 +87,11 @@ function shieldNetflix($id = null)
     }
 }
 
+function shieldRemoteCommand($cmd, $device = null)
+{
+    shieldKey([$cmd], $device);
+    return true;
+}
 
 function shieldTVCommand($cmd)
 {
@@ -102,105 +123,47 @@ function shieldLaunchApp($activity)
     _adb('shell am start', '-n ' . $activity);
 }
 
-function shieldMyCanal($channel = false, $type = 'live')
+function shieldMyCanal($channel = false, $type = 'live', $device = null)
 {
+    setPlaying('mycanal', $device);
     if ($type === 'replay') {
         if ($channel === 'arte') {
             return shieldArte();
         } else if ($channel === 'francetv') {
             return shieldFranceTv();
         }
-    }
-
-    $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');
-}
-
+        $url = 'https://www.canalplus.com/chaines/';
+        if ($channel !== 'home') {
+            $url += $channel;
+        }
+    } else if ($type === 'live') {
 
-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',
-        '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',
-    ];
-    if (in_array($channel, $favorites)) {
-        return hieldGetKeysToChannel($channel, $channel, 4, ['ok']);
+        $url = 'https://www.canalplus.com/live/?channel=' . $channel;
     }
-    return shieldGetKeysToChannel($canalchannels, $channel, 4, ['ok']);
+    setPlaying('mycanal', $device);
+    _adb('shell am start', '-a android.intent.action.VIEW -f 0x10808000 -d ' . $url . ' com.canal.android.canal/com.canal.app.common.legacy.DeepLinkActivity');
 }
 
-function shieldGetKeysToReplayChannel($channel)
+function shieldKodi($file)
 {
-
-    $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']);
+    shieldHome();
+    _adb('shell am start', '-a android.intent.action.VIEW  -d \'"' . shieldNormalizeURL($file) . '"\' -n org.xbmc.kodi/.Splash');
 }
 
-function shieldGetKeysToChannel($list, $channel, $perline = 4, $sendAfter = [])
+function shieldNormalizeURL($input)
 {
-    $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';
+    if (strpos($input, '/nas') === 0) {
+        $input = str_replace('/nas/', '/', $input);
+        return 'smb://Share:dcfyjbcyckwydtgufjx@192.168.13.4/Share/' . $input;
     }
-    $res[] = array_merge($res, $sendAfter);
-    return $res;
-}
-
-function shieldKodi($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');
+    return $input;
 }
 
 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.videolan.vlc/.StartActivity');
+    _adb('shell am start', '-a android.intent.action.VIEW  -d \'"' . shieldNormalizeURL($file) . '"\' -n org.videolan.vlc/.StartActivity');
 }
 
 function shieldListApps()
index d5e85df66e99d1096dfab3a1fba4e3e04b094604..6c55c0d09b09f19e38487181322dc20a2fc9e18f 100644 (file)
@@ -201,7 +201,7 @@ class tvShowLibrary extends mediaLibrary
 
         $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'])];
+            $res['shortcuts'][] = ['label' => $tvShow['data']['name'], 'type' => 'netflix', 'url' => '/scripts/netflix.php?id='.$e[1], 'poster' => $this->_poster($tvShow['data']['poster_path'])];
             return;
         }
 
diff --git a/scripts/netflix.php b/scripts/netflix.php
new file mode 100644 (file)
index 0000000..97e4bde
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+
+require_once 'import.php';
+if (config('TVPLAYER') === 'shield') {
+    shieldNetflix($_GET['id'] ?? 'home');
+} else if (config('TVPLAYER') === 'freebox') {
+    freeboxChannel('netflix');
+}
\ No newline at end of file
index 95b9eb9eb35d3baef9998377da185a02d49d6624..a5946d7c0cbbf3bc5cb6b481af3ee87499de8b41 100644 (file)
@@ -55,7 +55,7 @@ header a {
   z-index: 100;
   color: #fff;
   text-shadow: 1px 1px rgba(0, 0, 0, 0.5);
-  margin: 0.05em 0;
+  margin: 0.2em 0;
 }
 header a .fa-tv {
   -webkit-transform: scaleX(0.85);
@@ -207,7 +207,10 @@ section .col > *[data-menu]:after {
   font-weight: 400;
 }
 section .col > *.media:after,
-section .col > *.music:after {
+section .col > *.music:after,
+section .col > *.shield:after,
+section .col > *.netflix:after,
+section .col > *.play:after {
   position: absolute;
   content: "\f04b";
   font-family: Font Awesome\ 5 Pro;
index dfa714cd9e7f3191519b469cccddd758b072b154..75ccad4e93e97ed3d82e3ce239f35dcbe7fed35c 100644 (file)
@@ -241,7 +241,7 @@ section {
         }
       }
 
-      &.media, &.music {
+      &.media, &.music, &.shield, &.netflix, &.play {
         &:after {
           position: absolute;
           content: "\f04b";