]> _ Git - tortuga-home.git/commitdiff
.
authorVincent <vincent@enhydra.fr>
Sun, 20 Oct 2019 12:20:14 +0000 (14:20 +0200)
committerVincent <vincent@enhydra.fr>
Sun, 20 Oct 2019 12:20:14 +0000 (14:20 +0200)
.idea/workspace.xml
config/media.php
config/rooms.php
js/home.js
scripts/checkstate.php [new file with mode: 0644]
scripts/lib/lib.php
scripts/pcgames.php [new file with mode: 0644]

index 255c2de60e4ea2fc54d499d58bd32127f05025f5..ff7395546fd2c754f7b845c92196872666124eef 100644 (file)
@@ -2,16 +2,13 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
+      <change afterPath="$PROJECT_DIR$/scripts/checkstate.php" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/scripts/pcgames.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/lib/ecomode.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/ecomode.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/lib/medialibrary.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/medialibrary.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/pc.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/pc.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$/scripts/lib/squeezebox.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/squeezebox.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/media.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/media.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/squeeze.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/squeeze.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/servers/domoticz.php" beforeDir="false" afterPath="$PROJECT_DIR$/servers/domoticz.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/config/media.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/media.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/config/rooms.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/rooms.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/js/home.js" beforeDir="false" afterPath="$PROJECT_DIR$/js/home.js" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/lib.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/lib.php" afterDir="false" />
     </list>
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
     <option name="SHOW_DIALOG" value="false" />
       <workItem from="1570487789445" duration="14000" />
       <workItem from="1570487824771" duration="196000" />
       <workItem from="1570898873609" duration="7576000" />
-      <workItem from="1571207547358" duration="1665000" />
-    </task>
-    <task id="LOCAL-00186" summary=".">
-      <created>1562398828376</created>
-      <option name="number" value="00186" />
-      <option name="presentableId" value="LOCAL-00186" />
-      <option name="project" value="LOCAL" />
-      <updated>1562398828377</updated>
+      <workItem from="1571207547358" duration="2774000" />
+      <workItem from="1571379187683" duration="3078000" />
+      <workItem from="1571384814081" duration="5000" />
+      <workItem from="1571569117453" duration="3639000" />
     </task>
     <task id="LOCAL-00187" summary=".">
       <created>1562430926369</created>
       <option name="project" value="LOCAL" />
       <updated>1569663460125</updated>
     </task>
-    <option name="localTasksCounter" value="235" />
+    <task id="LOCAL-00235" summary=".">
+      <created>1571209734092</created>
+      <option name="number" value="00235" />
+      <option name="presentableId" value="LOCAL-00235" />
+      <option name="project" value="LOCAL" />
+      <updated>1571209734093</updated>
+    </task>
+    <option name="localTasksCounter" value="236" />
     <servers />
   </component>
   <component name="TodoView">
