From: Vincent Date: Wed, 21 Aug 2019 09:29:27 +0000 (+0200) Subject: . X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=967fdd20840acd8fbd63e6434162c9b281129a23;p=tortuga-home.git . --- diff --git a/.idea/workspace.xml b/.idea/workspace.xml index c81fe98..d538707 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,10 +2,13 @@ + - - + + + + diff --git a/config/global.php b/config/global.php index 160a0d1..a287c73 100644 --- a/config/global.php +++ b/config/global.php @@ -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']; diff --git a/images/backgrounds/chambre.jpg b/images/backgrounds/chambre.jpg index b937808..8cabff2 100644 Binary files a/images/backgrounds/chambre.jpg and b/images/backgrounds/chambre.jpg differ diff --git a/scripts/cron/cron.php b/scripts/cron/cron.php index 195a108..21b93d4 100644 --- a/scripts/cron/cron.php +++ b/scripts/cron/cron.php @@ -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); diff --git a/scripts/lib/http.php b/scripts/lib/http.php index 0888e96..adec6f4 100644 --- a/scripts/lib/http.php +++ b/scripts/lib/http.php @@ -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; } diff --git a/scripts/lib/squeezebox.php b/scripts/lib/squeezebox.php index f706217..e5e31f1 100644 --- a/scripts/lib/squeezebox.php +++ b/scripts/lib/squeezebox.php @@ -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 !
'; + $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 index 0000000..414af98 --- /dev/null +++ b/scripts/spotifychecklogin.php @@ -0,0 +1,3 @@ +