From: Vincent Date: Wed, 14 Apr 2021 19:02:30 +0000 (+0200) Subject: . X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=3409170647f79f05fca25cdfac36c38f3ce8a719;p=tortuga-home.git . --- diff --git a/.idea/workspace.xml b/.idea/workspace.xml index ef6be6d..72cb789 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,7 +3,8 @@ - + + diff --git a/scripts/lib/kodi.php b/scripts/lib/kodi.php index 9dae7af..c490f9e 100644 --- a/scripts/lib/kodi.php +++ b/scripts/lib/kodi.php @@ -59,17 +59,9 @@ function kodiSyncPlayedStatus() function tmdbToKodiId($tmdbId, $type = 'tvshow') { - - $con = getKodiDBConnection(); - - if ($type === 'tvshow') { - $tvdb = tmdbToTvdb($tmdbId); - } - - $result = mysqli_query($con, 'SELECT `media_id` FROM `uniqueid` WHERE `media_type` = "' . $type . '" AND `value`="' . $tvdb . '" ORDER BY `media_id` ASC '); - $files = []; - $playCounts = []; - while ($file = $result->fetch_assoc()) { + $result = mysqli_query(getKodiDBConnection(), 'SELECT `media_id` FROM `uniqueid` WHERE `value`="' . $tmdbId . '" AND `type`="tmdb"'); + while ($r = $result->fetch_assoc()) { + return $r['media_id']; } } @@ -77,8 +69,7 @@ function kodiOpenTVShow($device, $tmdbId, $season = 1, $episode = 1) { global $kodiIP; - $ip = $kodiIP[$device]; - $json = '{"jsonrpc":"2.0","id":"1","method":"GUI.ActivateWindow","params":["videos",["videodb://tvshows/titles/' . $kodiId . '/' . $season . '","return"]]}'; - `curl 'http://$ip:8754/jsonrpc' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Accept-Language: fr-FR,en;q=0.5' --compressed -H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1' -H 'Cache-Control: max-age=0, no-cache' -H 'Pragma: no-cache' --data-raw '$json'`; + $json = '{"jsonrpc":"2.0","id":"1","method":"GUI.ActivateWindow","params":["videos",["videodb://tvshows/titles/' . tmdbToKodiId($tmdbId) . '/' . $season . '","return"]]}'; + `curl 'http://$ip:8754/jsonrpc' --data-raw '$json'`; } \ No newline at end of file diff --git a/scripts/lib/scenes.php b/scripts/lib/scenes.php index 517bd58..b17bb42 100644 --- a/scripts/lib/scenes.php +++ b/scripts/lib/scenes.php @@ -70,10 +70,9 @@ $scenes = [ 'chambre/bed' => [ ['type' => 'scene', 'scene' => 'chambre/bed/base'], ['type' => 'scene', 'scene' => 'chambre/nightlights'], - ['type' => 'scene', 'scene' => 'chambre/cheminee/smallfire'], ['type' => 'scene', 'scene' => 'chambre/planetarium/on'], // Planétarium on ['type' => 'scene', 'scene' => 'sdb/nuit'], - ['type' => 'scene', 'scene' => 'chambre/cheminee'], + ['type' => 'scene', 'scene' => 'chambre/cheminee/smallfire'], ], 'chambre/bed/off' => [ ['type' => 'scene', 'scene' => 'chambre/bed/base'], @@ -250,16 +249,16 @@ $scenes = [ ], 'chambre/cheminee' => [ - ['type' => 'function', 'function' => 'chemineeOn', 'args' => ['chambre', 'fire', 1]], + ['type' => 'domoticz', 'scene' => 43, 'command' => true, 'priority' => true], ], 'chambre/cheminee/smallfire' => [ - ['type' => 'function', 'function' => 'chemineeOn', 'args' => ['chambre', 'fire', 0.02]], + ['type' => 'domoticz', 'scene' => 43, 'command' => true, 'priority' => true], ], 'chambre/cheminee/cold' => [ - ['type' => 'function', 'function' => 'chemineeOn', 'args' => ['chambre', 'cold', 1]], + ['type' => 'domoticz', 'scene' => 43, 'command' => true, 'priority' => true], ], 'chambre/cheminee/off' => [ - ['type' => 'function', 'function' => 'chemineeOff', 'args' => ['chambre']], + ['type' => 'domoticz', 'scene' => 43, 'command' => false, 'priority' => true], ], 'chambre/toggle' => [ ['type' => 'function', 'function' => 'chambreToggle'],