]> _ Git - tortuga-home.git/commitdiff
.
authorVincent <vincent@enhydra.fr>
Wed, 21 Aug 2019 09:29:27 +0000 (11:29 +0200)
committerVincent <vincent@enhydra.fr>
Wed, 21 Aug 2019 09:29:27 +0000 (11:29 +0200)
.idea/workspace.xml
config/global.php
images/backgrounds/chambre.jpg
scripts/cron/cron.php
scripts/lib/http.php
scripts/lib/squeezebox.php
scripts/spotifychecklogin.php [new file with mode: 0644]

index c81fe9857eb8e3044f312ed8540621d07c9d8cf9..d53870792aa6e874f7f9a5214df6308329da9940 100644 (file)
@@ -2,10 +2,13 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
+      <change afterPath="$PROJECT_DIR$/scripts/spotifychecklogin.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/config/chambre.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/chambre.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/config/global.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/global.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/config/lit.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/lit.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/images/backgrounds/chambre.jpg" beforeDir="false" afterPath="$PROJECT_DIR$/images/backgrounds/chambre.jpg" 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/http.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/http.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="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
     <option name="SHOW_DIALOG" value="false" />
       <workItem from="1565943575929" duration="1201000" />
       <workItem from="1565950373585" duration="604000" />
       <workItem from="1565953321589" duration="670000" />
-      <workItem from="1566068841787" duration="3255000" />
-    </task>
-    <task id="LOCAL-00155" summary=".">
-      <created>1550734585159</created>
-      <option name="number" value="00155" />
-      <option name="presentableId" value="LOCAL-00155" />
-      <option name="project" value="LOCAL" />
-      <updated>1550734585159</updated>
+      <workItem from="1566068841787" duration="3859000" />
+      <workItem from="1566131336031" duration="140000" />
+      <workItem from="1566150382844" duration="1598000" />
+      <workItem from="1566371220982" duration="598000" />
+      <workItem from="1566376145799" duration="2929000" />
     </task>
     <task id="LOCAL-00156" summary=".">
       <created>1550738402508</created>
       <option name="project" value="LOCAL" />
       <updated>1565944175034</updated>
     </task>
-    <option name="localTasksCounter" value="204" />
+    <task id="LOCAL-00204" summary=".">
+      <created>1566128716085</created>
+      <option name="number" value="00204" />
+      <option name="presentableId" value="LOCAL-00204" />
+      <option name="project" value="LOCAL" />
+      <updated>1566128716085</updated>
+    </task>
+    <option name="localTasksCounter" value="205" />
     <servers />
   </component>
   <component name="TodoView">
index 160a0d1bef95ec0d0566d5e630beed86d034a62b..a287c7383bb962449377d74859bc7f9ef4e8cca1 100644 (file)
@@ -2,48 +2,52 @@
 ini_set('display_errors', true);
 
 define('WEB_ROOT', 'https://home.tortuga.enhydra.fr/');
+
 define("SQUEEZEBOX_SERVER", 'http://192.168.13.68:9000');
