]> _ Git - tortuga-home.git/commitdiff
.
authorVincent <vincent@enhydra.fr>
Sun, 6 Dec 2020 19:14:09 +0000 (20:14 +0100)
committerVincent <vincent@enhydra.fr>
Sun, 6 Dec 2020 19:14:09 +0000 (20:14 +0100)
.idea/workspace.xml
composer.json
scripts/cron/cron.php
scripts/kodi.php [new file with mode: 0644]
scripts/lib/bricks.php
scripts/lib/kodi.php [new file with mode: 0644]
scripts/lib/lib.php
scripts/lib/shield.php
style/style.css
style/style.less

index 2fd8e7f4ee145e460e12364766d131d89da15a28..b13499fc36c84a223a9587f4352f124d9220e676 100644 (file)
@@ -2,9 +2,16 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
+      <change afterPath="$PROJECT_DIR$/scripts/kodi.php" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/scripts/lib/kodi.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/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$/composer.json" beforeDir="false" afterPath="$PROJECT_DIR$/composer.json" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/cron/cron.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/cron/cron.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/lib.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/lib.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$/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" />
         <option name="Make" enabled="true" />
       </method>
     </configuration>
+    <configuration default="true" type="ArquillianJUnit" factoryName="" nameIsGenerated="true">
+      <option name="arquillianRunConfiguration">
+        <value>
+          <option name="containerStateName" value="" />
+        </value>
+      </option>
+      <option name="TEST_OBJECT" value="class" />
+      <method v="2">
+        <option name="Make" enabled="true" />
+      </method>
+    </configuration>
     <configuration default="true" type="ArquillianTestNG" factoryName="">
       <option name="arquillianRunConfiguration">
         <value>
       <workItem from="1606674601895" duration="3813000" />
       <workItem from="1606808878260" duration="456000" />
       <workItem from="1606936960189" duration="47000" />
-      <workItem from="1606937045400" duration="880000" />
-    </task>
-    <task id="LOCAL-00367" summary=".">
-      <created>1604389791156</created>
-      <option name="number" value="00367" />
-      <option name="presentableId" value="LOCAL-00367" />
-      <option name="project" value="LOCAL" />
-      <updated>1604389791157</updated>
+      <workItem from="1606937045400" duration="5193000" />
+      <workItem from="1607036021292" duration="44000" />
+      <workItem from="1607084835284" duration="5921000" />
     </task>
     <task id="LOCAL-00368" summary=".">
       <created>1604390350662</created>
       <option name="project" value="LOCAL" />
       <updated>1606809331095</updated>
     </task>
-    <option name="localTasksCounter" value="416" />
+    <task id="LOCAL-00416" summary=".">
+      <created>1606938157166</created>
+      <option name="number" value="00416" />
+      <option name="presentableId" value="LOCAL-00416" />
+      <option name="project" value="LOCAL" />
+      <updated>1606938157166</updated>
+    </task>
+    <option name="localTasksCounter" value="417" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
     <MESSAGE value="." />
     <option name="LAST_COMMIT_MESSAGE" value="." />
   </component>
