From: Vincent Date: Fri, 31 Jan 2020 08:10:02 +0000 (+0100) Subject: . X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=5217f7c02a4675c74fc92fc74f57a6c0c0e88d62;p=tortuga-home.git . --- diff --git a/.idea/workspace.xml b/.idea/workspace.xml index a5bd3f8..3ebe478 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,7 +3,8 @@ - + + @@ -1188,12 +1189,12 @@ - + - + diff --git a/scripts/lib/medialibrary.php b/scripts/lib/medialibrary.php index 8c5963a..f96403d 100644 --- a/scripts/lib/medialibrary.php +++ b/scripts/lib/medialibrary.php @@ -134,7 +134,7 @@ function transcodeOneVideo() /** @var SplFileInfo $item */ $path = $item->getRealPath(); $to = preg_replace('/\.' . $item->getExtension() . '$/', '.x264.' . $item->getExtension(), $path); - if (file_exists($to)) { + if (file_exists($to) && videosHaveSameDuration($path, $to)) { continue; } @@ -151,6 +151,11 @@ function transcodeOneVideo() echo 'no file to transcode'; } +function videosHaveSameDuration($v1, $v2, $tolerance = 10) +{ + return abs(getVideoDuration($v1) - getVideoDuration($v2)) < $tolerance; +} + function nasToAvion($path) { $path = str_replace('/volume1/Share/', 'Z:/', $path); @@ -238,4 +243,15 @@ function getVideoCodec($path) setState($cacheKey, $res); } return $res; +} + +function getVideoDuration($path) +{ + $cacheKey = 'duration_4_' . md5($path . '-' . filemtime($path)); + $res = getState($cacheKey, null); + if (null === $res) { + $res = `ffprobe -i "$path" -show_entries format=duration -v quiet -of csv="p=0"`; + setState($cacheKey, $res); + } + return $res; } \ No newline at end of file diff --git a/scripts/lib/scenes.php b/scripts/lib/scenes.php index 217c3a9..8026bf4 100644 --- a/scripts/lib/scenes.php +++ b/scripts/lib/scenes.php @@ -301,9 +301,6 @@ $scenes = [ ['type' => 'ecomode', 'mode' => '0'], ['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' => 'ecomode', 'mode' => '0'],