]> _ Git - tortuga-home.git/commitdiff
.
authorVincent <vincent@enhydra.fr>
Sat, 6 Jul 2019 18:03:46 +0000 (20:03 +0200)
committerVincent <vincent@enhydra.fr>
Sat, 6 Jul 2019 18:03:46 +0000 (20:03 +0200)
.idea/workspace.xml
scripts/lib/jarvis.php
tools/jarvis/commands
tools/jarvis/console.php [new file with mode: 0644]

index 54d8905199d6eed1a92da27af6e0917af4995db3..a4acf10962ad195f1256c8c7287e7188ce64d701 100644 (file)
@@ -2,9 +2,10 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
+      <change afterPath="$PROJECT_DIR$/tools/jarvis/console.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/global.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/global.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/jarvis.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/jarvis.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/jarvis.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/jarvis.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/tools/jarvis/commands" beforeDir="false" afterPath="$PROJECT_DIR$/tools/jarvis/commands" afterDir="false" />
     </list>
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
     <option name="SHOW_DIALOG" value="false" />
       <file pinned="false" current-in-tab="false">
         <entry file="file://$PROJECT_DIR$/scripts/lib/jarvis.php">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="68">
-              <caret line="4" column="36" selection-start-line="4" selection-start-column="36" selection-end-line="4" selection-end-column="36" />
+            <state relative-caret-position="153">
+              <caret line="9" column="21" lean-forward="true" selection-start-line="9" selection-start-column="21" selection-end-line="9" selection-end-column="21" />
             </state>
           </provider>
         </entry>
       </file>
-      <file pinned="false" current-in-tab="true">
-        <entry file="file://$PROJECT_DIR$/scripts/jarvis.php">
+      <file pinned="false" current-in-tab="false">
+        <entry file="jar://$APPLICATION_PLUGINS_DIR$/php/lib/php.jar!/stubs/json/json.php">
           <provider selected="true" editor-type-id="text-editor">
             <state relative-caret-position="68">
-              <caret line="4" column="27" selection-start-line="4" selection-start-column="27" selection-end-line="4" selection-end-column="27" />
+              <caret line="117" column="40" lean-forward="true" selection-start-line="117" selection-start-column="40" selection-end-line="117" selection-end-column="40" />
             </state>
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/tools/jarvis/commands">
+        <entry file="file://$PROJECT_DIR$/scripts/jarvis.php">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="340">
-              <caret line="20" lean-forward="true" selection-start-line="20" selection-end-line="20" />
+            <state relative-caret-position="119">
+              <caret line="7" column="15" lean-forward="true" selection-start-line="7" selection-start-column="15" selection-end-line="7" selection-end-column="15" />
             </state>
           </provider>
         </entry>
       </file>
       <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/tools/jarvis/events">
-          <provider selected="true" editor-type-id="text-editor" />
-        </entry>
-      </file>
-      <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/scripts/lib/domoticz.php">
+        <entry file="file://$PROJECT_DIR$/tools/jarvis/commands">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="238">
-              <caret line="14" column="9" selection-start-line="14" selection-start-column="9" selection-end-line="14" selection-end-column="9" />
+            <state relative-caret-position="374">
+              <caret line="22" column="185" selection-start-line="22" selection-start-column="185" selection-end-line="22" selection-end-column="185" />
             </state>
           </provider>
         </entry>
       </file>
-      <file pinned="false" current-in-tab="false">
-        <entry file="file://$PROJECT_DIR$/scripts/bedroomlight.php">
+      <file pinned="false" current-in-tab="true">
+        <entry file="file://$PROJECT_DIR$/tools/jarvis/console.php">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="119">
-              <caret line="7" column="8" selection-start-line="7" selection-start-column="8" selection-end-line="7" selection-end-column="13" />
+            <state relative-caret-position="476">
+              <caret line="28" column="11" selection-start-line="28" selection-start-column="11" selection-end-line="28" selection-end-column="11" />
             </state>
           </provider>
         </entry>
       </file>
