]> _ Git - tortuga-home.git/commitdiff
.
authorVincent <vincent@enhydra.fr>
Sun, 15 Nov 2020 09:24:46 +0000 (10:24 +0100)
committerVincent <vincent@enhydra.fr>
Sun, 15 Nov 2020 09:24:46 +0000 (10:24 +0100)
.idea/workspace.xml
scripts/lib/medialibrary.php

index 2c183c0b8ab53a6fddc174d27df27fd75563e55a..f8c59a6f625dea5220e01d358243c81fd43a67e0 100644 (file)
@@ -4,7 +4,6 @@
     <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/medialibrary.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/medialibrary.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/transcode.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/transcode.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
       <workItem from="1605087787424" duration="33487000" />
       <workItem from="1605261347643" duration="1199000" />
       <workItem from="1605342171398" duration="4613000" />
-      <workItem from="1605355486465" duration="15362000" />
-    </task>
-    <task id="LOCAL-00346" summary=".">
-      <created>1602501505304</created>
-      <option name="number" value="00346" />
-      <option name="presentableId" value="LOCAL-00346" />
-      <option name="project" value="LOCAL" />
-      <updated>1602501505304</updated>
+      <workItem from="1605355486465" duration="15698000" />
     </task>
     <task id="LOCAL-00347" summary=".">
       <created>1602863336459</created>
       <option name="project" value="LOCAL" />
       <updated>1605431702382</updated>
     </task>
-    <option name="localTasksCounter" value="395" />
+    <task id="LOCAL-00395" summary=".">
+      <created>1605431934015</created>
+      <option name="number" value="00395" />
+      <option name="presentableId" value="LOCAL-00395" />
+      <option name="project" value="LOCAL" />
+      <updated>1605431934015</updated>
+    </task>
+    <option name="localTasksCounter" value="396" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
       <screen x="0" y="0" width="1707" height="920" />
     </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="198" y="0" width="737" height="502" key="CommitChangelistDialog2" timestamp="1605431699392">
+    <state x="198" y="0" width="737" height="502" key="CommitChangelistDialog2" timestamp="1605431931637">
       <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="1605431699392" />
+    <state x="198" y="0" width="745" height="567" key="CommitChangelistDialog2/0.0.2560.1040@0.0.2560.1040" timestamp="1605431931637" />
     <state x="952" y="244" key="FileChooserDialogImpl" timestamp="1605104496549">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
index 7b844ca611bac8e1ceb99a21168f0c773affc426..c7070e097ce3da194c576c3cd3225cd21d098000 100644 (file)
@@ -87,6 +87,9 @@ function getX264Version($path, $forceReturn = false)
     $e = explode('.', $path);
     $ext = array_pop($e);
     array_push($e, 'x264');
+    if ($ext === 'avi') {
+        $ext = 'mkv';
+    }
     array_push($e, $ext);
     $x264path = implode('.', $e);
     if ($forceReturn || file_exists($x264path)) {
@@ -146,9 +149,15 @@ function transcodeOneVideo()
 
     foreach ($list as $item) {
 
+        $destext = $item->getExtension();
+        if ($destext === 'avi') {
+            $destext = 'mkv';
+        }
+
+
         /** @var SplFileInfo $item */
         $path = $item->getRealPath();
-        $to = preg_replace('/\.' . $item->getExtension() . '$/', '.x264.' . $item->getExtension(), $path);
+        $to = preg_replace('/\.' . $item->getExtension() . '$/', '.x264.' . $destext, $path);
 
 
         if (file_exists($to) && filesize($to) != 0 && videosHaveSameDuration($path, $to)) {
@@ -166,7 +175,7 @@ function transcodeOneVideo()
         }
 
         $resize = getVideoHeight($path) > 1080 ? ' 1' : ' 0';
-        $cmd = 'C:\Scripts\convertvideo.bat "' . nasToAvion($item) . '" "' . nasToAvion($to) . '" ' . $item->getExtension() . ' ' . getVideoCodec($path) . $resize;
+        $cmd = 'C:\Scripts\convertvideo.bat "' . nasToAvion($item) . '" "' . nasToAvion($to) . '" ' . $destext . ' ' . getVideoCodec($path) . $resize;
         print_r(sshCommand($cmd, 'avion'));
         return;
     }
@@ -224,6 +233,7 @@ function getVideosList($shuffle = false)
     $iterator = new RecursiveIteratorIterator($filtered, RecursiveIteratorIterator::CHILD_FIRST);
 
     $toTranscode = ['hevc', 'vc1', 'xvid'];
+    $extToTranscode = ['avi'];
 
     foreach ($iterator as $f) {
         /** @var $f SplFileInfo */
@@ -237,7 +247,7 @@ function getVideosList($shuffle = false)
 
         $codec = getVideoCodec($path);
 
-        if (!in_array($codec, $toTranscode)) {
+        if (!in_array($codec, $toTranscode) && !in_array($f->getExtension(), $extToTranscode)) {
             continue;
         }
         if (preg_match('/[\&\[\]\|]/', $f->getFilename(), $matches)) {