]> _ Git - tortuga-home.git/commitdiff
.
authorVincent <vincent@enhydra.fr>
Tue, 13 Apr 2021 19:10:47 +0000 (21:10 +0200)
committerVincent <vincent@enhydra.fr>
Tue, 13 Apr 2021 19:10:47 +0000 (21:10 +0200)
.idea/workspace.xml
config/global.php
config/salon.php
scripts/lib/denon.php
scripts/lib/kodi.php
scripts/lib/mediarasp.php
scripts/lib/off.php
scripts/lib/shield.php
scripts/lib/tmdb.php
servers/logcat.php

index c4326d5531696d6f21b52878d9b6ede4fff5f883..df3c981ce24f71e06cd5ca42ca23bac1c88a8e8e 100644 (file)
@@ -2,13 +2,16 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
-      <change afterPath="$PROJECT_DIR$/servers/cheminee.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/coffee.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/coffee.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/domoticz.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/domoticz.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/scenes.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/scenes.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/salon.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/salon.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/denon.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/denon.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/kodi.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/kodi.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/mediarasp.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/mediarasp.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/scripts/lib/off.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/off.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/lib/tmdb.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/tmdb.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/servers/logcat.php" beforeDir="false" afterPath="$PROJECT_DIR$/servers/logcat.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
       <workItem from="1617794856868" duration="1126000" />
       <workItem from="1617801536336" duration="4107000" />
       <workItem from="1618050897134" duration="4462000" />
-      <workItem from="1618158049208" duration="6569000" />
-    </task>
-    <task id="LOCAL-00415" summary=".">
-      <created>1606809331094</created>
-      <option name="number" value="00415" />
-      <option name="presentableId" value="LOCAL-00415" />
-      <option name="project" value="LOCAL" />
-      <updated>1606809331095</updated>
+      <workItem from="1618158049208" duration="17694000" />
     </task>
     <task id="LOCAL-00416" summary=".">
       <created>1606938157166</created>
       <option name="project" value="LOCAL" />
       <updated>1618054953035</updated>
     </task>
-    <option name="localTasksCounter" value="464" />
+    <task id="LOCAL-00464" summary=".">
+      <created>1618321419071</created>
+      <option name="number" value="00464" />
+      <option name="presentableId" value="LOCAL-00464" />
+      <option name="project" value="LOCAL" />
+      <updated>1618321419071</updated>
+    </task>
+    <option name="localTasksCounter" value="465" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
index 7f15aaa0c23e5e858c0bc7a8c1efe3f02dc02b41..efc0ae0b0258ea63479e1af42fb6945b2981e399 100644 (file)
@@ -43,7 +43,13 @@ $phones = [
         'ip' => '192.168.13.32',
         'key' => 'dmGYolpN-k4:APA91bEcMcfkZ0jZViEvyqyVWoT71-vQko9DE0wwg-vzPkZ5-lHwiVJDH38dXfIoWrHWTrtEiMsv-6TrebFR-dNOLhVoVUb3rCsehmLi-Ew17lkP75Yqds3KsWEiyF_yx-i-9dc_4ewV',
         'password' => '4pyA?Rnyeyc1$44M'
+    ],
+    'salon' => [
+        'ip' => '192.168.13.32',
+        'key' => 'dmGYolpN-k4:APA91bEcMcfkZ0jZViEvyqyVWoT71-vQko9DE0wwg-vzPkZ5-lHwiVJDH38dXfIoWrHWTrtEiMsv-6TrebFR-dNOLhVoVUb3rCsehmLi-Ew17lkP75Yqds3KsWEiyF_yx-i-9dc_4ewV',
+        'password' => '4pyA?Rnyeyc1$44M'
     ]
