Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC
Commits:
c8c78f75 by Hannes Domani at 2021-11-30T15:27:53+00: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
- - - - -
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/c8c78f75e7117498f1552f22c4ba53a229f50997
--
View it on GitLab:
https://code.videolan.org/videolan/vlc/-/commit/c8c78f75e7117498f1552f22c4ba53a229f50997
You're receiving this email because of your account on code.videolan.org.
_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits