jenkins-bot has submitted this change and it was merged.

Change subject: Add duration field in query=imageinfo&iiprop=dimensions
......................................................................


Add duration field in query=imageinfo&iiprop=dimensions

If the file has a duration (e.g. an audio or video file), include
it in the list of dimensions returned. Do not include anything
for still media (normal pictures).

This affects both query=imageinfo and TMH's query=videoinfo.

Bug: 55941
Change-Id: If172a1cbaca08bff2eb709f6c829985b28b0200d
---
M includes/api/ApiQueryImageInfo.php
1 file changed, 9 insertions(+), 2 deletions(-)

Approvals:
  Anomie: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/api/ApiQueryImageInfo.php 
b/includes/api/ApiQueryImageInfo.php
index 5cc1454..6178a51 100644
--- a/includes/api/ApiQueryImageInfo.php
+++ b/includes/api/ApiQueryImageInfo.php
@@ -391,6 +391,13 @@
                        if ( $pageCount !== false ) {
                                $vals['pagecount'] = $pageCount;
                        }
+
+                       // length as in how many seconds long a video is.
+                       $length = $file->getLength();
+                       if ( $length ) {
+                               // Call it duration, because "length" can be 
ambiguous.
+                               $vals['duration'] = (float)$length;
+                       }
                }
 
                $pcomment = isset( $prop['parsedcomment'] );
@@ -666,8 +673,8 @@
                        'parsedcomment' =>  ' parsedcomment - Parse the comment 
on the version',
                        'canonicaltitle' => ' canonicaltitle - Adds the 
canonical title of the image file',
                        'url' =>            ' url           - Gives URL to the 
image and the description page',
-                       'size' =>           ' size          - Adds the size of 
the image in bytes ' .
-                               'and the height, width and page count (if 
applicable)',
+                       'size' =>           ' size          - Adds the size of 
the image in bytes, ' .
+                               'its height and its width. Page count and 
duration are added if applicable',
                        'dimensions' =>     ' dimensions    - Alias for size', 
// B/C with Allimages
                        'sha1' =>           ' sha1          - Adds SHA-1 hash 
for the image',
                        'mime' =>           ' mime          - Adds MIME type of 
the image',

-- 
To view, visit https://gerrit.wikimedia.org/r/157586
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If172a1cbaca08bff2eb709f6c829985b28b0200d
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Brian Wolff <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
Gerrit-Reviewer: Umherirrender <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to