]> _ Git - tortuga-home.git/commitdiff
.
authorVincent <vincent@enhydra.fr>
Sat, 6 Jun 2020 16:42:16 +0000 (18:42 +0200)
committerVincent <vincent@enhydra.fr>
Sat, 6 Jun 2020 16:42:16 +0000 (18:42 +0200)
.idea/workspace.xml
scripts/cron/cron.php
scripts/lib/remoteinfos.php
scripts/lib/tmdb.php
tools/pop/pop.py

index 3dde7a4976530bb906c40a8d6e53e870c39f3c49..ce7c9bd6dc5e21d07a424ecdf5f7e5de5d97ae9d 100644 (file)
@@ -3,8 +3,10 @@
   <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/cron/cron.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/cron/cron.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/remoteinfos.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/remoteinfos.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/tmdb.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/tmdb.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/tools/pop/pop.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools/pop/pop.py" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/tools/pop/startpopdaemon" beforeDir="false" afterPath="$PROJECT_DIR$/tools/pop/startpopdaemon" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
       <workItem from="1590912219927" duration="2795000" />
       <workItem from="1591437119712" duration="23000" />
       <workItem from="1591437163856" duration="1334000" />
-      <workItem from="1591438704520" duration="1634000" />
-    </task>
-    <task id="LOCAL-00274" summary=".">
-      <created>1578556780231</created>
-      <option name="number" value="00274" />
-      <option name="presentableId" value="LOCAL-00274" />
-      <option name="project" value="LOCAL" />
-      <updated>1578556780231</updated>
+      <workItem from="1591438704520" duration="2066000" />
+      <workItem from="1591456322960" duration="915000" />
+      <workItem from="1591458634078" duration="2877000" />
     </task>
     <task id="LOCAL-00275" summary=".">
       <created>1578559851311</created>
       <option name="project" value="LOCAL" />
       <updated>1591437757808</updated>
     </task>
-    <option name="localTasksCounter" value="323" />
+    <task id="LOCAL-00323" summary=".">
+      <created>1591440466804</created>
+      <option name="number" value="00323" />
+      <option name="presentableId" value="LOCAL-00323" />
+      <option name="project" value="LOCAL" />
+      <updated>1591440466805</updated>
+    </task>
+    <option name="localTasksCounter" value="324" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
     <state x="960" y="247" key="#com.intellij.openapi.updateSettings.impl.PluginUpdateInfoDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1585852940968" />
-    <state x="935" y="114" width="1170" height="972" key="CommitChangelistDialog2" timestamp="1591437749116">
+    <state x="935" y="114" width="1170" height="972" key="CommitChangelistDialog2" timestamp="1591440409900">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
-    <state x="935" y="114" key="CommitChangelistDialog2/0.0.2560.1040@0.0.2560.1040" timestamp="1591437749116" />
+    <state x="935" y="114" key="CommitChangelistDialog2/0.0.2560.1040@0.0.2560.1040" timestamp="1591440409900" />
     <state x="1060" y="275" key="FileChooserDialogImpl" timestamp="1590912263817">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
     <state x="1456" y="240" key="com.intellij.ide.util.TipDialog/0.0.2560.1040@0.0.2560.1040" timestamp="1586418523328" />
-    <state x="977" y="257" width="607" height="536" key="find.popup" timestamp="1587628717476">
+    <state x="977" y="257" width="607" height="536" key="find.popup" timestamp="1591459411916">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
-    <state x="977" y="257" width="607" height="536" key="find.popup/0.0.2560.1040@0.0.2560.1040" timestamp="1587628717476" />
+    <state x="977" y="257" width="607" height="536" key="find.popup/0.0.2560.1040@0.0.2560.1040" timestamp="1591459411916" />
     <state x="943" y="225" width="672" height="678" key="search.everywhere.popup" timestamp="1584289936754">
       <screen x="0" y="0" width="2560" height="1040" />
     </state>
