]> _ Git - tortuga-home.git/commitdiff
.
authorVincent <vincent@enhydra.fr>
Thu, 20 Feb 2020 17:42:57 +0000 (18:42 +0100)
committerVincent <vincent@enhydra.fr>
Thu, 20 Feb 2020 17:42:57 +0000 (18:42 +0100)
.idea/workspace.xml
scripts/lib/medialibrary.php

index fff4c1ba6700854e63929536ff8494e05752af0d..c3387fa3da1ac4b5c10d9bda534d1bea1aad63a8 100644 (file)
       <workItem from="1581949971467" duration="946000" />
       <workItem from="1582013653504" duration="1339000" />
       <workItem from="1582100423273" duration="2523000" />
-      <workItem from="1582130476569" duration="54000" />
-    </task>
-    <task id="LOCAL-00256" summary=".">
-      <created>1577377271842</created>
-      <option name="number" value="00256" />
-      <option name="presentableId" value="LOCAL-00256" />
-      <option name="project" value="LOCAL" />
-      <updated>1577377271842</updated>
+      <workItem from="1582130476569" duration="857000" />
+      <workItem from="1582201880333" duration="2436000" />
     </task>
     <task id="LOCAL-00257" summary=".">
       <created>1577380217123</created>
       <option name="project" value="LOCAL" />
       <updated>1582104447675</updated>
     </task>
-    <option name="localTasksCounter" value="305" />
+    <task id="LOCAL-00305" summary=".">
+      <created>1582130758226</created>
+      <option name="number" value="00305" />
+      <option name="presentableId" value="LOCAL-00305" />
+      <option name="project" value="LOCAL" />
+      <updated>1582130758226</updated>
+    </task>
+    <option name="localTasksCounter" value="306" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
     <state x="872" y="242" key="Vcs.Push.Dialog.v2/0.0.2560.1040@0.0.2560.1040" timestamp="1580377827629" />
-    <state x="732" y="383" key="com.intellij.ide.util.TipDialog" timestamp="1582130476734">
+    <state x="732" y="383" key="com.intellij.ide.util.TipDialog" timestamp="1582201881167">
       <screen x="0" y="0" width="1920" height="1160" />
     </state>
     <state x="732" y="343" key="com.intellij.ide.util.TipDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1577380394903" />
-    <state x="732" y="383" key="com.intellij.ide.util.TipDialog/0.0.1920.1160@0.0.1920.1160" timestamp="1582130476734" />
+    <state x="732" y="383" key="com.intellij.ide.util.TipDialog/0.0.1920.1160@0.0.1920.1160" timestamp="1582201881167" />
     <state x="976" y="343" key="com.intellij.ide.util.TipDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1582100425539" />
     <state x="733" y="287" width="607" height="598" key="find.popup" timestamp="1582125776502">
       <screen x="0" y="0" width="1920" height="1160" />
index f7e0e44741aedc440e008a306e13da82c160f4af..a890de002287261d1089cb16d9263419336af500 100644 (file)
@@ -133,8 +133,12 @@ function transcodeOneVideo()
         /** @var SplFileInfo $item */
         $path = $item->getRealPath();
         $to = preg_replace('/\.' . $item->getExtension() . '$/', '.x264.' . $item->getExtension(), $path);
-        if (file_exists($to) && filesize($to) > 0 && videosHaveSameDuration($path, $to)) {
+
+
+        if (file_exists($to) && filesize($to) != 0 && videosHaveSameDuration($path, $to)) {
             continue;
+        } else {
+            echo $to . '/exists :' . file_exists($to) . '/size:' . filesize($to) . "\n\n";
         }
 
         set_time_limit(0);
@@ -155,7 +159,12 @@ function transcodeOneVideo()
 
 function videosHaveSameDuration($v1, $v2, $tolerance = 10)
 {
-    return abs((float)getVideoDuration($v1) - (float)getVideoDuration($v2)) < $tolerance;
+    $d1 = getVideoDuration($v1);
+    $d2 = getVideoDuration($v2);
+    $diff = abs($d1 - $d2);
+    $res = $diff < $tolerance;
+    echo $v1 . '/' . $v2 . '/' . $d1 . '/' . $d2 . '/' . $diff . '/' . $res . "\n";
+    return $res;
 }
 
 function nasToAvion($path)
@@ -228,7 +237,7 @@ function getVideosList($shuffle = false)
 
 function getVideoCodec($path)
 {
-    $cacheKey = 'codec_3_' . $path;
+    $cacheKey = 'codec_3_' . md5($path . '-' . filemtime($path) . '-' . filesize($path));
     $res = getState($cacheKey, null);
     if (null === $res) {
         $codecfile = $path . '.vc';
@@ -255,7 +264,7 @@ function getVideoDuration($path)
         $res = `ffprobe -i "$path" -show_entries format=duration -v quiet -of csv="p=0"`;
         setState($cacheKey, $res);
     }
-    return $res;
+    return (float)$res;
 }
 
 function getVideoHeight($path)