+    //dOQilKX5CVQ:APA91bGOo1g2Hk2p7A4qYNg0wuKjvDeU3quKi6r73ae6rxVqSXmztMIDRn00DOZmXP1q1fBS0hLEd7xZo_Rr3LQMrRIHJpgy0FxnH7G_OV3kxFmGqWu1yOg5tBUEPlEybH_JkjlEgGof
 ];
 
 $squeezeboxPlayersByRoom = [
index 8ef1cba9e8745c3e5bcdc4fdaeb6b62e6e1328b5..5a680a9f6996d62bcef0305a918d7e9e87c64d91 100644 (file)
@@ -8,6 +8,10 @@ config('VOLUME_DEVICE', 'DenonAVR');
 config('VIDEOPLAYER_DEVICE', 'salon');
 config('HIDEMASK_TIMEOUT', 250);
 config('THEME','#7a6854');
+config('SLEEPSCREEN', 15);
+config('SCREENSAVER_BRIGHTNESS', 100);
+config('SLEEPTYPE', 'screensaver');
+config('SCREENSAVER','weatherstationoroff');
 
 if (DISPLAYINTERFACE) {
     $c = salon();
index 5a16719975ce058e06130b4e6562819a9d65a171..1a0125562a0cf127489795f5ea84ae64db5ec48e 100644 (file)
@@ -28,9 +28,9 @@ function denonAVRVolume($volume, $increase = '')
     return $current . '->' . $volume;
 }
 
-function denonAVROn($input = 'Media Player')
+function denonAVROn($input = 'Media Player', $force = false)
 {
-    if (!denonAVRGetPowerState()) {
+    if ($force || !denonAVRGetPowerState()) {
         _denonTelnet('ZMON');
     }
     denonAVRInput($input);
@@ -48,19 +48,19 @@ function denonAVRInput($input)
     if (denonAVRGetInput() !== $cmd) {
         _denonTelnet($cmd);
         sleep(1);
+        $volumes = ['Media Player' => 60, 'HEOS Music' => 50, 'CD' => 30, 'AUX' => 26];
+        if (isset($volumes[$input])) {
+            denonAVRVolume($volumes[$input], '');
+            usleep(1000000 * 1);
+        }
     }
 
-    $audioMode = ['Media Player' => 'DOLBY DIGITAL', 'AUX' => 'DOLBY DIGITAL', 'CD' => 'DOLBY DIGITAL'];
-    if (isset($audioMode[$input])) {
-        denonAVRSetAudioMode($audioMode[$input]);
-        usleep(1000000 * 1);
-    }
+//    $audioMode = ['Media Player' => 'DOLBY DIGITAL', 'AUX' => 'DOLBY DIGITAL', 'CD' => 'DOLBY DIGITAL'];
+//    if (isset($audioMode[$input])) {
+//        denonAVRSetAudioMode($audioMode[$input]);
+//        usleep(1000000 * 1);
+//    }
 
-    $volumes = ['Media Player' => 60, 'HEOS Music' => 50, 'CD' => 30, 'AUX' => 26];
-    if (isset($volumes[$input])) {
-        denonAVRVolume($volumes[$input], '');
-        usleep(1000000 * 1);
-    }
 
     //denonAVRSetSpeakerPreset(1);
 }
@@ -145,7 +145,7 @@ function epson($on = true, $force = false)
     sshCommand('/usr/local/bin/ir Epson ' . $cmd, 'salon');
     setState('EpsonPowerState', $on ? '1' : '0');
     if ($currentState !== $on && $on) {
-        sleep(26);
+        sleep(30);
     }
 }
 
index 595e0d0b7fdffc232d74973abfc5d54e0ba8f19d..9dae7afdef507902dbbd87790854fdd4c14acf34 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+$kodiClients = [];
+$kodiIP = ['salon' => '192.168.13.40', 'bureau' => '192.168.13.41', 'avion' => '192.168.13.5', 'cuisine' => '192.168.13.32'];
+
 function getKodiDBConnection()
 {
     return mysqli_connect('localhost', "kodi", "atacama", "MyVideos119");
@@ -51,7 +54,31 @@ function kodiSyncPlayedStatus()
             $fileId = $files[$f];
             mysqli_query($con, 'UPDATE files SET playCount=1,lastPlayed=NOW() WHERE idFile=' . $fileId);
         }
+    }
+}
+
+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()) {
     }
+}
+
+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'`;
 }
\ No newline at end of file
index 62c62b953677bb7caf05262826f6f750a8e83019..aafdbe7d86de716f1d88f24966d693f27b37b9b3 100644 (file)
@@ -208,7 +208,7 @@ function remoteCmdMedia($cmd, $device = null, $playing = null)
             }
             if ($key == 'rewind' || $key == 'fast-rewind') {
                 $way = '-';
-            } else if ($key == 'forward' || $key = 'fast-forward') {
+            } else if ($key == 'forward' || $key == 'fast-forward') {
                 $way = '+';
             }
             $res = VLCCmd(['command' => 'seek', 'val' => $way . $amount . 's'], $device);
index 4791505503be25053ac0d228b3f5d8d7500fa68e..6fb734c925658f234ef111d5c86675b6f7d2245f 100644 (file)
@@ -32,6 +32,8 @@ function offSalon()
     denonAVROff();
     shieldKillAll('salon');
     shieldSleep('salon');
+    sleep(2);
+    epson(false, true);
 }
 
 function offBureau()