+      <file pinned="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/tools/jarvis/events">
+          <provider selected="true" editor-type-id="text-editor" />
+        </entry>
+      </file>
       <file pinned="false" current-in-tab="false">
         <entry file="file://$PROJECT_DIR$/scripts/lib/medialibrary.php">
           <provider selected="true" editor-type-id="text-editor">
   <component name="IdeDocumentHistory">
     <option name="CHANGED_PATHS">
       <list>
-        <option value="$PROJECT_DIR$/scripts/gradient.php" />
-        <option value="$PROJECT_DIR$/style/common.less" />
-        <option value="$PROJECT_DIR$/js/common.js" />
         <option value="$PROJECT_DIR$/images/switch.svg" />
         <option value="$PROJECT_DIR$/config/media.php" />
         <option value="$PROJECT_DIR$/scripts/harmonyactivity.php" />
         <option value="$PROJECT_DIR$/servers/domoticz.php" />
         <option value="$PROJECT_DIR$/config/global.php" />
         <option value="$PROJECT_DIR$/scripts/jarvis.php" />
+        <option value="$PROJECT_DIR$/tools/jarvis/commands" />
+        <option value="$PROJECT_DIR$/scripts/lib/jarvis.php" />
+        <option value="$PROJECT_DIR$/tools/jarvis/console.php" />
       </list>
     </option>
   </component>
       <workItem from="1562139612183" duration="879000" />
       <workItem from="1562187458066" duration="10928000" />
       <workItem from="1562315270549" duration="3917000" />
-      <workItem from="1562430904715" duration="1570000" />
-    </task>
-    <task id="LOCAL-00139" summary=".">
-      <created>1549800016125</created>
-      <option name="number" value="00139" />
-      <option name="presentableId" value="LOCAL-00139" />
-      <option name="project" value="LOCAL" />
-      <updated>1549800016125</updated>
+      <workItem from="1562430904715" duration="4177000" />
     </task>
     <task id="LOCAL-00140" summary=".">
       <created>1550047196146</created>
       <option name="project" value="LOCAL" />
       <updated>1562430926369</updated>
     </task>
-    <option name="localTasksCounter" value="188" />
+    <task id="LOCAL-00188" summary=".">
+      <created>1562433498333</created>
+      <option name="number" value="00188" />
+      <option name="presentableId" value="LOCAL-00188" />
+      <option name="project" value="LOCAL" />
+      <updated>1562433498333</updated>
+    </task>
+    <option name="localTasksCounter" value="189" />
     <servers />
   </component>
   <component name="TimeTrackingManager">
-    <option name="totallyTimeSpent" value="1238130000" />
+    <option name="totallyTimeSpent" value="1240737000" />
   </component>
   <component name="TodoView">
     <todo-panel id="selected-file">
     <option name="FILTER_TARGETS" value="false" />
   </component>
   <component name="editorHistoryManager">
-    <entry file="file://$PROJECT_DIR$/scripts/sections.php">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="51">
-          <caret line="3" selection-start-line="3" selection-end-line="3" selection-end-column="26" />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/style/style.less">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="4216">
-          <caret line="248" column="21" selection-start-line="248" selection-start-column="21" selection-end-line="248" selection-end-column="21" />
-        </state>
-      </provider>
-    </entry>
     <entry file="file://$PROJECT_DIR$/scripts/seen.php">
       <provider selected="true" editor-type-id="text-editor">
         <state relative-caret-position="34">
     <entry file="file://$PROJECT_DIR$/tools/jarvis/events">
       <provider selected="true" editor-type-id="text-editor" />
     </entry>
+    <entry file="file://$PROJECT_DIR$/scripts/jarvis.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="119">
+          <caret line="7" column="15" lean-forward="true" selection-start-line="7" selection-start-column="15" selection-end-line="7" selection-end-column="15" />
+        </state>
+      </provider>
+    </entry>
+    <entry file="jar://$APPLICATION_PLUGINS_DIR$/php/lib/php.jar!/stubs/json/json.php">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="68">
+          <caret line="117" column="40" lean-forward="true" selection-start-line="117" selection-start-column="40" selection-end-line="117" selection-end-column="40" />
+        </state>
+      </provider>
+    </entry>
     <entry file="file://$PROJECT_DIR$/tools/jarvis/commands">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="340">