-  <component name="WindowStateProjectService">
-    <state x="1110" y="259" key="#com.jetbrains.php.refactoring.extractMethod.PhpExtractMethodDialog#function0" timestamp="1605437484620">
-      <screen x="0" y="0" width="2560" height="1040" />
-    </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="1110" y="259" key="#com.jetbrains.php.refactoring.extractMethod.PhpExtractMethodDialog#function0/0.0.2560.1040@0.0.2560.1040" timestamp="1605437484620" />
-    <state x="198" y="0" width="737" height="502" key="CommitChangelistDialog2" timestamp="1606809327302">
-      <screen x="0" y="0" width="2560" height="1040" />
-    </state>
-    <state x="132" y="0" width="737" height="502" key="CommitChangelistDialog2/0.0.1707.920@0.0.1707.920" timestamp="1605086955514" />
-    <state x="701" y="75" key="CommitChangelistDialog2/0.0.1920.1160@0.0.1920.1160" timestamp="1605188136787" />
-    <state x="198" y="0" width="745" height="567" key="CommitChangelistDialog2/0.0.2560.1040@0.0.2560.1040" timestamp="1606809327302" />
-    <state x="952" y="244" key="FileChooserDialogImpl" timestamp="1605726960903">
-      <screen x="0" y="0" width="2560" height="1040" />
-    </state>
-    <state x="635" y="216" key="FileChooserDialogImpl/0.0.1707.920@0.0.1707.920" timestamp="1604227698339" />
-    <state x="952" y="244" key="FileChooserDialogImpl/0.0.2560.1040@0.0.2560.1040" timestamp="1605726960903" />
-    <state x="1114" y="443" key="NewPhpFileDialog" timestamp="1606676047797">
-      <screen x="0" y="0" width="2560" height="1040" />
-    </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="1606676047797" />
-    <state x="546" y="120" key="SettingsEditor" timestamp="1606112187843">
-      <screen x="0" y="0" width="2560" height="1040" />
-    </state>
-    <state x="364" y="106" key="SettingsEditor/0.0.1707.920@0.0.1707.920" timestamp="1605086910920" />
-    <state x="546" y="120" key="SettingsEditor/0.0.2560.1040@0.0.2560.1040" timestamp="1606112187843" />
-    <state width="498" height="446" key="SwitcherDM" timestamp="1604228166964">
-      <screen x="0" y="0" width="1707" height="920" />
-    </state>
-    <state width="498" height="446" key="SwitcherDM/0.0.1707.920@0.0.1707.920" timestamp="1604228166964" />
-    <state x="872" y="240" key="Vcs.Push.Dialog.v2" timestamp="1606677808871">
-      <screen x="0" y="0" width="2560" height="1040" />
-    </state>
-    <state x="872" y="240" key="Vcs.Push.Dialog.v2/0.0.2560.1040@0.0.2560.1040" timestamp="1606677808871" />
-    <state x="295" y="0" width="1290" height="907" key="dock-window-1" timestamp="1603274697406">
-      <screen x="0" y="0" width="2560" height="1040" />
-    </state>
-    <state x="295" y="0" width="1290" height="907" key="dock-window-1/0.0.2560.1040@0.0.2560.1040" timestamp="1603274697406" />
-    <state x="977" y="257" width="607" height="536" key="find.popup" timestamp="1606809317924">
-      <screen x="0" y="0" width="2560" height="1040" />
-    </state>
-    <state x="651" y="227" width="550" height="534" key="find.popup/0.0.1707.920@0.0.1707.920" timestamp="1604301949692" />
-    <state x="977" y="257" width="607" height="536" key="find.popup/0.0.2560.1040@0.0.2560.1040" timestamp="1606809317924" />
-    <state x="1056" y="292" key="refactoring.ChangeSignatureDialog" timestamp="1604518096294">
-      <screen x="0" y="0" width="2560" height="1040" />
-    </state>
-    <state x="1056" y="292" key="refactoring.ChangeSignatureDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1604518096294" />
-    <state x="768" y="239" key="run.anything.popup" timestamp="1605973994459">
-      <screen x="0" y="0" width="2560" height="1040" />
-    </state>
-    <state x="512" y="211" key="run.anything.popup/0.0.1707.920@0.0.1707.920" timestamp="1604146410464" />
-    <state x="768" y="239" key="run.anything.popup/0.0.2560.1040@0.0.2560.1040" timestamp="1605973994459" />
-    <state x="90" y="196" width="672" height="678" key="search.everywhere.popup" timestamp="1605086908435">
-      <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="1605086908435" />
-    <state x="135" y="222" width="1008" height="767" key="search.everywhere.popup/0.0.2560.1040@0.0.2560.1040" timestamp="1604481521257" />
-  </component>
   <component name="antWorkspaceConfiguration">
     <option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
     <option name="FILTER_TARGETS" value="false" />
index 5304533e7bc6a38fb4ce144082495c0a5dca7632..30b47d9dd48edd6afd1791dfec43381a7ea6ecc8 100644 (file)
@@ -20,6 +20,7 @@
     "zendframework/zend-db": "^2.10",
     "zendframework/zend-i18n": "^2.9",
     "zendframework/zend-i18n-resources": "^2.6",
-    "ext-json": "*"
+    "ext-json": "*",
+    "ext-mysqli": "*"
   }
 }
index 7c3bebc787f0ba6c1ac79d268f173cc205065b31..7e7a35c3b055a2697b62f1fe48ec4d177ccb6e58 100644 (file)
@@ -25,7 +25,8 @@ function cronOneLoop($cronmin)
     if ($cronmin % 2 == 0) {
         cronPing($cronmin);
     }
-    if ($cronmin % 5 == 0) {
+    if ($cronmin % 15 == 0) {
+        cronKodi($cronmin);
         cronMediaLibrary($cronmin);
         cronTmdb($cronmin);
     }
@@ -370,6 +371,8 @@ function cronHarmony($cronmin)
 
     if ($currentActivity === 'poweroff' || $currentActivity === 'off' || $currentActivity === 'musique') {
         harmonyDeviceCommand('videoprojecteur-epson', 'power-off');
+    } else {
+        harmonyDeviceCommand('videoprojecteur-epson', 'power-on');
     }
 }
 
@@ -387,4 +390,9 @@ function cronHeartbeat($cronmin)
             sshCommand('/bin/echo "/sbin/reboot now" | /usr/bin/at now', $device, false);
         }
     }
+}
+
+function cronKodi($cronmin)
+{
+    kodiSyncPlayedStatus();
 }
