<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" />
--- /dev/null
+<?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