]> _ Git - tortuga-home.git/commitdiff
.
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 25 Mar 2026 11:00:40 +0000 (12:00 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 25 Mar 2026 11:00:40 +0000 (12:00 +0100)
.idea/workspace.xml
config/music.php
scripts/cron/cron.php
scripts/lib/squeezebox.php

index 299110e1119dc24e09e83b5a759fdb524fc014f0..a83b2bda93a346befff97cbaf8ae23014e0c7540 100644 (file)
@@ -6,15 +6,9 @@
   <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$/config/music.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/music.php" 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/lib.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/lib.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/lib/mediarasp.php" beforeDir="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/shield.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/shield.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/shield.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/shield.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/syno.php" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/tmdb.php" beforeDir="false" />
-      <change beforePath="$PROJECT_DIR$/scripts/transcode.php" beforeDir="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="1772370387714" duration="7090000" />
       <workItem from="1773390371781" duration="506000" />
       <workItem from="1774028822942" duration="792000" />
-      <workItem from="1774430967346" duration="5035000" />
+      <workItem from="1774430967346" duration="5227000" />
     </task>
     <task id="LOCAL-00502" summary=".">
       <created>1641726946298</created>
       <option name="project" value="LOCAL" />
       <updated>1687259667913</updated>
     </task>
-    <option name="localTasksCounter" value="638" />
+    <option name="localTasksCounter" value="639" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
index 27c1de2a07da43164f721f4cacf3479cff25f271..3a7f1af9911d44cef23f84c44f63c4db537b26ae 100644 (file)
@@ -3,9 +3,6 @@ $allmusics = array();
 
 squeezeFavorites(connectRedis()->igbget('squeezebox_favorites'), $shortcuts);
 profile('Got Music favorites', __FILE__, __LINE__);
-$podcasts = connectRedis()->igbget('squeezebox_podcasts');
-//podcastDir($podcasts, 'Podcasts', 'podcasts', $shortcuts);
-//profile('Got podcasts', __FILE__, __LINE__);
 
 function squeezeFavorites($favorites, &$shortcuts)
 {
@@ -61,39 +58,6 @@ function squeezeSubitems($s, $key, $label, &$shortcuts)
     $shortcuts[$key] = array_merge([['type' => 'back', 'label' => $label]], $t);
 }
 
-function podcastDir($podcasts, $label, $key, &$shortcuts)
-{
-    global $allmusics;
-
-    $k = 'sub-' . $key;
-    $t = [];
-
-    $hasDir = false;
-    if (!is_array($podcasts)) {
-        return;
-    }
-    foreach ($podcasts as $subitem) {
-        if ($subitem['hasitems']) {
-            if (count($subitem['subitems']) == 0) {
-
-            } elseif (count($subitem['subitems']) == 1) {
-                $t[] = audioElement($subitem['subitems'][0], 'podcasts');
-            } else {
-                $subname = isset($subitem['name']) && $subitem['name'] ? $subitem['name'] : $subitem['title'];
-                $subkey = $key . '-' . str_replace('.', '_', $subitem['id']);
-                $t[] = ['type' => 'sub', 'label' => $subname, 'sub' => $subkey];
-                podcastDir($subitem['subitems'], $subname, $subkey, $shortcuts);
-                $hasDir = true;
-            }
-        } else {
-            $t[] = audioElement($subitem, 'podcasts');
-        }
-    }
-
-    $shortcuts[$k] = array_merge([['type' => 'back', 'label' => $label]], $t);
-
-}
-
 function audioElement($subitem, $app = 'favorites')
 {
     global $allmusics;
@@ -113,8 +77,4 @@ $shortcuts['music'] = [
     ['type' => 'sub', 'label' => 'Radios', 'sub' => 'radio'],
     ['type' => 'sub', 'label' => 'Musique', 'sub' => 'playlists'],
     ['type' => 'sub', 'label' => 'Ambiance', 'sub' => 'ambiance'],
-];
-
-if ($podcasts !== false) {
-    $shortcuts['music'][] = ['type' => 'sub', 'label' => 'Podcasts', 'sub' => 'podcasts'];
-}
\ No newline at end of file
+];
\ No newline at end of file
index 493e98fd4fdb189a427cb11a19b7dc6828cec396..9accfcf70be2f707d73501fd19061d6d2d24ecf3 100644 (file)
 
 require_once __DIR__ . "/../import.php";
 
-function cronOneLoop($cronmin) {
-       set_time_limit(0);
+function cronOneLoop($cronmin)
+{
+    set_time_limit(0);
 
-       echo '------------------------------------' . "\n";
-       _logSection('One Loop // ' . $cronmin);
-       cronHeartbeat($cronmin, false);
-       cronRooms($cronmin);
-       cronWeather($cronmin);
+    echo '------------------------------------' . "\n";
+    _logSection('One Loop // ' . $cronmin);
+    cronHeartbeat($cronmin, false);
+    cronRooms($cronmin);
+    cronWeather($cronmin);
 
     if ($cronmin % 10 == 0) {
         cronSqueezeFavorites($cronmin);
     }
-    if ($cronmin % 15 == 0) {
-        cronPodcasts($cronmin);
-    }
 
-       if ($cronmin % 5 == 0) {
-               cronGuest($cronmin);
-               cronShield($cronmin);
-       }
+    if ($cronmin % 5 == 0) {
+        cronGuest($cronmin);
+        cronShield($cronmin);
+    }
 
-       if ($cronmin % 20 == 0) {
-               cronSqueezeCheckPlayers($cronmin);
-       }
+    if ($cronmin % 20 == 0) {
+        cronSqueezeCheckPlayers($cronmin);
+    }
 
-       if ($cronmin % 2 == 0) {
-               cronPing($cronmin);
-       }
+    if ($cronmin % 2 == 0) {
+        cronPing($cronmin);
+    }
 
-       cronHarmony($cronmin);
-       cronInterface($cronmin);
+    cronHarmony($cronmin);
+    cronInterface($cronmin);
 
-       cronEcoMode($cronmin);
-       cronHeartbeat($cronmin, true);
-       _logSection('End Loop (min:' . $cronmin . ')');
+    cronEcoMode($cronmin);
+    cronHeartbeat($cronmin, true);
+    _logSection('End Loop (min:' . $cronmin . ')');
 }
 
-function cronShield($cronmin) {
-       _logSection('Shield');
-       `/usr/local/bin/adb-connect`;
+function cronShield($cronmin)
+{
+    _logSection('Shield');
+    `/usr/local/bin/adb-connect`;
 }
 
-function cronGuest($cronmin) {
+function cronGuest($cronmin)
+{
 
-       _logSection('Guest');
-       setState('guest', hasGuest() ? '1' : '0');
+    _logSection('Guest');
+    setState('guest', hasGuest() ? '1' : '0');
 }
 
-function cronEcoMode($cronmin) {
-       _logSection('Ecomode');
+function cronEcoMode($cronmin)
+{
+    _logSection('Ecomode');
     setState('cron_heartbeat', time());
-       ecoMode(null, $cronmin % 15 === 0);
+    ecoMode(null, $cronmin % 15 === 0);
 }
 
-function _logSection($t) {
-       echo '------' . $t . ' :: ' . date('Y-m-d H:i:s') . "\n";
+function _logSection($t)
+{
+    echo '------' . $t . ' :: ' . date('Y-m-d H:i:s') . "\n";
 }
 
-function cronRooms($cronmin) {
-       _logSection('Rooms');
+function cronRooms($cronmin)
+{
+    _logSection('Rooms');
 
-       _logSection('Bureau');
-       updateBureauAuto();
+    _logSection('Bureau');
+    updateBureauAuto();
 
-       _logSection('Chambre');
-       updateChambreAuto();
+    _logSection('Chambre');
+    updateChambreAuto();
 
-       _logSection('Cour');
-       updateCourAuto();
+    _logSection('Cour');
+    updateCourAuto();
 
-       _logSection('Salon');
-       updateSalonAuto();
+    _logSection('Salon');
+    updateSalonAuto();
 
-       _logSection('Cuisine');
-       updateCuisine();
-       _logSection('Planetarium');
-       checkPlanetarium();
-       if ($cronmin % 2) {
-               _logSection('WC VMC');
-               checkWCVMC();
-       }
-}
-
-function cronPing($cronmin) {
-       _logSection('Pings');
-       global $devices;
-       setState('vincenthere', ping('192.168.13.20', 5) ? '1' : '0');
-       setState('hasnetwork', ping('1.1.1.1', 3, 443) ? '1' : '0');
-       foreach ($devices as $name => $device) {
-               if (!isset($device['host'])) {
-                       continue;
-               }
-               $result = ping($device['host'], 3, 22) ? '1' : '0';
-               setState('device_' . $name . '_awake', $result);
-               echo 'device_' . $name . '_awake : ' . getState('device_' . $name . '_awake') . "\n";
-               if ($result) {
-                       sshCommand('pwd', $device['host'], false, false);
-                       sshCommand('pwd', $device['host'], false, true);
-               }
-       }
+    _logSection('Cuisine');
+    updateCuisine();
+    _logSection('Planetarium');
+    checkPlanetarium();
+    if ($cronmin % 2) {
+        _logSection('WC VMC');
+        checkWCVMC();
+    }
 }
 
-function cronSqueezeFavorites($cronmin) {
-       _logSection('Squeeze Favorites');
-       $favorites = getSqueezeFavorites();
-       if ($favorites !== false && count($favorites) > 0) {
-               connectRedis()->igbset('squeezebox_favorites', $favorites);
-       }
+function cronPing($cronmin)
+{
+    _logSection('Pings');
+    global $devices;
+    setState('vincenthere', ping('192.168.13.20', 5) ? '1' : '0');
+    setState('hasnetwork', ping('1.1.1.1', 3, 443) ? '1' : '0');
+    foreach ($devices as $name => $device) {
+        if (!isset($device['host'])) {
+            continue;
+        }
+        $result = ping($device['host'], 3, 22) ? '1' : '0';
+        setState('device_' . $name . '_awake', $result);
+        echo 'device_' . $name . '_awake : ' . getState('device_' . $name . '_awake') . "\n";
+        if ($result) {
+            sshCommand('pwd', $device['host'], false, false);
+            sshCommand('pwd', $device['host'], false, true);
+        }
+    }
 }
 
-function cronSqueezeCheckPlayers($cronmin) {
-       _logSection('Check squeezebox players');
+function cronSqueezeFavorites($cronmin)
+{
+    _logSection('Squeeze Favorites');
+    $favorites = getSqueezeFavorites();
+    if ($favorites !== false && count($favorites) > 0) {
+        connectRedis()->igbset('squeezebox_favorites', $favorites);
+    }
 }
 
-function cronWeather($cronmin) {
-       _logSection('Weather');
-       getWeather();
+function cronSqueezeCheckPlayers($cronmin)
+{
+    _logSection('Check squeezebox players');
 }
 
-function cronPodcasts($cronmin) {
-       checkSpottyLogin();
-       return;
-       _logSection('Podcasts');
-       $podcasts = getSqueezeFavorites(0, 'podcasts');
-       if ($podcasts !== false && count($podcasts) > 0) {
-               connectRedis()->igbset('squeezebox_podcasts', $podcasts);
-       }
+function cronWeather($cronmin)
+{
+    _logSection('Weather');
+    getWeather();
 }
 
-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) {
-                       file_get_contents('https://' . $device . '.home.tortuga.enhydra.fr/');
-               }
-       }
+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) {
+            file_get_contents('https://' . $device . '.home.tortuga.enhydra.fr/');
+        }
+    }
 }
 
-function cronHarmony($cronmin) {
-       _logSection('Harmony');
-       $currentActivity = getCurrentHarmonyActivity();
-       if ($currentActivity == HARMONY_MUSIQUE) {
-               setPlaying('squeezebox', 'bureau');
-       } else if ($currentActivity == HARMONY_OFF) {
-               setPlaying('mycanal', 'bureau');
-       }
+function cronHarmony($cronmin)
+{
+    _logSection('Harmony');
+    $currentActivity = getCurrentHarmonyActivity();
+    if ($currentActivity == HARMONY_MUSIQUE) {
+        setPlaying('squeezebox', 'bureau');
+    } else if ($currentActivity == HARMONY_OFF) {
+        setPlaying('mycanal', 'bureau');
+    }
 }
 
-function cronHeartbeat($cronmin, $devices = false) {
-       _logSection('Heartbeat');
-       setState('cron_heartbeat', time());
-       squeezeRequest(null);
-       hueCommand(null);
+function cronHeartbeat($cronmin, $devices = false)
+{
+    _logSection('Heartbeat');
+    setState('cron_heartbeat', time());
+    squeezeRequest(null);
+    hueCommand(null);
 
-       if (!$devices || $cronmin % 5 != 0) {
-               return;
-       }
-       restartDeadDevices();
+    if (!$devices || $cronmin % 5 != 0) {
+        return;
+    }
+    restartDeadDevices();
 }
\ No newline at end of file
index 246a80a065618750b01175230ba43e71cddb75e3..c00c648d834e0a61ce926f5efdc3d8e72b664b45 100644 (file)
@@ -261,7 +261,6 @@ function isMacAddress($mac)
 }
 
 
-
 function getSqueezeFavorites($root = 0, $app = 'favorites', $level = 0)
 {
     global $squeezeboxPlayers;
@@ -282,24 +281,12 @@ function getSqueezeFavorites($root = 0, $app = 'favorites', $level = 0)
 
 
     if (is_array($loop)) {
-        if ($app == 'podcasts' && $level != 0 && count(explode('.', $loop[0]['id'])) <= 2) {
-            return getSqueezeFavorites(0, $app, 0);
-        }
-
-        if ($level > 0 && $app == 'podcasts') {
-            $loop = array_slice($loop, 0, 50);
-        }
-
         foreach ($loop as $item) {
-
-            if ($app == 'podcasts' && isset($item['isaudio']) && $item['isaudio']) {
-                $item['hasitems'] = 0;
-            }
             if (isset($item['hasitems']) && $item['hasitems'] == 1 && (!isset($item['type']) || $item['type'] !== 'playlist')) {
                 $subitems = getSqueezeFavorites($item['id'], $app, $level + 1);
 
 
-                if ($app == 'favorites' || $app == 'podcasts') {
+                if ($app == 'favorites') {
                     while (isset($subitems[0]) && ((isset($item['name']) && isset($subitems[0]['name']) && $item['name'] == $subitems[0]['name']) || (isset($item['title']) && isset($subitems[0]['title']) && $item['title'] == $subitems[0]['title']))) {
                         return $subitems;
                     }