index e3d4420e20e1621b729870478d3b66d654628b50..d916b4a40d9c8209cef93f30f30582a3d592ae4e 100644 (file)
@@ -5,6 +5,9 @@ require_once __DIR__ . "/../import.php";
 function cronOneLoop($cronmin)
 {
     set_time_limit(0);
+
+    echo '------------------------------------' . "\n";
+    _logSection('One Loop // ' . $cronmin);
     cronRooms($cronmin);
     cronInsteon($cronmin);
     cronWeather($cronmin);
@@ -12,7 +15,6 @@ function cronOneLoop($cronmin)
     if ($cronmin % 5 == 0) {
         cronTraffic($cronmin, false);
         cronVelib($cronmin);
-        //cronBackyard($cronmin);
         cronGuest($cronmin);
     }
     if ($cronmin % 10 == 0) {
@@ -30,8 +32,8 @@ function cronOneLoop($cronmin)
     cronInterface($cronmin);
     if ($cronmin % 15 == 0) {
         cronXPlanet($cronmin);
-        cronPodcasts($cronmin);
         cronFlowerPower($cronmin);
+        cronPodcasts($cronmin);
     }
     if ($cronmin == 0) {
         cronEcoMode($cronmin);
@@ -40,10 +42,12 @@ function cronOneLoop($cronmin)
         cronTranscode($cronmin);
     }
     cronHeartbeat($cronmin);
+    _logSection('End Loop');
 }
 
 function cronXPlanet($cronmin)
 {
+    _logSection('XPlanet');
     $path = ROOT . '/tools/xplanet/';
     $suncurve = $path . 'xplanet-suncurve';
     $earth = $path . 'xplanet-earth';
@@ -53,16 +57,20 @@ function cronXPlanet($cronmin)
 
 function cronGuest($cronmin)
 {
+
+    _logSection('Guest');
     setState('guest', hasGuest() ? '1' : '0');
 }
 
 function cronInsteon($cronmin)
 {
+    _logSection('Insteon');
     insteonCommand('knock');
 }
 
 function cronEcoMode($cronmin)
 {
+    _logSection('Ecomode');
     $ecomode = (int)getEcoMode();
     $scenes = [0 => 'off', 1 => 'on', 2 => 'super'];
     execScene('ecomode/' . $scenes[$ecomode]);
@@ -70,11 +78,18 @@ function cronEcoMode($cronmin)
 
 function cronTranscode($cronmin)
 {
+    _logSection('Transcode');
     httpRequest('https://salon.home.tortuga.enhydra.fr/scripts/transcode.php', 'get', [], null, 10, true);
 }
 
+function _logSection($t)
+{
+    echo '------' . $t . ' :: ' . date('Y-m-d H:i:s') . "\n";
+}
+
 function cronRooms($cronmin)
 {
+    _logSection('Rooms');
     if ($cronmin % 5 == 0 && getState('bureauAutoMode') == '1') {
         updateBureauAuto();
     }
@@ -84,19 +99,16 @@ function cronRooms($cronmin)
     checkPlanetarium();
 }
 
-function cronBackyard($cronmin)
-{
-    domoticzSwitch(679, isDay()); // Projecteurs cour
-}
-
 function cronFlowerPower($cronmin)
 {
+    _logSection('Flower Power');
     updateFlowerPower();
 }
 
 function cronMediaLibrary($cronmin)
 {
     global $directories;
+    _logSection('Media Library');
 
     $media = array();
     $shareroot = '/volume1/Share';
@@ -120,6 +132,7 @@ function cronMediaLibrary($cronmin)
 
 function cronTmdb($cronmin)
 {
+    _logSection('TMDB');
     _getTVShows(true, false);
     _getMovies(true, false);
     _getMediaRecentAdded(true);
@@ -128,9 +141,10 @@ function cronTmdb($cronmin)
 
 function cronPing($cronmin)
 {
+    _logSection('Pings');
     global $devices;
-    setState('vincenthere', ping('192.168.13.31') ? '1' : '0');
-    setState('hasnetwork', ping('1.1.1.1', 443) ? '1' : '0');
+    setState('vincenthere', ping('192.168.13.31', 5) ? '1' : '0');
+    setState('hasnetwork', ping('1.1.1.1', 3, 443) ? '1' : '0');
     foreach ($devices as $name => $device) {
         $result = ping($device['host'], 3, 22) ? '1' : '0';
         setState('device_' . $name . '_awake', $result);
@@ -145,6 +159,7 @@ function cronPing($cronmin)
 
 function cronSqueezeFavorites($cronmin)
 {
+    _logSection('Squeeze Favorites');
     $favorites = getSqueezeFavorites();
     if ($favorites !== false && count($favorites) > 0) {
         connectRedis()->igbset('squeezebox_favorites', $favorites);
@@ -153,6 +168,7 @@ function cronSqueezeFavorites($cronmin)
 
 function cronWeather($cronmin)
 {
+    _logSection('Weather');
     $place = 2608449;
     $apikey = 'fM7z3yrWwnUuXuAPPYIM5EqTl2iBAGB6';
 
@@ -245,7 +261,7 @@ function cronWeather($cronmin)
 
 function cronVelib($cronmin)
 {
-
+    _logSection('Velib');
     $cache = ROOT . '/cache/velib.json';
 
     $hour = date('G');
@@ -270,7 +286,7 @@ function cronVelib($cronmin)
 
 function cronTraffic($cronmin, $force = false)
 {
-
+    _logSection('Traffic');
     $cache = ROOT . '/cache/traffic.json';
 
     $hour = date('G');
@@ -296,6 +312,7 @@ function cronTraffic($cronmin, $force = false)
 
 function cronPodcasts($cronmin)
 {
+    _logSection('Podcasts');
     checkSpottyLogin();
     $podcasts = getSqueezeFavorites(0, 'podcasts');
     if ($podcasts !== false && count($podcasts) > 0) {
@@ -305,6 +322,7 @@ function cronPodcasts($cronmin)
 
 function cronInterface($cronmin)
 {
+    _logSection('Interface');
     if ((getState('ecomode') == '0' && $cronmin % 3 == 0) || $cronmin % 10 == 0) {
         $devices = ['salon', 'bureau', 'entree', 'cuisine', 'litvincent', 'litjerome', 'sdb', 'chambre', 'bureausun', 'wc'];
         foreach ($devices as $device) {
@@ -315,6 +333,7 @@ function cronInterface($cronmin)
 
 function cronHarmony($cronmin)
 {
+    _logSection('Harmony');
     $currentActivity = getCurrentHarmonyActivity();
 
     if ($currentActivity == 'tv') {
@@ -343,6 +362,7 @@ function cronHarmony($cronmin)
 
 function cronHeartbeat($cronmin)
 {
+    _logSection('Heartbeat');
     if ($cronmin % 5 != 0) {
         return;
     }
index 70b67fba043ec6adde872ede3da3a43d717a2339..d1bf9420905fc280a250dfae2e6573b95dea2349 100644 (file)
@@ -47,7 +47,7 @@ function mediaraspRemoteInfos()
     $res['time'] = '';
     $res['title'] = '';
     $res['artwork'] = '';
-    $res['status']='';
+    $res['status'] = '';
 
     $d = getDevice();
     $playlist = simplexml_load_string(VLCCmd(['query' => 'requests/playlist.xml'], $d));
@@ -81,7 +81,7 @@ function mediaraspRemoteInfos()
                 $library = new moviesLibrary($directories);
                 $movie = $library->getMovieByID($id);
                 $res['title'] = $movie['title'];
-                $res['artwork'] = 'https://image.tmdb.org/t/p/w500' . $movie['backdrop_path'];
+                $res['artwork'] = cacheMedia('https://image.tmdb.org/t/p/w500' . $movie['backdrop_path']);
             }
         } else {
             $f = new SplFileInfo($file);
@@ -97,7 +97,7 @@ function mediaraspRemoteInfos()
                     if (count($matches) > 0) {
                         $res['title'] .= '<br>S' . $matches[1] . ' E' . $matches[2];
                     }
-                    $res['artwork'] = 'https://image.tmdb.org/t/p/w500' . $tvshow['backdrop_path'];
+                    $res['artwork'] = cacheMedia('https://image.tmdb.org/t/p/w500' . $tvshow['backdrop_path']);
                 }
             }
         }
@@ -117,7 +117,7 @@ function squeezeboxRemoteInfos()
     }
     $res['can_seek'] = isset($status['can_seek']);
     $res['title'] = $remoteMeta['title'];
-    $res['artwork'] = str_replace('http://', 'https://', $remoteMeta['artwork_url']);
+    $res['artwork'] = cacheMedia($remoteMeta['artwork_url']);
     return $res;
 }
 
index 471eff04ed4ea0824a54d5cc14ad3a7720218031..13ec69423725c9a693e4d94b2339af469f93fa1a 100644 (file)
@@ -196,7 +196,7 @@ class tvShowLibrary extends mediaLibrary
     {
         global $videoExt;
         $subname = $prefix . 'tvshow-' . $tvShow['id'];
-        $res['shortcuts'][] = ['label' => $tvShow['data']['name'], 'type' => 'sub', 'sub' => $subname, 'poster' => cacheMedia('https://image.tmdb.org/t/p/w500' . $tvShow['data']['poster_path'])];
+        $res['shortcuts'][] = ['label' => $tvShow['data']['name'], 'type' => 'sub', 'sub' => $subname, 'poster' => $this->_poster($tvShow['data']['poster_path'])];
 
         $res['subs']['sub-' . $subname] = ['size' => 'poster'];
         $res['subs']['sub-' . $subname][] = ['label' => $tvShow['data']['name'], 'type' => 'back'];
@@ -325,6 +325,15 @@ class mediaLibrary
         }
         return $lastModified;
     }
+
+    public function _poster($path)
+    {
+        if ($path === '') {
+            return '';
+        } else {
+            return cacheMedia('https://image.tmdb.org/t/p/w500' . $path);
+        }
+    }
 }
 
 class moviesLibrary extends mediaLibrary
@@ -445,9 +454,10 @@ class moviesLibrary extends mediaLibrary
     public function shortcut($movie, $prefix, &$res)
     {
         $path = $this->_path($movie['path']);
-        $res[] = ['label' => $movie['data']['title'], 'type' => 'media', 'seen' => $this->_seen($path), 'srt' => hasSRT($path), 'path' => $path, 'poster' => cacheMedia('https://image.tmdb.org/t/p/w500' . $movie['data']['poster_path'])];
+        $res[] = ['label' => $movie['data']['title'], 'type' => 'media', 'seen' => $this->_seen($path), 'srt' => hasSRT($path), 'path' => $path, 'poster' => $this->_poster($movie['data']['poster_path'])];
     }
 
+
     public function _orderMovies($a, $b)
     {
         return mb_strcasecmp($a['data']['title'], $b['data']['title']);
index 81f927a4e8d65e14bbfa8e223cb20f6db5e3a8c2..24fc99edb8f6caa9a43c440b585d051d870c3e49 100644 (file)
@@ -49,7 +49,7 @@ while True:
 
         while True:
             try:
-                if p.waitForNotifications(30.0):
+                if p.waitForNotifications(0.2):
                     # handleNotification() was called
                     continue