diff --git a/lib/Alchemy/Phrasea/Core/Provider/TwigServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/TwigServiceProvider.php index 6fa067a84c..6b9ceae618 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/TwigServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/TwigServiceProvider.php @@ -143,6 +143,25 @@ class TwigServiceProvider implements ServiceProviderInterface $twig->addFilter(new \Twig_SimpleFilter('escapeDoubleQuote', function ($value) { return str_replace('"', '\"', $value); })); + + $twig->addFilter(new \Twig_SimpleFilter('formatDuration', + function ($secondsInDecimals) { + $time = []; + $hours = floor($secondsInDecimals / 3600); + $secondsInDecimals -= $hours * 3600; + $minutes = floor($secondsInDecimals / 60); + $secondsInDecimals -= $minutes * 60; + $seconds = intVal($secondsInDecimals % 60, 10); + if ($hours > 0) { + array_push($time, (strlen($hours) < 2) ? "0{$hours}" : $hours); + } + array_push($time, (strlen($minutes) < 2) ? "0{$minutes}" : $minutes); + array_push($time, (strlen($seconds) < 2) ? "0{$seconds}" : $seconds); + $formattedTime = implode(':', $time); + + return $formattedTime; + } + )); } /** diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/ElasticsearchRecordHydrator.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/ElasticsearchRecordHydrator.php index 3c6003b6fe..5a49303b9f 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/ElasticsearchRecordHydrator.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/ElasticsearchRecordHydrator.php @@ -62,7 +62,7 @@ class ElasticsearchRecordHydrator $record->setTitles((array) igorw\get_in($data, ['title'], [])); $record->setCaption((array) igorw\get_in($data, ['caption'], [])); $record->setPrivateCaption((array) igorw\get_in($data, ['private_caption'], [])); - $record->setExif((array) igorw\get_in($data, ['exif'], [])); + $record->setExif((array)igorw\get_in($data, ['metadata_tags'], [])); $record->setSubdefs((array) igorw\get_in($data, ['subdefs'], [])); $record->setFlags((array) igorw\get_in($data, ['flags'], [])); $record->setHighlight((array) $highlight); diff --git a/templates/web/common/technical_datas.html.twig b/templates/web/common/technical_datas.html.twig index b9c8156cbe..905c597099 100644 --- a/templates/web/common/technical_datas.html.twig +++ b/templates/web/common/technical_datas.html.twig @@ -126,7 +126,7 @@ {% block td_duration %} {% if record.exif[constant('media_subdef::TC_DATA_DURATION')] is defined %}