index c3864a397acf8bd3440b74965e33c573d3f71d4a..03fbcc4869980e17d1e7247dfda8fbd3c7c475da 100644 (file)
@@ -9,6 +9,7 @@ $shortcuts['media'][] = ['label' => 'Séries TV', 'type' => 'sub', 'sub' => 'ser
 $shortcuts['media'][] = ['label' => 'Films', 'type' => 'sub', 'sub' => 'movies'];
 if ($device == 'salon' || $device == 'bureau') {
     $shortcuts['media'][] = ['label' => 'Nintendo Switch', 'type' => 'harmonyactivity', 'activity' => 'nintendo-switch'];
+    $shortcuts['media'][] = ['label' => 'Jeux PC', 'type' => 'ajax', 'url' => '/scripts/pcgames.php'];
     $shortcuts['media'][] = ['label' => 'Vidéo web', 'type' => 'raspberrycast'];
 }
 
@@ -33,7 +34,7 @@ if (is_array($recent)) {
     profile('Got recents', __FILE__, __LINE__);
 }
 
-if(is_array($media)) {
+if (is_array($media)) {
     foreach ($media as $id => $mediagroup) {
         if ($id == 'x' && !isset($_GET['x'])) {
             continue;
index a582122c577ac40acae70c94f5abd3200911797f..c41b9f43216ff9b77022f3b93aaa8433b35a2a76 100644 (file)
@@ -45,7 +45,7 @@ function lit($additionnalfavorites = array())
 function home()
 {
     $favorites = [
-        ['type' => 'light', 'scene' => 'home/welcome', 'label' => 'Bienvenue'],
+        ['type' => 'light', 'scene' => 'home/welcome', 'label' => 'Bienvenue', 'confirm' => ['message' => 'Quelqu\'un dort peut-être. Veuillez confirmer votre action.', 'conditions' => ['night' => '1']]],
         ['type' => 'light', 'scene' => 'home/off', 'label' => 'éteindre'],
     ];
     $all = array_merge($favorites, [
index 9dfa37ec7c3ed8118bb68cffc33cb8182e9b891f..f1896cd5cfdcda74bbac3de9d6b9a86018dfcd1f 100644 (file)
@@ -87,6 +87,28 @@ $(function () {
         return true;
     });
 
+    $(document).on(clickevent, '[data-confirm]:not(.confirmok)', function (e) {
+        var $this = $(this);
+        e.preventDefault();
+        e.stopPropagation();
+        e.stopImmediatePropagation();
+
+        var needsconfirm;
+        $.get('scripts/checkstate.php?state=' + encodeURIComponent($(this).attr('data-confirm')), function (data) {
+            needsconfirm = data === '1';
+
+            if (!needsconfirm || window.confirm($this.data('confirm-message'))) {
+                $this.addClass('confirmok');
+                $this.click();
+                setTimeout(function () {
+                    $this.removeClass('confirmok');
+                }, 500);
+            }
+        });
+
+        return false;
+    });
+
     $(document).on(clickevent, '[data-volume]', function () {
         $.get('scripts/volume.php?volume=' + $(this).data('volume') + '%');
         return true;
diff --git a/scripts/checkstate.php b/scripts/checkstate.php
new file mode 100644 (file)
index 0000000..cd958ee
--- /dev/null
@@ -0,0 +1,13 @@
+<?php
+require_once "import.php";
+
+$state = json_decode($_GET['state']);
+$res = true;
+foreach ($state as $k => $v) {
+    if (getState($k) != $v) {
+        $res = false;
+        break;
+    }
+}
+header('Content-Type: text/plain');
+echo $res ? '1' : '0';
\ No newline at end of file
index 3400b8ea4f3df1d4b9a6b427a52056e772e9e45a..d9a5def3aff88594ca1675eaedb67c18bf8978e4 100644 (file)
@@ -200,7 +200,10 @@ function shortcut($s, $hash)
 
     $swcorner = '';
 
-    if ($s['type'] == 'task') {
+    if ($s['type'] == 'ajax') {
+        $attrs['class'] = 'ajax';
+        $attrs['href'] = $s['url'];
+    } elseif ($s['type'] == 'task') {
         $attrs['class'] = 'ajax';
         $attrs['href'] = 'scripts/tortugatask.php?task=' . $s['command'];
     } elseif ($s['type'] == 'light') {
@@ -332,6 +335,12 @@ function shortcut($s, $hash)
         $attrs['data-volume'] = $s['volume'];
     }
 
+    if (isset($s['confirm'])) {
+        $attrs['data-confirm'] = json_encode($s['confirm']['conditions']);
+        $attrs['data-confirm-message'] = $s['confirm']['message'];
+    }
+
+
     if (isset($html)) {
         $res = $html;
     } else {
diff --git a/scripts/pcgames.php b/scripts/pcgames.php
new file mode 100644 (file)
index 0000000..0581549
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+require_once "import.php";
+
+if (config('DEVICE') == 'salon') {
+    harmonyActivity('media');
+    sshCommand('killall fbi', 'salon', false,true);
+    sshCommand('DISPLAY=:0 remmina -c /home/pi/.local/share/remmina/1571565005433.remmina', 'salon');
+}
\ No newline at end of file