]> _ Git - tortuga-home.git/commitdiff
.
authorVincent <vincent@enhydra.fr>
Fri, 31 Jan 2020 08:10:02 +0000 (09:10 +0100)
committerVincent <vincent@enhydra.fr>
Fri, 31 Jan 2020 08:10:02 +0000 (09:10 +0100)
.idea/workspace.xml
scripts/lib/medialibrary.php
scripts/lib/scenes.php

index a5bd3f83aaf2aba5a8d22ebac470dc264676b8c7..3ebe478d9ce8dbdf2621ec7125fe3d70ba1d37a6 100644 (file)
@@ -3,7 +3,8 @@
   <component name="ChangeListManager">
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/lib/insteon.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/insteon.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/medialibrary.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/medialibrary.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/scenes.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/scenes.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
       <workItem from="1579853532996" duration="4655000" />
       <workItem from="1580059999939" duration="6428000" />
       <workItem from="1580372411103" duration="5070000" />
-      <workItem from="1580457212034" duration="169000" />
-    </task>
-    <task id="LOCAL-00235" summary=".">
-      <created>1571209734092</created>
-      <option name="number" value="00235" />
-      <option name="presentableId" value="LOCAL-00235" />
-      <option name="project" value="LOCAL" />
-      <updated>1571209734093</updated>
+      <workItem from="1580457212034" duration="849000" />
     </task>
     <task id="LOCAL-00236" summary=".">
       <created>1571574019434</created>
       <option name="project" value="LOCAL" />
       <updated>1580377820163</updated>
     </task>
-    <option name="localTasksCounter" value="284" />
+    <task id="LOCAL-00284" summary=".">
+      <created>1580457418659</created>
+      <option name="number" value="00284" />
+      <option name="presentableId" value="LOCAL-00284" />
+      <option name="project" value="LOCAL" />
+      <updated>1580457418659</updated>
+    </task>
+    <option name="localTasksCounter" value="285" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
     </state>
     <state x="720" y="247" key="#com.intellij.openapi.updateSettings.impl.PluginUpdateInfoDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1577298128269" />
     <state x="960" y="247" key="#com.intellij.openapi.updateSettings.impl.PluginUpdateInfoDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1579773503974" />
-    <state x="935" y="114" key="CommitChangelistDialog2" timestamp="1580377804997">
+    <state x="935" y="114" key="CommitChangelistDialog2" timestamp="1580458186654">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
     <state x="701" y="114" key="CommitChangelistDialog2/0.0.1920.1040@0.0.1920.1040" timestamp="1577381105204" />
     <state x="701" y="127" key="CommitChangelistDialog2/0.0.1920.1160@0.0.1920.1160" timestamp="1575647157027" />
-    <state x="935" y="114" key="CommitChangelistDialog2/0.0.2560.1040@0.0.2560.1040" timestamp="1580377804997" />
+    <state x="935" y="114" key="CommitChangelistDialog2/0.0.2560.1040@0.0.2560.1040" timestamp="1580458186654" />
     <state x="92" y="92" width="2376" height="856" key="DiffContextDialog" timestamp="1580377344165">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
index 8c5963a2ac0084b0ca3be10788297a8c88fc7a63..f96403d10bbd5a9bcf5dbc7a1b7207739e02a5dd 100644 (file)
@@ -134,7 +134,7 @@ function transcodeOneVideo()
         /** @var SplFileInfo $item */
         $path = $item->getRealPath();
         $to = preg_replace('/\.' . $item->getExtension() . '$/', '.x264.' . $item->getExtension(), $path);
-        if (file_exists($to)) {
+        if (file_exists($to) && videosHaveSameDuration($path, $to)) {
             continue;
         }
 
@@ -151,6 +151,11 @@ function transcodeOneVideo()
     echo 'no file to transcode';
 }
 
+function videosHaveSameDuration($v1, $v2, $tolerance = 10)
+{
+    return abs(getVideoDuration($v1) - getVideoDuration($v2)) < $tolerance;
+}
+
 function nasToAvion($path)
 {
     $path = str_replace('/volume1/Share/', 'Z:/', $path);
@@ -238,4 +243,15 @@ function getVideoCodec($path)
         setState($cacheKey, $res);
     }
     return $res;
+}
+
+function getVideoDuration($path)
+{
+    $cacheKey = 'duration_4_' . md5($path . '-' . filemtime($path));
+    $res = getState($cacheKey, null);
+    if (null === $res) {
+        $res = `ffprobe -i "$path" -show_entries format=duration -v quiet -of csv="p=0"`;
+        setState($cacheKey, $res);
+    }
+    return $res;
 }
\ No newline at end of file
index 217c3a9843b264706ace2e9f7e550368ec3c4af5..8026bf4668f5412ef8686a325d041cdf5ca2ab45 100644 (file)
@@ -301,9 +301,6 @@ $scenes = [
         ['type' => 'ecomode', 'mode' => '0'],
         ['type' => 'insteon', 'command' => '0?1111=I=0=0'],
         ['type' => 'hue', 'group' => $salon, 'scene' => 'AsU9eOyGsjEyz35'],
-        ['type' => 'hue', 'group' => $bureau, 'scene' => 'Ntv7DDEMGtuYA9L'],
-        ['type' => 'scene', 'scene' => 'chambre/off/exceptcheminee'],
-
     ],
     'salon/tamise' => [
         ['type' => 'ecomode', 'mode' => '0'],