[vlc-commits] vocaroo.lua: dispatch to correct CDN server

Pierre Ynard git at videolan.org
Fri Oct 30 13:13:08 CET 2020


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Fri Oct 30 13:05:16 2020 +0100| [9d4c4d2fb9524b7709d2fdc1a7decc108602a445] | committer: Pierre Ynard

vocaroo.lua: dispatch to correct CDN server

Vocaroo has started using different server locations for different
media, and the client has to dispatch to the correct one based on the
media ID.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9d4c4d2fb9524b7709d2fdc1a7decc108602a445
---

 share/lua/playlist/vocaroo.lua | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/share/lua/playlist/vocaroo.lua b/share/lua/playlist/vocaroo.lua
index b9c112ef9a..4b392e3fb4 100644
--- a/share/lua/playlist/vocaroo.lua
+++ b/share/lua/playlist/vocaroo.lua
@@ -30,7 +30,15 @@ end
 function parse()
     -- The HTML page contains no metadata and is not worth parsing
     local id = string.match( vlc.path, "^vocaroo%.com/([^?]+)" )
-    local path = vlc.access.."://media.vocaroo.com/mp3/"..id
+
+    -- Dispatch media to correct CDN server
+    -- function Ic(e){return function(e){if(e.length){if(11==e.length)return ControlConfig.mediaMp3FileUrl;if(12==e.length&&"1"==e[0])return ControlConfig.mediaMp3FileUrl1;if(10==e.length)return ControlConfig.mediaMp3FileUrl1}return ControlConfig.mediaMp3FileUrl}(e)+e}
+    local cdn = ( string.len( id ) == 10 or
+                  ( string.len( id ) == 12 and string.match( id, "^1" ) ) )
+        and "//media1.vocaroo.com/mp3/"
+        or "//media.vocaroo.com/mp3/"
+
+    local path = vlc.access..":"..cdn..id
     return { { path = path } }
 end
 



More information about the vlc-commits mailing list