\ No newline at end of file
diff --git a/scripts/kodi.php b/scripts/kodi.php
new file mode 100644 (file)
index 0000000..098350d
--- /dev/null
@@ -0,0 +1,6 @@
+<?php
+include "import.php";
+
+if ($_GET['action'] == 'sync_seen') {
+    kodiSyncPlayedStatus();
+}
\ No newline at end of file
index 84d31dab8c5f9b46d7c7f9e36bcc36906affff5a..fda68b95e79d5242728aca2f9f1536f5fd6a95fa 100644 (file)
@@ -137,7 +137,7 @@ function getRemoteTimelineBrick($brick)
 
 function getRemoteInfosBrick($brick)
 {
-    $res = '<div class="remote-infos"><div class="h"><div class="title"></div></div></div>';
+    $res = '<div class="remote-infos" data-remote-command="ok"><div class="h"><div class="title"></div></div></div>';
     return $res;
 }
 
@@ -167,6 +167,11 @@ function getRemoteFwdBrick($brick)
     return _fullBrickButton('forward', ['command' => 'forward', 'long' => 'fast-forward']);
 }
 
+function getRemoteNextBrick($brick)
+{
+    return _fullBrickButton('fast-forward', ['command' => 'next', 'long' => 'prev']);
+}
+
 function getRemoteRecBrick($brick)
 {
     return _fullBrickButton('circle', 'record', 'color:#c00;');
diff --git a/scripts/lib/kodi.php b/scripts/lib/kodi.php
new file mode 100644 (file)
index 0000000..6d14bd2
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+function getKodiDBConnection()
+{
+    return mysqli_connect('localhost', "kodi", "atacama", "MyVideos116");
+}
+
+function kodiSyncPlayedStatus()
+{
+    $con = getKodiDBConnection();
+
+    $seen = connectRedis()->igbget('mediaseen');
+    $seenChanged = false;
+
+    $result = mysqli_query($con, 'SELECT * FROM path');
+    $paths = [];
+    while ($path = $result->fetch_assoc()) {
+        $paths[$path['idPath']] = str_replace('nfs://192.168.13.3/', '/', $path['strPath']);
+    }
+
+    $result = mysqli_query($con, 'SELECT * FROM files');
+    $files = [];
+    $playCounts = [];
+    while ($file = $result->fetch_assoc()) {
+        $filename = $paths[$file['idPath']] . $file['strFilename'];
+        $files[$filename] = $file['idFile'];
+        $playCounts[$filename] = $file['playCount'];
+        if (null !== $file['playCount'] && !isset($seen[$filename])) {
+            $seen[$filename] = true;
+            $seenChanged = true;
+        }
+    }
+
+    // Update seen if needed
+    if ($seenChanged) {
+        echo 'seen changed' . "<br>";
+        connectRedis()->igbset('mediaseen', $seen);
+    }
+    // Update kodi database
+    foreach ($seen as $file => $s) {
+        $file = str_replace('//', '/', $file);
+        if (!array_key_exists($file, $playCounts) || ($playCounts[$file] && $playCounts[$file] >= 0)) {
+            continue;
+        }
+        $fileId = $files[$file];
+        mysqli_query($con, 'UPDATE files SET playCount=1,lastPlayed=NOW() WHERE idFile=' . $fileId);
+    }
+}
\ No newline at end of file
index 88bf717ab69263c844d6508feda39a575a894f6a..cb9fb41527d3aa857357610f0a9ec7489b1a3ab5 100644 (file)
@@ -45,6 +45,7 @@ require_once ROOT . '/scripts/lib/flowerpower.php';
 require_once ROOT . '/scripts/lib/denon.php';
 require_once ROOT . '/scripts/lib/proc.php';
 require_once ROOT . '/scripts/lib/shield.php';
+require_once ROOT . '/scripts/lib/kodi.php';
 
 
 profile('Loaded libraries', __FILE__, __LINE__);
index 1f93fe6b2fdc5428b35454a05651106bccce587d..13ede7910e7214508c9df9575aa446223ff381d0 100644 (file)
@@ -79,6 +79,8 @@ function shieldKey($keys, $device = null)
         'fast-rewind' => 'KEYCODE_MEDIA_REWIND',
         'forward' => 'KEYCODE_MEDIA_FAST_FORWARD',
         'fast-forward' => 'KEYCODE_MEDIA_FAST_FORWARD',
+        'next' => 'KEYCODE_PAGE_UP',
+        'prev' => 'KEYCODE_PAGE_DOWN',
         'volume-up' => 'KEYCODE_VOLUME_UP',
         'volume-down' => 'KEYCODE_VOLUME_DOWN',
         'volume-mute' => 'KEYCODE_VOLUME_MUTE',
index f7aaf731ff5f546dea7a8aced61af7b55448c982..ed44023f97d92db9d9c132b35c81481b6da84cd8 100644 (file)
@@ -121,6 +121,9 @@ main {
   position: relative;
   z-index: 1;
 }
+[data-remote-command] {
+  cursor: pointer;
+}
 section {
   margin: 0 auto;
   font-size: 99px;
index 82566aaa26cc697c8e88aa02ce030d42322c436f..cd74470f457306ef233ce3ec7007763601342f56 100644 (file)
@@ -146,6 +146,10 @@ main {
   z-index: 1;
 }
 
+[data-remote-command]{
+  cursor: pointer;
+}
+
 section {
   margin: 0 auto;
   font-size: 99px;