index 636d93fcf99096e44c939f92ad3d5807016da573..2e973e6a8dd3cd19e03e60a7688c97db87358442 100644 (file)
@@ -33,15 +33,15 @@ function shieldWakeup($device = null)
     //`curl 'http://192.168.13.60:9000/plugins/Extensions/settings/plugins/CastBridge/settings/basic.html?playerid=b8%3A27%3Aeb%3Af6%3A1d%3A30' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.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 'Content-Type: application/x-www-form-urlencoded' -H 'Origin: http://192.168.13.60:9000' -H 'Connection: keep-alive' -H 'Referer: http://192.168.13.60:9000/plugins/Extensions/settings/plugins/CastBridge/settings/basic.html' -H 'Cookie: Squeezebox-player=b8%3A27%3Aeb%3Af6%3A1d%3A30; Squeezebox-enableHiDPI=1; Squeezebox-expandPlayerControl=true; Squeezebox-expanded-MY_MUSIC=0; Squeezebox-expanded-RADIO=1; Squeezebox-expanded-PLUGIN_MY_APPS_MODULE_NAME=1; Squeezebox-expanded-FAVORITES=1; Squeezebox-expanded-PLUGINS=0; Squeezebox-playersettings=settings/player/basic.html%3F; Squeezebox-advancedsettings=plugins/CastBridge/settings/basic.html%3F; Squeezebox-expanded-activePlugins=1; Squeezebox-expanded-inactivePlugins=1; Squeezebox-expanded-otherPlugins0=1; securitytoken=1b5a6a8ddf493f1bf1f0787e0de41708' -H 'Upgrade-Insecure-Requests: 1' --data-raw 'saveSettings=1&useAJAX=0&page=PLUGIN_CASTBRIDGE&playerid=b8%3A27%3Aeb%3Af6%3A1d%3A30&player=b8%3A27%3Aeb%3Af6%3A1d%3A30&autorun=on&bin=squeeze2cast-armv6hf&opts=&debugs=&log_limit=-1&configfile=castbridge.xml&autosave=on&upnp_socket=%3F&xmlparams=1&prevseldevice=.common.&seldevice=.common.&codecs=aac%2Cogg%2Cops%2Cogf%2Cflc%2Calc%2Cwav%2Caif%2Cpcm%2Cmp3&sample_rate=96000&encode_mode=thru&encode_level=&encode_bitrate=&encode_rate=&encode_size=&server=%3F&enabled=1&remove_timeout=0&volume_on_play=1&media_volume=50&send_metadata=1&send_coverart=1&enabled.79a3f5f078d67e3b25a6b3dedc624e18=1&enabled.c4f32d227235313d8c59eff43a01350c=1'`;
 }
 
-function shieldRunActivity($device = null)
+function shieldRunActivity($device = null, $force = false)
 {
     $device = getDevice($device);
     $onlySound = in_array(shieldGetCurrentApp($device), ['spotify']);
 
     if ($device['id'] === 'salon') {
         stopPlayersIn('salon', true, false);
+        denonAVROn('Media Player', $force);
         epson(true);
-        denonAVROn();
         execScene('salon/cinema');
     } else if ($device['id'] === 'bureau' || $device['id'] === 'bureausun') {
         stopPlayersIn('bureau', true, false);
index 639c68af9c5c8e66dd26ec03637055e698f8d01b..894d9d81fc706f41fb773a5b9b6893608df71896 100644 (file)
@@ -103,6 +103,20 @@ function _getMovies($force = false, $forceapi = false)
     return $res;
 }
 
+function tmdbToTvdb($tmdbid)
+{
+    $cacheKey = 'tmdb_to_tvdb_' . $tmdbid;
+    $cached = getState($cacheKey, null);
+    if (null === $cached) {
+        $client = getTmbdClient();
+        $find = $client->getTvApi();
+        $data = $find->getExternalIds($tmdbid);
+        $cached = $data['tvdb_id'];
+        setState($cacheKey, $cached);
+    }
+    return $cached;
+}
+
 function mb_strcasecmp($str1, $str2, $encoding = null)
 {
     if (null === $encoding) {
@@ -161,8 +175,8 @@ class tvShowLibrary extends mediaLibrary
                 $edate = explode('-', $data['last_air_date']);
                 $mtime = gmmktime(12, 0, 0, $edate[1], $edate[2], $edate[0]);
 
-                if (file_exists($file.'.netflix')) {
-                    $dir = 'netflix:' . file_get_contents($file.'.netflix');
+                if (file_exists($file . '.netflix')) {
+                    $dir = 'netflix:' . file_get_contents($file . '.netflix');
                 } else {
                     $dir = file_exists($file) && is_file($file) ? file_get_contents($file) : $f->getPath();
                 }
index aa60bc97caf27d2d9b5cf16636068dd1fa004356..fca3814c2ccc0d76c1989596ebe3bc2db76fab0d 100644 (file)
@@ -13,7 +13,6 @@ $cases = [
     'Going to sleep due to power button' => function () use ($device) {
         echo 'sleep ' . $device . "\n";
         off($device);
-        execScene('salon/on');
     },
     'Waking up from sleep' => function () use ($device) {
         echo 'wakeup ' . $device . "\n";
@@ -25,7 +24,7 @@ $cases = [
             $squeezePlayer = 'Bureau';
         }
         if (getState($state, '0') < time() && getSqueezePlayerStatus($squeezePlayer) <= 0) {
-            shieldRunActivity($device);
+            shieldRunActivity($device,true);
         }
     },
     'WindowManager: handleComboKeys keyCode: 25, keyAction: 1' => function () use ($device) {