Hugo Beauzée-Luyssen pushed to branch 3.0.x at VideoLAN / VLC


Commits:
fb1519ba by Hannes Domani at 2021-11-30T17:16:11+01:00
lua: icecast: fix nil value error for some streams

Due to a bug in the directory, some streams lack a listen URL.

Fix #25309

(cherry picked from commit c8c78f75e7117498f1552f22c4ba53a229f50997)
Signed-off-by: Marvin Scholz <epira...@gmail.com>

- - - - -


1 changed file:

- share/lua/sd/icecast.lua


Changes:

=====================================
share/lua/sd/icecast.lua
=====================================
@@ -41,27 +41,30 @@ function main()
     local tree = simplexml.parse_url("http://dir.xiph.org/yp.xml";)
     for _, station in ipairs( tree.children ) do
         simplexml.add_name_maps( station )
-        local station_name = station.children_map["server_name"][1].children[1]
-        if station_name == "Unspecified name" or station_name == "" or 
station_name == nil
+        if not( station.children_map["listen_url"][1].children[1] == nil )
         then
-                station_name = 
station.children_map["listen_url"][1].children[1]
-                if string.find( station_name, "radionomy.com" )
-                then
-                        station_name = string.match( station_name, "([^/]+)$")
-                        station_name = string.gsub( station_name, "-", " " )
-                end
+            local station_name = 
station.children_map["server_name"][1].children[1]
+            if station_name == "Unspecified name" or station_name == "" or 
station_name == nil
+            then
+                    station_name = 
station.children_map["listen_url"][1].children[1]
+                    if string.find( station_name, "radionomy.com" )
+                    then
+                            station_name = string.match( station_name, 
"([^/]+)$")
+                            station_name = string.gsub( station_name, "-", " " 
)
+                    end
+            end
+            vlc.sd.add_item( 
{path=station.children_map["listen_url"][1].children[1],
+                              title=station_name,
+                              
genre=dropnil(station.children_map["genre"][1].children[1]),
+                              
nowplaying=dropnil(station.children_map["current_song"][1].children[1]),
+                              
uiddata=station.children_map["listen_url"][1].children[1]
+                                      .. 
dropnil(station.children_map["server_name"][1].children[1]),
+                              meta={
+                                      ["Listing Source"]="dir.xiph.org",
+                                      ["Listing Type"]="radio",
+                                      ["Icecast 
Bitrate"]=dropnil(station.children_map["bitrate"][1].children[1]),
+                                      ["Icecast Server 
Type"]=dropnil(station.children_map["server_type"][1].children[1])
+                              }} )
         end
-        vlc.sd.add_item( 
{path=station.children_map["listen_url"][1].children[1],
-                          title=station_name,
-                          
genre=dropnil(station.children_map["genre"][1].children[1]),
-                          
nowplaying=dropnil(station.children_map["current_song"][1].children[1]),
-                          
uiddata=station.children_map["listen_url"][1].children[1]
-                                  .. 
dropnil(station.children_map["server_name"][1].children[1]),
-                          meta={
-                                  ["Listing Source"]="dir.xiph.org",
-                                  ["Listing Type"]="radio",
-                                  ["Icecast 
Bitrate"]=dropnil(station.children_map["bitrate"][1].children[1]),
-                                  ["Icecast Server 
Type"]=dropnil(station.children_map["server_type"][1].children[1])
-                          }} )
     end
 end



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/fb1519ba6e41e4e41fdcd1795ffe4320e2319db8

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/fb1519ba6e41e4e41fdcd1795ffe4320e2319db8
You're receiving this email because of your account on code.videolan.org.


_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to