+define("SQUEEZEBOX_SPOTIFY_USERNAME", '70@enhydra.fr');
+define("SQUEEZEBOX_SPOTIFY_PASSWORD", '?Z8}#HK+SZrQ');
+
 define('HUE_BRIDGE', '192.168.13.85');
 define('HUE_USER', 'zZigF7nPQq9nTZ3GTB1zkntn98trOJVFHWAwFiqQ');
 
 $squeezeboxPlayers = array(
-       'Salle de bains' => 'b8:27:eb:ab:b4:50',
-       'Salon' => 'dc:a6:32:02:47:c1',
-       'Chambre' => 'b8:27:eb:73:33:89',
-       'WC' => '00:04:20:2a:05:2e',
-       'Cuisine' => 'b8:27:eb:ec:71:34',
-       'Lit Jérôme' => 'b8:27:eb:62:d3:ce',
-       'Lit Vincent' => 'b8:27:eb:40:0e:e9',
-       'Bureau' => 'b8:27:eb:f6:1d:30',
+    'Salle de bains' => 'b8:27:eb:ab:b4:50',
+    'Salon' => 'dc:a6:32:02:47:c1',
+    'Chambre' => 'b8:27:eb:73:33:89',
+    'WC' => '00:04:20:2a:05:2e',
+    'Cuisine' => 'b8:27:eb:ec:71:34',
+    'Lit Jérôme' => 'b8:27:eb:62:d3:ce',
+    'Lit Vincent' => 'b8:27:eb:40:0e:e9',
+    'Bureau' => 'b8:27:eb:f6:1d:30',
 );
 
 $phones = array('vincent' => array(
-       'ip' => '192.168.13.31',
-       'key' => 'APA91bHeWfPc86eVpVzYDfQHdolELsdHdlNou2a2YoMWhBuAG9odAlfZLBjve9zDBq4U04e_zd2tA864El8Z2NfUh7XJktOHbU4F1mdmAVczklg5ZFRClvhX4f8fqfZ9YLG94NdBQbGn',
-       'password' => '4pyA?Rnyeyc1$44M')
+    'ip' => '192.168.13.31',
+    'key' => 'APA91bHeWfPc86eVpVzYDfQHdolELsdHdlNou2a2YoMWhBuAG9odAlfZLBjve9zDBq4U04e_zd2tA864El8Z2NfUh7XJktOHbU4F1mdmAVczklg5ZFRClvhX4f8fqfZ9YLG94NdBQbGn',
+    'password' => '4pyA?Rnyeyc1$44M')
 );
 
 $devices = [
     'cerveau' => ['host' => '192.168.13.60', 'user' => 'pi', 'password' => 'atacama'],
-       'litvincent' => ['host' => '192.168.13.61', 'user' => 'pi', 'password' => 'atacama'],
-       'litjerome' => ['host' => '192.168.13.62', 'user' => 'pi', 'password' => 'atacama'],
-       'sdb' => ['host' => '192.168.13.63', 'user' => 'pi', 'password' => 'atacama'],
-       'entree' => ['host' => '192.168.13.64', 'user' => 'pi', 'password' => 'atacama'],
-       'jarvis' => ['host' => '192.168.13.60', 'user' => 'jarvis', 'password' => 'atacama'],
-       'minitel1' => ['host' => '192.168.13.65', 'user' => 'pi', 'password' => 'atacama'],
-       'salon' => ['host' => '192.168.13.66', 'user' => 'pi', 'password' => 'atacama'],
-       'bureau' => ['host' => '192.168.13.67', 'user' => 'pi', 'password' => 'atacama'],
-       'cuisine' => ['host' => '192.168.13.68', 'user' => 'pi', 'password' => 'atacama'],
-       'bureausun' => ['host' => '192.168.13.70', 'user' => 'pi', 'password' => 'atacama'],
-       'avion' => ['host' => '192.168.13.5', 'user' => 'Tortuga', 'password' => 's77vpo*wu', 'mac' => 'E0:D5:5E:68:67:B9'],
+    'litvincent' => ['host' => '192.168.13.61', 'user' => 'pi', 'password' => 'atacama'],
+    'litjerome' => ['host' => '192.168.13.62', 'user' => 'pi', 'password' => 'atacama'],
+    'sdb' => ['host' => '192.168.13.63', 'user' => 'pi', 'password' => 'atacama'],
+    'entree' => ['host' => '192.168.13.64', 'user' => 'pi', 'password' => 'atacama'],
+    'jarvis' => ['host' => '192.168.13.60', 'user' => 'jarvis', 'password' => 'atacama'],
+    'minitel1' => ['host' => '192.168.13.65', 'user' => 'pi', 'password' => 'atacama'],
+    'salon' => ['host' => '192.168.13.66', 'user' => 'pi', 'password' => 'atacama'],
+    'bureau' => ['host' => '192.168.13.67', 'user' => 'pi', 'password' => 'atacama'],
+    'cuisine' => ['host' => '192.168.13.68', 'user' => 'pi', 'password' => 'atacama'],
+    'bureausun' => ['host' => '192.168.13.70', 'user' => 'pi', 'password' => 'atacama'],
+    'avion' => ['host' => '192.168.13.5', 'user' => 'Tortuga', 'password' => 's77vpo*wu', 'mac' => 'E0:D5:5E:68:67:B9'],
 ];
 
 // Browse media files on NAS
 $directories = array('Séries TV' => array('dir' => 'Series', 'context' => 'tvshow', 'id' => 'tvshows'),
-       'Films' => array('dir' => 'Films', 'context' => 'movie', 'id' => 'movies'),
-       'Spectacles' => array('dir' => 'Spectacles', 'context' => 'movie', 'id' => 'shows'),
-       'Docus' => array('dir' => 'Documentaires', 'context' => 'movie', 'id' => 'documentaries'),
-       'X' => array('dir' => 'Z/X', 'context' => 'movie', 'id' => 'x')
+    'Films' => array('dir' => 'Films', 'context' => 'movie', 'id' => 'movies'),
+    'Spectacles' => array('dir' => 'Spectacles', 'context' => 'movie', 'id' => 'shows'),
+    'Docus' => array('dir' => 'Documentaires', 'context' => 'movie', 'id' => 'documentaries'),
+    'X' => array('dir' => 'Z/X', 'context' => 'movie', 'id' => 'x')
 );
 
 $videoExt = ['mkv', 'mp4', 'avi', 'ogv', 'ts', 'm2ts', 'mpg', 'm4v', 'flv', 'f4v', 'mov', 'mpg', 'mpeg'];
