ard.lua: Cleanup Ard.iter_formats
authorToni Gundogdu <legatvs@gmail.com>
Fri, 8 Feb 2013 16:16:13 +0000 (8 18:16 +0200)
committerToni Gundogdu <legatvs@gmail.com>
Fri, 8 Feb 2013 16:23:20 +0000 (8 18:23 +0200)
Realign, remove webX extraction which is now done in Ard.quality_from,
make the for loop more compact.

Signed-off-by: Toni Gundogdu <legatvs@gmail.com>
share/lua/website/ard.lua

index cec5d69..7a3a8ac 100644 (file)
@@ -151,29 +151,17 @@ function Ard.iter_formats(page)
 
     for prefix, suffix in  page:gmatch(s) do
         local u = prefix .. suffix
-        -- remove querystring
-        u = u:match('^(.-)?') or u
-
-        -- .webs. or Web-S or .s.
-        local webx = suffix:match('%.web(%w)%.') or suffix:match('%.(%w)%.')
-                        or suffix:match('[=%.]Web%-(%w)')
-        if webx then webx = 'web' .. webx:lower() end
-
+        u = u:match('^(.-)?') or u  -- remove querystring
         local t = {
-             container = Ard.container_from(suffix),
-             encoding = suffix:match('%.(h264)%.'),
-             quality = Ard.quality_from(suffix),
-             height = Ard.height_from(suffix),
-             webx = webx,
-             url = u
-           }
+            container = Ard.container_from(suffix),
+            encoding = suffix:match('%.(h264)%.'),
+            quality = Ard.quality_from(suffix),
+            height = Ard.height_from(suffix),
+            url = u
+        }
         table.insert(r,t)
     end
-
-    if #r == 0 then
-        error('no media urls found')
-    end
-
+    if #r == 0 then error('no media urls found') end
     return r
 end