</component>
<component name="ChangeListManager">
<list default="true" id="352ce63a-b52a-41a2-979b-becda7920939" name="Default" comment=".">
- <change beforePath="$PROJECT_DIR$/.docker/docker-compose.yml" beforeDir="false" afterPath="$PROJECT_DIR$/.docker/docker-compose.yml" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/.docker/update" beforeDir="false" afterPath="$PROJECT_DIR$/.docker/update" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/.idea/dataSources.local.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources.local.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/bin/restarthome" beforeDir="false" afterPath="$PROJECT_DIR$/bin/restarthome" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/config/global.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/global.php" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/scripts/import.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/import.php" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/scripts/lib/insteon.php" beforeDir="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/medialibrary.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/medialibrary.php" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/scripts/lib/profile.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/lib/profile.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$/scripts/tmdb.php" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/tmdb.php" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<workItem from="1715586628163" duration="670000" />
<workItem from="1716389152246" duration="475000" />
<workItem from="1718608940684" duration="1876000" />
- <workItem from="1718867770014" duration="2012000" />
+ <workItem from="1718867770014" duration="2055000" />
+ <workItem from="1718880511423" duration="3678000" />
+ <workItem from="1718889258103" duration="4286000" />
</task>
<task id="LOCAL-00502" summary=".">
<created>1641726946298</created>
<option name="project" value="LOCAL" />
<updated>1687259667913</updated>
</task>
- <option name="localTasksCounter" value="617" />
+ <option name="localTasksCounter" value="618" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<?php
+require_once __DIR__ . '/lib/profile.php';
+
session_set_cookie_params(3600 * 24 * 365, '/', '.enhydra.fr', true);
session_start();
+profile('init session', __FILE__, __LINE__);
+
require_once __DIR__ . '/environment.php';
+profile('Load environment', __FILE__, __LINE__);
require_once ROOT . "/vendor/autoload.php";
+profile('Load vendor dependencies', __FILE__, __LINE__);
require_once ROOT . "/scripts/lib/lib.php";
+profile('Load libraries', __FILE__, __LINE__);
if (defined('TIMELIMIT')) {
set_time_limit(TIMELIMIT);
if (file_exists($include)) {
require_once $include;
}
+profile('Load configuration', __FILE__, __LINE__);
if (isset($_GET['im'])) {
returnHttpResponse();
+++ /dev/null
-<?php
-
-$insteonBaseURL = 'http://192.168.13.83:25105';
-$insteonAuth = array('t1Kx8wuNWG', 'NA4Hq3v9cM');
-$insteonCommandTimeout = 15;
-$insteonHasKnocked = false;
-
-function insteonCommand($command)
-{
- $redis = connectRedis();
- $queue = $redis->igbget('insteon_queue');
- if (!is_array($queue)) {
- $queue = [];
- }
- $queue[] = $command;
- $redis->igbset('insteon_queue', $queue);
- $redis->publish('insteon_event', 'handle_queue');
-}
-
-function runInsteonCommand($command, $attempts = 10)
-{
- if ($attempts <= 0) {
- return;
- }
-
- insteonClearBuffer();
- echo "\n" . '-- Command ' . $command . ' attempt #' . $attempts . ' --' . "\n";
- echo "command : " . _insteonCommand($command) . "\n";
- for ($i = 1; $i <= 100; $i++) {
- usleep(1000000 * 0.05);
- $buff = insteonBuffer();
- echo $buff . "\n";
- if (stristr($buff, '0250') || stristr($buff, '0258')) {
- insteonClearBuffer();
- return;
- }
- }
- runInsteonCommand($command, $attempts - 1);
-}
-
-function _insteonCommand($command)
-{
- global $insteonHasKnocked;
- if (!$insteonHasKnocked) {
- insteonKnock();
- }
- return __insteonCommand($command);
-}
-
-function insteonKnock()
-{
- global $insteonHasKnocked;
- $insteonHasKnocked = true;
- __insteonCommand('1cjdW20oprxzHDZ.htm');
-}
-
-
-function __insteonCommand($command)
-{
- global $insteonBaseURL, $insteonAuth, $insteonCommandTimeout;
- return getUrlContent($insteonBaseURL . '/' . $command, $insteonCommandTimeout, $insteonAuth);
-}
-
-function insteonClearBuffer()
-{
- return _insteonCommand('1?XB=M=1');
-}
-
-function _insteonBufferEmpty()
-{
- return trim(insteonBuffer(), '0') === '';
-}
-
-function insteonBuffer()
-{
- global $insteonHasKnocked;
- $x = _insteonCommand('buffstatus.xml');
- if ($x !== false && is_object($x)) {
- $xml = simplexml_load_string($x);
- return (string)($xml->BS);
- } else {
- $insteonHasKnocked = false;
- insteonKnock();
- return '';
- }
-}
\ No newline at end of file
<?php
-$insteonQueue = [];
-$insteonLastCallTime = 0;
-$insteonProcessingQueue = false;
$harmonyClient = null;
$endQueue = [];
require_once ROOT . '/vendor/autoload.php';
-require_once ROOT . '/scripts/lib/profile.php';
require_once ROOT . "/config/global.php";
require_once ROOT . '/config/rooms.php';
require_once ROOT . '/scripts/lib/automodes.php';
echo $to . '/exists :' . file_exists($to) . '/size:' . filesize($to) . "\n\n";
}
- set_time_limit(0);
+ set_time_limit(120);
ignore_user_abort(true);
if (!getNightMode()) {
<?php
+register_shutdown_function('endProfile');
+$profileStart = $_SERVER['REQUEST_TIME_FLOAT'] ?? microtime(true);
-use Illuminate\Support\Str;
+$u = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/';
-require_once ROOT . '/vendor/autoload.php';
+$n = isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : '-';
+$n = str_replace('.php', '', $n);
+$n = str_replace('/home/tortugahome/www/', '', $n);
+$n = str_replace('/application/', '', $n);
+$n = str_replace('/', '-', $n);
+$n = trim($n, '/ -');
-//$u = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/';
-//
-//$n = isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : '-';
-//$n = str_replace('.php', '', $n);
-//$n = str_replace('/home/tortugahome/www/', '', $n);
-//$n = str_replace('/application/', '', $n);
-//$n = str_replace('/', '-', $n);
-//$n = trim($n, '/ ');
-//
-//$profileFp = fopen('/var/log/tortugahome/profiles/' . Str::slug($n) . '.log', 'a+b');
-//$profileStart = microtime(true);
-//fwrite($profileFp, "\r\n\r\n------------\r\n" . 'URL : ' . $u . "\r\nDate : " . date('Y-m-d H:i:s') . "\r\n" . print_r($_REQUEST, true) . "\r\n\r\n");
+$n = ($_SERVER['HTTP_HOST'] ?? '') . '-' . $n;
+
+$dir = '/var/log/tortugahome/profiles/';
+if (!file_exists($dir)) {
+ mkdir($dir, 077, true);
+}
+$f = $dir . slugify($n) . '.log';
+
+$profileFp = fopen($f, 'wb');
+
+fwrite($profileFp, "\r\n\r\n------------\r\n" . 'URL : ' . $u . "\r\nDate : " . date('Y-m-d H:i:s') . "\r\n" . print_r($_REQUEST, true) . "\r\n" . print_r($_SERVER, true) . "\r\n\r\n");
+profile('init profiling', __FILE__, __LINE__);
function profile($desc, $file = 'unset', $line = 'unset')
{
-// global $profileStart, $profileFp;
-// if (is_resource($profileFp)) {
-// $ms = round((microtime(true) - $profileStart) * 1000) . 'ms';
-// fwrite($profileFp, $ms . ';' . $desc . ';' . $file . ';' . $line . "\r\n");
-// }
+ $mt = microtime(true);
+ global $profileStart, $profileFp;
+ if (is_resource($profileFp)) {
+ $ms = (($mt - $profileStart) * 1000) . 'ms';
+ fwrite($profileFp, $ms . ';' . $mt . ';' . $desc . ';' . $file . ';' . $line . "\r\n");
+ }
+}
+
+function endProfile()
+{
+ global $profileFp;
+ profile('END profile', __FILE__, __LINE__);
+ fclose($profileFp);
+}
+
+function slugify($text, string $divider = '-')
+{
+ // replace non letter or digits by divider
+ $text = preg_replace('~[^\pL\d]+~u', $divider, $text);
+
+ // transliterate
+ $text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
+
+ // remove unwanted characters
+ $text = preg_replace('~[^-\w]+~', '', $text);
+
+ // trim
+ $text = trim($text, $divider);
+
+ // remove duplicate divider
+ $text = preg_replace('~-+~', $divider, $text);
+
+ // lowercase
+ $text = strtolower($text);
+
+ if (empty($text)) {
+ return 'n-a';
+ }
+
+ return $text;
}
\ No newline at end of file
{
global $videoExt;
- set_time_limit(0);
+ set_time_limit(10);
$e = explode(':', $tvShow['dir']);
if ($e[0] === 'netflix') {
<?php
ob_start();
require_once 'import.php';
-set_time_limit(0);
+set_time_limit(120);
kodiGetTVShowAllStatus(true);
kodiGetAllKodiToTmdb(true);
_getTVShows(true, false);