[Bug] Error in parsing Icecast Radio Directory

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
oasis123
New Cone
New Cone
Posts: 4
Joined: 03 Dec 2020 19:18

[Bug] Error in parsing Icecast Radio Directory

Postby oasis123 » 03 Dec 2020 19:38

VideoLAN downloads the list of channels of 'Icecast Radio Directory' from http://dir.xiph.org/yp.xml
If this xml file contains entries with blank <listen_url> field, VideoLAN stops processing further channels.

Code: Select all

<entry><server_name>HearMe - Smooth Jazz</server_name><server_type>audio/mpeg</server_type><bitrate>128</bitrate><samplerate>44100</samplerate><channels>2</channels><listen_url></listen_url><current_song></current_song><genre>Jazz</genre></entry>
I downloaded manually the xml file and removed entries with blank (void) <listen_url></listen_url>.
Then I "deceived" VideoLAN to download my local edited xml.
Added to C:\Windows\System32\drivers\etc\hosts file: 127.0.0.1 dir.xiph.org
Created a local web server with PHP

Code: Select all

php -S localhost:80
This way, accessing 'Icecast Radio Directory' fetched and parsed the edited xml. Finally I created a Playlist with the channels I like and saved the radio-playlist.xspf file.

Or Icecast produces a xml with no blanks URLs, or VideoLAN learns to filter out those entries.

Lotesdelere
Cone Master
Cone Master
Posts: 9960
Joined: 08 Sep 2006 04:39
Location: Europe

Re: [Bug] Error in parsing Icecast Radio Directory

Postby Lotesdelere » 04 Dec 2020 06:23

Please open Tools -> Messages (set Verbosity to 2) before you start the Icecast directory, and then paste the full resulting log here or on Pastebin.com if it's too long.

Then create a new ticket on the VLC Trac with the links to your log and to this thread:
https://trac.videolan.org/vlc/

oasis123
New Cone
New Cone
Posts: 4
Joined: 03 Dec 2020 19:18

Re: [Bug] Error in parsing Icecast Radio Directory

Postby oasis123 » 04 Dec 2020 09:49

Please open Tools -> Messages (set Verbosity to 2) before you start the Icecast directory, and then paste the full resulting log here or on Pastebin.com if it's too long.
Then create a new ticket on the VLC Trac with the links to your log and to this thread: https://trac.videolan.org/vlc/
I don't have time to comply with the VLC bug tracker reporting instructions. The debug log says:

Code: Select all

main debug: adding: Online Radio FM lua error: Error while running script C:\Program Files\VideoLAN\VLC\lua\sd\icecast.luac, function main(): ...tras/package/win32/../../../share/lua/sd/icecast.lua:59: attempt to concatenate field '?' (a nil value)
That doesn't mean anything. I already found the internal problem: the xml parser stops when it finds a void field (that's what "nil value") means.

0gre
New Cone
New Cone
Posts: 1
Joined: 07 Dec 2020 14:42

Re: [Bug] Error in parsing Icecast Radio Directory

Postby 0gre » 07 Dec 2020 15:07

oasis123:

I appreciate what you've figured out there, but this a non-solution for the average user.

Lotesdelere - I have done as you instructed.

jpl-20
New Cone
New Cone
Posts: 1
Joined: 29 Dec 2020 03:22

Re: [Bug] Error in parsing Icecast Radio Directory

Postby jpl-20 » 29 Dec 2020 04:13

Issue quite easy to fix in the original icecast plugin:

Code: Select all

--[[ $Id$ Copyright © 2010 VideoLAN and AUTHORS Authors: Fabio Ritrovato <sephiroth87 at videolan dot org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. JPL/2020/12/29: Fixed parsing issue: do not add stations where "listen_url" item is empty --]] lazily_loaded = false function lazy_load() if lazily_loaded then return nil end require "simplexml" lazily_loaded = true end function descriptor() return { title="Icecast Radio Directory-JPL fix" } end function dropnil(s) if s == nil then return "" else return s end end function main() lazy_load() 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] local station_url = station.children_map["listen_url"][1].children[1] if station_url ~= nil then 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 end end
For average vlc user:
  1. Copy the code above to a new file, name it icecast-new.lua
  2. Go to vlc install dir, then to lua/sd
  3. Remove the original icecast.luac file
  4. Add the icecast-new.lua file
  5. Run vlc and enjoy

fubber289
New Cone
New Cone
Posts: 3
Joined: 30 Nov 2020 18:34

Re: [Bug] Error in parsing Icecast Radio Directory

Postby fubber289 » 29 Dec 2020 14:34

yaaaaaaaaaay, nice one , thank you for engineering and sharing that fix.
very average user here needed to do a bit of extra fiddling to find the file on mac :



the location of plugin on my mac was /Applications/VLC.app//Contents/MacOS/share/lua/sd/
in terminal, using sudo su we we copied the icecast.luac to icecast.luacold , deleted the original icecast.luac and used vi to create a new icecast.luac and then pasted the script above, saved, restarted vlc , all good!

blenheimgooner
New Cone
New Cone
Posts: 1
Joined: 04 Feb 2021 10:02

Re: [Bug] Error in parsing Icecast Radio Directory

Postby blenheimgooner » 04 Feb 2021 10:25

Any chance of fixing this bug? Would be wonderful for those of us that are less technically literate - and much appreciated.

Neuk2015
Blank Cone
Blank Cone
Posts: 17
Joined: 03 Mar 2015 07:52
VLC version: 2.2.1
Operating System: Windows 10
Location: Pacifique du Nord

Re: [Bug] Error in parsing Icecast Radio Directory

Postby Neuk2015 » 22 Jul 2021 13:06

At the moment I cannot devote the time I would need to fix this bug. But I can assure anybody if you following the instrutions like we used to when we were young and just learning things, it will make sense. I am not a dev, and I anticipate taking a few wrong turns along the way.

And I'm going to risk being flamed. And I can tell you it this upsets you, grow up and stop complaining! The guys who developed VLC and do the work of maintaining it are not American. They do not react to being yelled at when and enduser tries a solution to a problem and it doesn't magically disappear. It sometimes requires more concentration and focus than you are used to using to fix a problem.

I had a situation with VLC a few years ago and I could not figure out how to fix it. I actually wrote to Jean-Baptiste (forgive me if I have your name wrong). I very politely explained that I'd failed using every solution I could think of. And if he could offer at least part of a solution I could appreciate it. He was very gracious in his reply. I never used that privilege again, but the point is, it you're going to act like an infant who has thrown your toys out of your pram, chances are you're going to be treated like one.

Hitchhiker
Big Cone-huna
Big Cone-huna
Posts: 2203
Joined: 29 Jun 2018 11:40
VLC version: 3.0.17.4
Operating System: Windows 8.1
Location: The Netherlands

Re: [Bug] Error in parsing Icecast Radio Directory

Postby Hitchhiker » 14 Nov 2021 20:30

Issue quite easy to fix in the original icecast plugin:

For average vlc user:
  1. Copy the code above to a new file, name it icecast-new.lua
  2. Go to vlc install dir, then to lua/sd
  3. Remove the original icecast.luac file
  4. Add the icecast-new.lua file
  5. Run vlc and enjoy

Excellent script, but I would recommend users to simply use it to create a new icecast.luac file instead of calling it something else and then use it to overwrite the existing one. I've posted instructions in this thread on how to do that. https://forum.videolan.org/viewtopic.ph ... 77#p522477

My post also includes before and after images which might be useful to peeps.


Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: No registered users and 7 guests