Skip to content

Commit

Permalink
Fix duration calculations for audio and video parts
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed May 6, 2015
1 parent 645a204 commit 85f7506
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions imp/lib/Mime/Viewer/Audio.php
Expand Up @@ -55,14 +55,14 @@ protected function _renderInfo()

$text = array();

if ($minutes = floor($duration / 60)) {
if ($minutes = floor($duration->value / 60)) {
$text[] = sprintf(
ngettext(_("%d minute"), _("%d minutes"), $minutes),
$minutes
);
}

if ($seconds = ($duration % 60)) {
if ($seconds = ($duration->value % 60)) {
$text[] = sprintf(
ngettext(_("%d second"), _("%d seconds"), $seconds),
$seconds
Expand Down
6 changes: 3 additions & 3 deletions imp/lib/Mime/Viewer/Video.php
Expand Up @@ -74,17 +74,17 @@ protected function _renderInfo()
'stream' => true
))->data);

if (!($duration = $headers['Content-Duration'])) {
if ($duration = $headers['Content-Duration']) {
$text = array();

if ($minutes = floor($duration / 60)) {
if ($minutes = floor($duration->value / 60)) {
$text[] = sprintf(
ngettext(_("%d minute"), _("%d minutes"), $minutes),
$minutes
);
}

if ($seconds = ($duration % 60)) {
if ($seconds = ($duration->value % 60)) {
$text[] = sprintf(
ngettext(_("%d second"), _("%d seconds"), $seconds),
$seconds
Expand Down

0 comments on commit 85f7506

Please sign in to comment.