jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/392728 )

Change subject: Add audio files to response
......................................................................


Add audio files to response

Bug: T177430
Change-Id: I4a7b34f5aad0945ac35c6657b07281eebf6a27c3
---
M lib/media.js
M spec.yaml
2 files changed, 14 insertions(+), 7 deletions(-)

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



diff --git a/lib/media.js b/lib/media.js
index b0846f5..1644c10 100644
--- a/lib/media.js
+++ b/lib/media.js
@@ -8,10 +8,13 @@
 const SELECTORS = [
     'figure[typeof^=mw:Image]',
     'figure[typeof^=mw:Video]',
+    'figure[typeof^=mw:Audio]',
     'span[typeof^=mw:Image]',
     'span[typeof^=mw:Video]',
+    'span[typeof^=mw:Audio]',
     'figure-inline[typeof^=mw:Image]',
-    'figure-inline[typeof^=mw:Video]'
+    'figure-inline[typeof^=mw:Video]',
+    'figure-inline[typeof^=mw:Audio]'
 ];
 
 /**
@@ -28,6 +31,7 @@
 
 const Image = new MediaType('img', 'image');
 const Video = new MediaType('video', 'video');
+const Audio = new MediaType('video', 'audio');
 const Unknown = new MediaType(null, 'unknown');
 
 function getMediaType(typeofAttr) {
@@ -36,6 +40,8 @@
             return Image;
         case 'mw:Video':
             return Video;
+        case 'mw:Audio':
+            return Audio;
         default:
             return Unknown;
     }
@@ -113,8 +119,8 @@
     // Also reject SVG and PNG items by default, because they're likely to be
     // logos and/or presentational images.
     return item.url
-        && item.width >= MIN_IMAGE_SIZE
-        && item.height >= MIN_IMAGE_SIZE
+        && (item.type === Audio.name || item.width >= MIN_IMAGE_SIZE)
+        && (item.type === Audio.name || item.height >= MIN_IMAGE_SIZE)
         && !item.mime.includes('svg')
         && !item.mime.includes('png');
 }
diff --git a/spec.yaml b/spec.yaml
index f7bdc0f..500128f 100644
--- a/spec.yaml
+++ b/spec.yaml
@@ -565,7 +565,7 @@
     get:
       tags:
         - Media items on a given page
-      description: Gets the images and videos which appear on a given wiki page
+      description: Gets the media items (images, audio, and video) which 
appear on a given wiki page
       produces:
         - application/json
       responses:
@@ -578,7 +578,7 @@
           schema:
             $ref: '#/definitions/problem'
       x-amples:
-        - title: retrieve images and videos of en.wp Cat page via media route
+        - title: retrieve media items of en.wp Cat page via media route
           request:
             params:
               title: Cat
@@ -1257,12 +1257,13 @@
         enum:
           - image
           - video
+          - audio
       start_time:
         type: number
-        desription: start time (if any) for a video's usage on the page
+        desription: start time (if any) for the media item
       end_time:
         type: number
-        desription: end time (if any) for a video's usage on the page
+        desription: end time (if any) for the media item
       url:
         type: string
         description: the content URL for the original item

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I4a7b34f5aad0945ac35c6657b07281eebf6a27c3
Gerrit-PatchSet: 16
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: Mholloway <[email protected]>
Gerrit-Reviewer: BearND <[email protected]>
Gerrit-Reviewer: Fjalapeno <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Mholloway <[email protected]>
Gerrit-Reviewer: Mhurd <[email protected]>
Gerrit-Reviewer: Ppchelko <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to