From 30416cd8b401106110cc4c8ef2c35436874c673e Mon Sep 17 00:00:00 2001 From: Vincent Date: Tue, 28 Jan 2020 11:01:49 +0100 Subject: [PATCH] . --- .idea/workspace.xml | 36 +++++++++++++++++----------------- config/rooms.php | 2 +- gradient.php | 1 + scripts/gradient.php | 10 +++++++--- scripts/lib/scenes.php | 21 ++++++++++---------- scripts/youtubedl-download.php | 5 +++-- 6 files changed, 41 insertions(+), 34 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index ea91c5a..cda8924 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,12 +3,11 @@ - - + + + - - - + @@ -1205,17 +1205,17 @@ - + - - + + - + diff --git a/config/rooms.php b/config/rooms.php index c41b9f4..7f5c6cc 100644 --- a/config/rooms.php +++ b/config/rooms.php @@ -83,7 +83,7 @@ function bureau() $all = array_merge($favorites, [ ['type' => 'light', 'scene' => 'bureau/boreal', 'label' => 'Aurore boréale'], - ['type' => 'light', 'scene' => 'bureau/savane', 'label' => 'Savane'], + ['type' => 'light', 'scene' => 'bureau/tchernobyl', 'label' => 'Чорнобиль'], ['type' => 'light', 'scene' => 'bureau/tonic', 'label' => 'Tonique'], ['type' => 'light', 'scene' => 'bureau/flowers', 'label' => 'Printemps floral'], ['type' => 'light', 'scene' => 'bureau/tropical', 'label' => 'Crépuscule tropical'], diff --git a/gradient.php b/gradient.php index 1aa1748..8945dc6 100644 --- a/gradient.php +++ b/gradient.php @@ -41,6 +41,7 @@ css.backgroundImage = 'none'; //videoURL = data.data.video_path; videoURL = data.data.video_path.replace('/nas/', 'file:///Z:/'); + videoURL = videoURL.replace('file:///Z:/Videos/YoutubeDL', 'file:///C:/YoutubeDL'); startVideo = 1; if (data.data.start) { startVideo = data.data.start; diff --git a/scripts/gradient.php b/scripts/gradient.php index a173633..dbdaab6 100644 --- a/scripts/gradient.php +++ b/scripts/gradient.php @@ -18,6 +18,10 @@ switch ($c) { $type = 'image'; $res = ['image' => '/images/ambiance/savane.jpg', 'position' => '50% 0%']; break; + case 'tchernobyl': + $type = 'youtube'; + $res = ['videoid' => '9ulX-VkvaBQ', 'start' => 1]; + break; case 'boreal': // $type = 'image'; // $res = ['image' => '/images/ambiance/borealis.jpg', 'position' => '50% 100%']; @@ -38,8 +42,8 @@ switch ($c) { break; case 'focus': case 'tonic': - $type = 'gradient'; - $res = ['#dffffc', '#53ffee']; + $type = 'youtube'; + $res = ['videoid' => 'gosjiD288Jk', 'start' => 5]; break; case 'lecture': case 'chillout': @@ -81,7 +85,7 @@ if ($type == 'gradient' && (!is_array($res) || !count($res))) { $res = ['#ffffff', '#ffffff']; } if ($type == 'youtube') { - $res['video_path'] = downloadYoutubeDL('https://www.youtube.com/watch?v=' . $res['videoid'],0, false, 'webm'); + $res['video_path'] = downloadYoutubeDL('https://www.youtube.com/watch?v=' . $res['videoid'], 0, false, 'webm'); } header('Content-type: application/json'); $r = ['type' => $type, 'data' => $res]; diff --git a/scripts/lib/scenes.php b/scripts/lib/scenes.php index 0eb5ec3..217c3a9 100644 --- a/scripts/lib/scenes.php +++ b/scripts/lib/scenes.php @@ -193,11 +193,14 @@ $scenes = [ ['type' => 'scene', 'scene' => 'chambre/cheminee'], ], 'chambre/off' => [ + ['type' => 'scene', 'scene' => 'chambre/off/exceptcheminee'], + ['type' => 'scene', 'scene' => 'chambre/cheminee/off'], + ], + 'chambre/off/exceptcheminee' => [ ['type' => 'function', 'function' => 'chambreAuto', 'args' => [false]], ['type' => 'state', 'key' => 'chambre', 'value' => 0], ['type' => 'hue', 'group' => $chambre, 'scene' => array('on' => false, 'brightness' => 0)], ['type' => 'insteon', 'command' => '0?1332=I=0=0'], - ['type' => 'scene', 'scene' => 'chambre/cheminee/off'], ], 'chambre/bedoff' => [ ['type' => 'nightmode', 'mode' => '1'], @@ -286,31 +289,29 @@ $scenes = [ ], 'salon/on' => [ ['type' => 'hue', 'group' => $salon, 'scene' => 'Gte8sl76rzAD1wO'], - ['type' => 'domoticz', 'scene' => '3', 'command' => true], ['type' => 'insteon', 'command' => '0?113=I=0=0'], ['type' => 'scene', 'scene' => 'salon/cheminee', 'delay' => 1], ], 'salon/off' => [ ['type' => 'hue', 'group' => $salon, 'scene' => array('on' => false, 'brightness' => 0)], - ['type' => 'domoticz', 'scene' => '3', 'command' => false], ['type' => 'insteon', 'command' => '0?133=I=0=0'], ['type' => 'function', 'function' => 'chemineeOff', 'args' => ['salon']], ], 'salon/cinema' => [ ['type' => 'ecomode', 'mode' => '0'], - ['type' => 'domoticz', 'scene' => '4', 'command' => true], - ['type' => 'hue', 'group' => $salon, 'scene' => 'AsU9eOyGsjEyz35'], ['type' => 'insteon', 'command' => '0?1111=I=0=0'], + ['type' => 'hue', 'group' => $salon, 'scene' => 'AsU9eOyGsjEyz35'], + ['type' => 'hue', 'group' => $bureau, 'scene' => 'Ntv7DDEMGtuYA9L'], + ['type' => 'scene', 'scene' => 'chambre/off/exceptcheminee'], + ], 'salon/tamise' => [ - ['type' => 'domoticz', 'scene' => '4', 'command' => true], ['type' => 'ecomode', 'mode' => '0'], ['type' => 'hue', 'group' => $salon, 'scene' => 'RbjnIcLtcDuHbfU'], ['type' => 'insteon', 'command' => '0?1130=I=0=0'], ['type' => 'function', 'function' => 'chemineeOn', 'args' => ['salon', 'fire', 0.8]], ], 'salon/lecturenocture' => [ - ['type' => 'domoticz', 'scene' => '4', 'command' => true], ['type' => 'hue', 'group' => $salon, 'scene' => 'HZiYyM6hMUMkmiY'], ['type' => 'insteon', 'command' => '0?1113=I=0=0'], ['type' => 'function', 'function' => 'chemineeOn', 'args' => ['salon', 'fire', 0.25]], @@ -353,9 +354,9 @@ $scenes = [ ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'flowers'], ['type' => 'scene', 'scene' => 'bureau/base/on'], ], - 'bureau/savane' => [ + 'bureau/tchernobyl' => [ ['type' => 'hue', 'group' => $bureau, 'scene' => 'KoByn2ehWHDdchu'], - ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'savane'], + ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'tchernobyl'], ['type' => 'scene', 'scene' => 'bureau/base/on'], ], 'bureau/boreal' => [ @@ -380,7 +381,7 @@ $scenes = [ ], 'bureau/tonic' => [ ['type' => 'hue', 'group' => $bureau, 'scene' => 'S-YiVWKsEKipL0G'], - ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'space'], + ['type' => 'state', 'key' => 'bureau_gradient', 'value' => 'tonic'], ['type' => 'scene', 'scene' => 'bureau/base/on'], ], 'bureau/lecture' => [ diff --git a/scripts/youtubedl-download.php b/scripts/youtubedl-download.php index d111ec8..ec0703d 100644 --- a/scripts/youtubedl-download.php +++ b/scripts/youtubedl-download.php @@ -10,7 +10,8 @@ $h = isset($_GET["h"]) ? $_GET['h'] : 0; $dest = getYoutubeDLPath($url, $h, $ext); $wip = $dest . '.wip'; -if (!file_exists($dest) && !file_exists($wip)) { +$ps = `ps aux`; +if (!file_exists($dest) && !file_exists($wip) && !stristr($ps, $dest)) { file_put_contents($wip, ''); $height = ''; @@ -19,7 +20,7 @@ if (!file_exists($dest) && !file_exists($wip)) { } $format = 'bestvideo' . $height . '+bestaudio/best' . $height; - $cmd = "/usr/local/bin/youtube-dl -f '$format' -o $dest --merge-output-format mkv '$url'"; + $cmd = "/usr/local/bin/youtube-dl -f '$format' -o $dest --merge-output-format $ext '$url'"; `$cmd`; unlink($wip); } \ No newline at end of file -- 2.39.5