-          <caret line="20" lean-forward="true" selection-start-line="20" selection-end-line="20" />
+        <state relative-caret-position="374">
+          <caret line="22" column="185" selection-start-line="22" selection-start-column="185" selection-end-line="22" selection-end-column="185" />
         </state>
       </provider>
     </entry>
     <entry file="file://$PROJECT_DIR$/scripts/lib/jarvis.php">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="68">
-          <caret line="4" column="36" selection-start-line="4" selection-start-column="36" selection-end-line="4" selection-end-column="36" />
+        <state relative-caret-position="153">
+          <caret line="9" column="21" lean-forward="true" selection-start-line="9" selection-start-column="21" selection-end-line="9" selection-end-column="21" />
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/scripts/jarvis.php">
+    <entry file="file://$PROJECT_DIR$/tools/jarvis/console.php">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="68">
-          <caret line="4" column="27" selection-start-line="4" selection-start-column="27" selection-end-line="4" selection-end-column="27" />
+        <state relative-caret-position="476">
+          <caret line="28" column="11" selection-start-line="28" selection-start-column="11" selection-end-line="28" selection-end-column="11" />
         </state>
       </provider>
     </entry>
index 2491246727cce93baec62878e9f0c32d7295d36b..1e686391cc069a41d05a10a276dab9cbb386ce39 100644 (file)
@@ -15,4 +15,5 @@ function jarvisCmd($question)
                        return $v['answer'];
                }
        }
+    return 'Désolé, je crois qu\'il y a eu un affreux malentendu entre nous :(';
 }
\ No newline at end of file
index 9e26a0861c20258e5c90cb3855a761dabbb4ca43..f802ed32ccd054c987096ee7f56c6ca2f9da97c2 100644 (file)
@@ -1,5 +1,5 @@
 *AIDE*==jv_display_commands
-*BONJOUR*|*SALUT*==say "Bonjour $username"
+*BONJOUR*|*SALUT*==say "Bonjour"
 *COMMENT*APPELLE*==say "Je m'appelle $trigger"
 *MERCI*==say "De rien"
 *AU REVOIR*|*BYE*==say "Au revoir $username"; jv_exit
@@ -10,11 +10,14 @@ ENCORE*==jv_repeat_last_command
 *REPETE (*) ET (*)==say "(1) (2)"
 *WIFI*|*WI-FI*==say "Le nom du wifi est Tortuga et le mot de passe est z31a8bmd10kk6fqid3v0hq577z"
 *CA VA*==say "Très bien et toi ça va?"
->*OUI*==say "ravi de l'entendre"
+>*OUI*|*SUPER*==say "ravi de l'entendre"
+>*PAS MAL*==say "ouais, pareil, ça pourrait aller mieux !"
 >*NON*|*PAS*==say "j'en suis navré"
 *AU*LIT*==say "Bonne nuit" && jv_curl "https://entree.home.tortuga.enhydra.fr/scripts/light.php?scene=home/aulit&im"
 *ALLUME*LUMIERE*==say "J'allume tout"  && jv_curl "https://entree.home.tortuga.enhydra.fr/scripts/light.php?scene=home/welcome&im"
 *ETEIN*MAISON*==say "J'éteins tout, à la prochaine"  && jv_curl "https://entree.home.tortuga.enhydra.fr/scripts/light.php?scene=home/off&im"
 *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"
+*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"
diff --git a/tools/jarvis/console.php b/tools/jarvis/console.php
new file mode 100644 (file)
index 0000000..fb2713d
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/php
+<?php
+$input = '>>> ';
+cls();
+while (true) {
+    $stdin = fopen('php://stdin', 'r');
+    $question = fread($stdin, 10000);
+    if (preg_match('/efface/', $question, $matches)) {
+        cls();
+        continue;
+    }
+    if (preg_match('/exit/', $question, $matches)) {
+        echo getAnswer('bye');
+        exit;
+    }
+    echo getAnswer($question) . "\n" . $input;
+}
+
+function cls()
+{
+    global $input;
+    system('clear');
+    echo $input;
+}
+
+function getAnswer($question)
+{
+    $res = mb_strtoupper(file_get_contents('https://entree.home.tortuga.enhydra.fr/scripts/jarvis.php?question=' . rawurlencode($question)));
+    return $res;
+}
\ No newline at end of file