Merge pull request #3773 from ritzalam/fix-get-recordings-api

- display length of recording in minutes instead of milliseconds
This commit is contained in:
Richard Alam 2017-03-31 15:57:02 -04:00 committed by GitHub
commit 70a674bc79
4 changed files with 39 additions and 12 deletions

View File

@ -195,4 +195,13 @@ public class RecordingMetadata {
public Boolean hasError() {
return processingError;
}
public Integer calculateDuration() {
if ((endTime == null) || (endTime == "") || (startTime == null) || (startTime == "")) return 0;
int start = (int) Math.ceil((Long.parseLong(startTime)) / 60000.0);
int end = (int) Math.ceil((Long.parseLong(endTime)) / 60000.0);
return end - start;
}
}

View File

@ -47,6 +47,15 @@ public class RecordingMetadataPlayback {
return duration;
}
public Long calculateDuration() {
if (duration > 0) {
// convert to minutes
return duration / 60000;
} else {
return 0L;
}
}
public void setExtensions(Extensions extensions) {
this.extensions = extensions;
}

View File

@ -48,7 +48,11 @@
<type>${pb.getFormat()}</type>
<url>${pb.getLink()}</url>
<processingTime>${pb.getProcessingTime()?c}</processingTime>
<length>${pb.getDuration()?c}</length>
<#if pb.getDuration() == 0>
<length>${r.calculateDuration()?c}</length>
<#else>
<length>${pb.calculateDuration()?c}</length>
</#if>
<#if pb.getExtensions()??>
<#if pb.getExtensions().getPreview()??>

View File

@ -48,7 +48,12 @@
<type>${pb.getFormat()}</type>
<url>${pb.getLink()}</url>
<processingTime>${pb.getProcessingTime()?c}</processingTime>
<length>${pb.getDuration()?c}</length>
<#if pb.getDuration() == 0>
<length>${r.calculateDuration()?c}</length>
<#else>
<length>${pb.calculateDuration()?c}</length>
</#if>
<#if pb.getExtensions()??>
<#if pb.getExtensions().getPreview()??>
@ -59,14 +64,14 @@
<images>
<#items as image>
<#if image??>
<image width="${image.getWidth()}" height="${image.getHeight()}" alt="${image.getAlt()?html}">${image.getValue()!"Link not found."}</image>
<image width="${image.getWidth()}" height="${image.getHeight()}" alt="${image.getAlt()?html}">${image.getValue()!"Link not found."}</image>
</#if>
</#items>
</images>
</#list>
</#if>
</#items>
</images>
</#list>
</#if>
</preview>
</#if>
</#if>
</format>
</playback>
</preview>
</#if>
</#if>
</format>
</playback>