Skip to content

Commit

Permalink
patch
Browse files Browse the repository at this point in the history
  • Loading branch information
lbr38 committed Dec 8, 2024
1 parent e50f982 commit 1f1afb3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
13 changes: 12 additions & 1 deletion www/controllers/Motion/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,20 @@ public function attachFile(string $motionEventId, string $file, int $width, int
* Create thumbnail if not already exist
*/
if (!file_exists($file . '.thumbnail')) {
$myprocess = new \Controllers\Process('/usr/bin/ffmpeg -loglevel error -ss 00:00:00.10 -i ' . $file . ' -vf \'scale=320:320:force_original_aspect_ratio=decrease\' -vframes 1 ' . $file . '.thumbnail.jpg');
$myprocess = new \Controllers\Process("/usr/bin/ffmpeg -i " . $file . " 2>&1 | grep 'Duration' | awk '{print $2}' | tr -d ,");
$myprocess->execute();
$output = $myprocess->getOutput();
$myprocess->close();

if (!empty($output)) {
$duration = $output;
list($hours, $minutes, $seconds) = explode(":", $duration);
$totalSeconds = ($hours * 3600) + ($minutes * 60) + $seconds;

$myprocess = new \Controllers\Process('/usr/bin/ffmpeg -loglevel error -ss ' . gmdate("H:i:s", $thumbnailTime) . '-i ' . $file . " -vf 'scale=320:320:force_original_aspect_ratio=decrease' -vframes 1 " . $file . '.thumbnail.jpg');
$myprocess->execute();
$myprocess->close();
}
}
}

Expand Down
5 changes: 3 additions & 2 deletions www/views/includes/containers/motionui/service/status.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
* Display a warning if motionUI service is not running
*/
if ($mymotionService->motionuiServiceRunning() !== true) : ?>
<div class="div-generic-blue">
<p class="center yellowtext"><img src="/assets/icons/warning.svg" class="icon" /><b>motionui</b> service is not running. Please restart the docker container.</p>
<div class="div-generic-blue flex column-gap-5 align-item-center">
<img src="/assets/icons/warning.svg" class="icon" />
<p class="yellowtext">motionui service is not running. Please restart the docker container.</p>
</div>
<?php
endif ?>
Expand Down

0 comments on commit 1f1afb3

Please sign in to comment.