]> _ Git - tortuga-home.git/commitdiff
.
authorVincent <vincent@enhydra.fr>
Mon, 7 Dec 2020 08:44:42 +0000 (09:44 +0100)
committerVincent <vincent@enhydra.fr>
Mon, 7 Dec 2020 08:44:42 +0000 (09:44 +0100)
.idea/workspace.xml
scripts/lib/kodi.php
scripts/lib/medialibrary.php

index b13499fc36c84a223a9587f4352f124d9220e676..ba0f7968a2159e027b13da370745fb81c519470e 100644 (file)
@@ -2,16 +2,9 @@
 <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$/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" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/kodi.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/kodi.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/medialibrary.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/medialibrary.php" 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="1606936960189" duration="47000" />
       <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="number" value="00368" />
-      <option name="presentableId" value="LOCAL-00368" />
-      <option name="project" value="LOCAL" />
-      <updated>1604390350662</updated>
+      <workItem from="1607084835284" duration="6328000" />
+      <workItem from="1607323219546" duration="4378000" />
     </task>
     <task id="LOCAL-00369" summary=".">
       <created>1604396748171</created>
       <option name="project" value="LOCAL" />
       <updated>1606938157166</updated>
     </task>
-    <option name="localTasksCounter" value="417" />
+    <task id="LOCAL-00417" summary=".">
+      <created>1607282050429</created>
+      <option name="number" value="00417" />
+      <option name="presentableId" value="LOCAL-00417" />
+      <option name="project" value="LOCAL" />
+      <updated>1607282050429</updated>
+    </task>
+    <option name="localTasksCounter" value="418" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
index 6d14bd2dc4313407004a60b114acf91efd785bd2..894073ce6e533f6ecf682a3bcb0ca666cf8fc026 100644 (file)
@@ -38,10 +38,20 @@ function kodiSyncPlayedStatus()
     // Update kodi database
     foreach ($seen as $file => $s) {
         $file = str_replace('//', '/', $file);
-        if (!array_key_exists($file, $playCounts) || ($playCounts[$file] && $playCounts[$file] >= 0)) {
-            continue;
+        $e = explode('.', $file);
+        $ext = array_pop($e);
+        array_push($e, 'x264');
+        array_push($e, $ext);
+        $x264 = implode('.', $e);
+
+        foreach ([$file, $x264] as $f) {
+            if (!array_key_exists($f, $playCounts) || ($playCounts[$f] && $playCounts[$f] >= 0)) {
+                continue;
+            }
+            $fileId = $files[$f];
+            mysqli_query($con, 'UPDATE files SET playCount=1,lastPlayed=NOW() WHERE idFile=' . $fileId);
         }
-        $fileId = $files[$file];
-        mysqli_query($con, 'UPDATE files SET playCount=1,lastPlayed=NOW() WHERE idFile=' . $fileId);
+
+
     }
 }
\ No newline at end of file
index d98f7ed418d4d3b228325eabf8ed1fd5b9fbbdb4..6523ef3f2a61492c7e395d06316ebf61f41e4280 100644 (file)
@@ -139,6 +139,24 @@ function mediaName($name, $context, $dir, $path)
 ////
 ////ffmpeg -i /volume1/Share/Videos/Séries/Westworld/S01/E01.mkv -c:v libx264 -crf 19 -preset slow -c:a aac -b:a 192k -ac 2 /volume1/Share/Videos/Séries/Westworld/S01/E01.x264.mkv
 //
+
+
+function getTranscodedPath(SplFileInfo $item)
+{
+    $destext = $item->getExtension();
+    if ($destext === 'avi') {
+        $destext = 'mkv';
+    }
+    $normalized = $item->getRealPath();
+    $normalized = str_replace('/volume1/Share', '', $normalized);
+    $normalized = str_replace('/nas', '', $normalized);
+    $normalized = str_replace('/mnt/smb/share', '', $normalized);
+    $normalized = str_replace('/mnt/sshfs/share', '', $normalized);
+    $normalized = 'c' . $normalized;
+    return '/mnt/smb/share/Videos/Transcoded/' . sha1($normalized) . '.' . $destext;
+
+}
+
 function transcodeOneVideo()
 {
     if (getState('night') == '1' || getState('device_avion_awake') == '0') {
@@ -157,8 +175,15 @@ function transcodeOneVideo()
 
         /** @var SplFileInfo $item */
         $path = $item->getRealPath();
-        $to = preg_replace('/\.' . $item->getExtension() . '$/', '.x264.' . $destext, $path);
+        $to = getTranscodedPath($item);
+        $oldto = preg_replace('/\.' . $item->getExtension() . '$/', '.x264.' . $destext, $path);
 
+        if (file_exists($oldto)) {
+            if (!file_exists($to) || filesize($oldto) > filesize($to)) {
+                rename($oldto, $to);
+            }
+            continue;
+        }
 
         if (file_exists($to) && filesize($to) != 0 && videosHaveSameDuration($path, $to)) {
             continue;
@@ -239,6 +264,9 @@ function getVideosList($shuffle = false)
         if (!$f->isFile()) {
             continue;
         }
+        if (stristr($f->getPath(), 'Transcoded')) {
+            continue;
+        }
         if (!in_array($f->getExtension(), $videoExt)) {
             continue;
         }