]> _ Git - tortuga-home.git/commitdiff
.
authorVincent <vincent@enhydra.fr>
Tue, 21 Jan 2020 10:31:59 +0000 (11:31 +0100)
committerVincent <vincent@enhydra.fr>
Tue, 21 Jan 2020 10:31:59 +0000 (11:31 +0100)
.idea/workspace.xml
scripts/lib/medialibrary.php
scripts/lib/squeezebox.php

index 2f129391c7b33aea76a27aecea27bbd457534b97..7456d8d8f34babf47a6be5f73ead18d35d09fe83 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/mediarasp.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/mediarasp.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/squeezebox.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/squeezebox.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
       <workItem from="1578759225069" duration="373000" />
       <workItem from="1578771487829" duration="5723000" />
       <workItem from="1579161178878" duration="2992000" />
+      <workItem from="1579457368919" duration="3620000" />
     </task>
     <task id="LOCAL-00229" summary=".">
       <created>1568480708820</created>
       <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="1578558711439" />
-    <state x="976" y="343" key="com.intellij.ide.util.TipDialog" timestamp="1579161185918">
+    <state x="976" y="343" key="com.intellij.ide.util.TipDialog" timestamp="1579457397304">
       <screen x="0" y="0" width="2560" height="1040" />
     </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="1575647093028" />
-    <state x="976" y="343" key="com.intellij.ide.util.TipDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1579161185918" />
-    <state x="976" y="257" width="607" height="536" key="find.popup" timestamp="1578556582887">
+    <state x="976" y="343" key="com.intellij.ide.util.TipDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1579457397304" />
+    <state x="976" y="257" width="607" height="536" key="find.popup" timestamp="1579506279995">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
     <state x="732" y="257" width="607" height="536" key="find.popup/0.0.1920.1040@0.0.1920.1040" timestamp="1577380471547" />
-    <state x="976" y="257" width="607" height="536" key="find.popup/0.0.2560.1040@0.0.2560.1040" timestamp="1578556582887" />
+    <state x="976" y="257" width="607" height="536" key="find.popup/0.0.2560.1040@0.0.2560.1040" timestamp="1579506279995" />
     <state x="936" y="240" key="run.anything.popup" timestamp="1578386519646">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
index 6b7d3cd807f711ea97006c8cbdced6a012f9c32e..8c5963a2ac0084b0ca3be10788297a8c88fc7a63 100644 (file)
@@ -127,6 +127,8 @@ function transcodeOneVideo()
     }
 
     $list = getVideosList(true);
+
+
     foreach ($list as $item) {
 
         /** @var SplFileInfo $item */
@@ -142,10 +144,11 @@ function transcodeOneVideo()
         wakeupPC('avion');
         sleep(5);
 
-        $cmd = 'C:\Scripts\convertvideo.bat "' . nasToAvion($item) . '" "' . nasToAvion($to) . '" ' . $item->getExtension();
+        $cmd = 'C:\Scripts\convertvideo.bat "' . nasToAvion($item) . '" "' . nasToAvion($to) . '" ' . $item->getExtension() . ' ' . getVideoCodec($path);
         print_r(sshCommand($cmd, 'avion'));
         return;
     }
+    echo 'no file to transcode';
 }
 
 function nasToAvion($path)
@@ -187,6 +190,9 @@ function getVideosList($shuffle = false)
     $dirit = new RecursiveDirectoryIterator('/nas/Videos');
     $filtered = new DirFilter($dirit, ['@eaDir']);
     $iterator = new RecursiveIteratorIterator($filtered, RecursiveIteratorIterator::CHILD_FIRST);
+
+    $toTranscode = ['hevc', 'vc1'];
+
     foreach ($iterator as $f) {
         /** @var $f SplFileInfo */
         if (!$f->isFile()) {
@@ -199,7 +205,7 @@ function getVideosList($shuffle = false)
 
         $codec = getVideoCodec($path);
 
-        if ($codec != 'hevc') {
+        if (!in_array($codec, $toTranscode)) {
             continue;
         }
         if (preg_match('/[\&\[\]\|]/', $f->getFilename(), $matches)) {
index 81475bf01ea112e821a59554513b2a5341e24bf4..5e2c9017ce938e44fe1968224baea83326ca3552 100644 (file)
@@ -81,7 +81,7 @@ function squeezePlayByName($musicName, $player, $volume = null, $playIfSync = tr
         return;
     }
 
-    if($player == $squeezeboxPlayers['Salon']){
+    if ($player == $squeezeboxPlayers['Salon']) {
         harmonyActivity('musique-radio');
     }
     if ($player == $squeezeboxPlayers['Salle de bains']) {
@@ -128,7 +128,7 @@ function _player($player = null)
 
 function squeezeVolume($volume, $increase = '', $player = null)
 {
-    $cmd='mixer volume ' . $increase . max(0, min(100, intval($volume)));
+    $cmd = 'mixer volume ' . $increase . max(0, min(100, intval($volume)));
     echo $cmd;
     return squeezeRequest($cmd, $player);
 }
@@ -221,16 +221,28 @@ function checkSpottyLogin()
     $spottybase = '/plugins/Spotty/settings/';
     $hascredentials = httpRequest(SQUEEZEBOX_SERVER . $spottybase . 'basic.html?_dc=' . time(), 'get', [], null, 10, false);
 
-    if ($hascredentials->getStatusCode() == 302) {
+    $accounts = [
+        //SQUEEZEBOX_SPOTIFY_USERNAME => SQUEEZEBOX_SPOTIFY_PASSWORD,
+        'v12l' => 'Lr8ka&7cs@fc%lW7',
+        'jrme75009' => 'tortuga5009',
+    ];
+
+    $loggedIn = $hascredentials->getStatusCode() !== 302;
+    if ($loggedIn) {
+        $resp = $hascredentials->getBody();
+        foreach ($accounts as $user => $password) {
+            if (!stristr($resp, $user)) {
+                $loggedIn = false;
+                break;
+            }
+        }
+    }
+
+    if (!$loggedIn) {
         global $squeezeboxPlayers;
         echo 'Not logged in !<br>';
         $player = $squeezeboxPlayers['Cuisine'];
 
-        $accounts = [
-            //SQUEEZEBOX_SPOTIFY_USERNAME => SQUEEZEBOX_SPOTIFY_PASSWORD,
-            'v12l' => 'Lr8ka&7cs@fc%lW7',
-            'jrme75009' => 'tortuga5009',
-        ];
 
         foreach ($accounts as $user => $password) {
             echo 'Log in to Spotify with username ' . $user . "\n";
@@ -244,9 +256,10 @@ function checkSpottyLogin()
                 'password' => $password,
                 'accountId' => ''], null, 60);
             print_r($res->getBody());
+            echo '<br>';
         }
     } else {
-        echo 'Logged in :)';
+        echo 'Logged in :)<br>';
         print_r($hascredentials);
         print_r($hascredentials->getBody());
     }