index b937808a939f7939538cc30380581ce3a875b8ad..8cabff2b754258dbac82c5eb94c0fbf8b1552ace 100644 (file)
Binary files a/images/backgrounds/chambre.jpg and b/images/backgrounds/chambre.jpg differ
index 195a108737b4d784d77c165ac763984ee30b6129..21b93d463f13192a30c9a1b5925f91516ff3d325 100644 (file)
@@ -256,6 +256,7 @@ function cronTraffic($cronmin, $force = false)
 
 function cronPodcasts($cronmin)
 {
+    checkSpottyLogin();
     $podcasts = getSqueezeFavorites(0, 'podcasts');
     if ($podcasts !== false && count($podcasts) > 0) {
         connectRedis()->igbset('squeezebox_podcasts', $podcasts);
index 0888e96205d4f72f54bb7aa0c5f0ce7a28502309..adec6f4abfaf8f4b13810761cb01f0fb732d4898 100644 (file)
@@ -36,11 +36,11 @@ function getHttpClient($newclient = false)
  * @return mixed|\Psr\Http\Message\ResponseInterface
  * @throws \GuzzleHttp\Exception\GuzzleException
  */
-function httpRequest($url, $method = 'get', $data = [], $auth = null, $timeout = 10)
+function httpRequest($url, $method = 'get', $data = [], $auth = null, $timeout = 10, $allowRedirections = true)
 {
     $method = mb_strtoupper($method);
     $client = getHttpClient();
-    $options = ['timeout' => $timeout, 'read_timeout' => $timeout];
+    $options = ['timeout' => $timeout, 'read_timeout' => $timeout, 'allow_redirects' => $allowRedirections];
     if (null !== $auth) {
         $options['auth'] = $auth;
     }
index f70621796d83542b41df6cc8ef41b9fed3cc99fc..e5e31f12a9ca8e35ffa6f45102d515d4f2230e09 100644 (file)
@@ -194,4 +194,30 @@ function getSqueezeFavorites($root = 0, $app = 'favorites', $level = 0)
 
 
     return $res;
+}
+
+function checkSpottyLogin()
+{
+    $hascredentials = httpRequest(SQUEEZEBOX_SERVER . '/plugins/Spotty/settings/basic.html?_dc=' . time(), 'get', [], null, 10, false);
+
+    if ($hascredentials->getStatusCode() == 302) {
+        global $squeezeboxPlayers;
+        echo 'Not logged in !<br>';
+        $player = $squeezeboxPlayers['Cuisine'];
+
+        $res = httpRequest(SQUEEZEBOX_SERVER . '/plugins/Spotty/settings/authentication.html', 'post', [
+            "saveSettings" => "1",
+            'useAJAX' => '0',
+            'page' => 'PLUGIN_SPOTTY',
+            'playerid' => $player,
+            'player' => $player,
+            'username' => SQUEEZEBOX_SPOTIFY_USERNAME,
+            'password' => SQUEEZEBOX_SPOTIFY_PASSWORD,
+            'accountId' => '']);
+        print_r($res->getBody());
+    } else {
+        echo 'Logged in :)';
+        print_r($hascredentials);
+        print_r($hascredentials->getBody());
+    }
 }
\ No newline at end of file
diff --git a/scripts/spotifychecklogin.php b/scripts/spotifychecklogin.php
new file mode 100644 (file)
index 0000000..414af98
--- /dev/null
@@ -0,0 +1,3 @@
+<?php
+require_once "import.php";
+checkSpottyLogin();
\ No newline at end of file