From fe77f95257212d47f2febc2a1f2090aff3b8b0b8 Mon Sep 17 00:00:00 2001 From: Vincent Date: Sun, 7 Jul 2019 08:24:10 +0200 Subject: [PATCH] . --- scripts/lib/mediarasp.php | 33 ++++++++++++++++++++++++--------- tools/jarvis/commands | 2 +- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/scripts/lib/mediarasp.php b/scripts/lib/mediarasp.php index e731d29..299726d 100644 --- a/scripts/lib/mediarasp.php +++ b/scripts/lib/mediarasp.php @@ -147,11 +147,11 @@ function remoteCmdMedia($cmd, $device = null, $playing = null) 'info' => 'z', 'direction-left' => 'down', 'direction-right' => 'up', - 'subtitles-toggle' => 's', - 'subtitles-stream-next' => 'm', - 'subtitles-stream-prev' => 'n', - 'subtitles-increase-delay' => 'f', - 'subtitles-decrease-delay' => 'd']; + 'subtitles-toggle' => 'subtitles-toggle', + 'subtitles-stream-next' => 'subtitles-stream-next', + 'subtitles-stream-prev' => 'subtitles-stream-prev', + 'subtitles-increase-delay' => 'subtitles-increase-delay', + 'subtitles-decrease-delay' => 'subtitles-decrease-delay']; if ($device == 'bureau') { @@ -168,7 +168,17 @@ function remoteCmdMedia($cmd, $device = null, $playing = null) if (null === $playing || $playing == 'mediarasp') { - if ($key == 'rewind' || $key == 'fast-rewind' || $key == 'forward' || $key == 'fast-forward') { + if ($key == 'subtitles-toggle') { + sendHotKey('shift+v'); + } else if ($key == 'subtitles-stream-next') { + sendHotKey('v'); + } else if ($key == 'subtitles-stream-prev') { + sendHotKey('alt+v'); + } else if ($key == 'subtitles-increase-delay') { + sendHotKey('h', 10); + } else if ($key == 'subtitles-decrease-delay') { + sendHotKey('g', 10); + } else if ($key == 'rewind' || $key == 'fast-rewind' || $key == 'forward' || $key == 'fast-forward') { if ($key == 'rewind' || $key == 'forward') { $amount = 15; } else if ($key == 'fast-rewind' || $key == 'fast-forward') { @@ -205,6 +215,12 @@ function remoteCmdMedia($cmd, $device = null, $playing = null) return true; } +function sendHotKey($key, $times = 1, $device = null) +{ + $keys = str_repeat(' key ' . $key, $times); + return sshCommand('DISPLAY=:0 xdotool getactivewindow' . $keys, $device, true, false); +} + function remoteCmdSalonMusique($cmd) { switch ($cmd) { @@ -247,7 +263,6 @@ function mediaRaspPlayMovie($movie, $device = null) } } - try { raspberryCast('video', $device, ['control' => 'stop']); } catch (Exception $e) { @@ -427,8 +442,8 @@ function VLCCmd($params, $device = null, $timeout = 5) } else { $query = 'requests/status.xml'; } - $url='http://' . $d['host'] . ':8754/' . $query; - // echo $url.': '.print_r($params,true); + $url = 'http://' . $d['host'] . ':8754/' . $query; + // echo $url.': '.print_r($params,true); $client = getMediaRaspClient(); try { $response = $client->get($url, ['query' => $params, 'timeout' => $timeout, 'auth' => ['', 'atacama']]); diff --git a/tools/jarvis/commands b/tools/jarvis/commands index f802ed3..3a6165c 100644 --- a/tools/jarvis/commands +++ b/tools/jarvis/commands @@ -19,5 +19,5 @@ ENCORE*==jv_repeat_last_command *SENS*VIE*==say "42" *RADIO*SALON*==say "D'accord, je mets FIP" && jv_curl "https://entree.home.tortuga.enhydra.fr/scripts/squeeze.php?player=Salon&name=FIP" *INFO*==say "D'accord, j'allume franceinfo: (BFM, j'aime pas trop)" && jv_curl "https://entree.home.tortuga.enhydra.fr/scripts/squeeze.php?player=Salon&name=France%20Info" -*ALERTE*==say "J'ai envoyé une notification lumineuse dans la maison" && jv_curl "https://entree.home.tortuga.enhydra.fr/scripts/light.php?scene=home/alert&im" +*ALERT*==say "J'ai envoyé une notification lumineuse dans la maison" && jv_curl "https://entree.home.tortuga.enhydra.fr/scripts/light.php?scene=home/alert&im" *REPLAY*==say "Ok, par contre, seul celui d'Arte passe des choses intéressantes. Je dis ça ..." && jv_curl "https://entree.home.tortuga.enhydra.fr/scripts/light.php?scene=home/alert&im" -- 2.39.5