Online radio commercial filter

This forum is about all development around libVLC.
valentas
New Cone
New Cone
Posts: 2
Joined: 27 Jul 2012 13:25

Online radio commercial filter

Postby valentas » 27 Jul 2012 13:32

Hi,

I would like to have a filter that checks the online radio song information (VLC displays it in the status bar) and silents it down based on some criteria (for example the commercials).

What is the easiest way to do it (I can write the code myself)?

Thanks,
Valentas

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Online radio commercial filter

Postby Jean-Baptiste Kempf » 27 Jul 2012 17:01

The easiest is probably a lua extension for that.
You can do an interface too.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

valentas
New Cone
New Cone
Posts: 2
Joined: 27 Jul 2012 13:25

Re: Online radio commercial filter

Postby valentas » 08 May 2014 11:08

I am posting my whole script, because I find it incredibly useful for myself. Sorry I don't have time to make it usable for generic audience: you would need
to add some interface to select which keywords in the title refer to an advertisement. Currently, to adapt to your own radio station, change keywords like "REKLAMA" in the script to match whatever you see during an advertisement.

On Linux this has to be stored in a new file ~/.local/share/vlc/lua/extensions/mute_down_ads.lua. To activate the script you have to check the box from the VLC right-click menu.

Code: Select all

-- A script for muting down ads and other junk based on name in VLC -- for basic info on writing such scripts, see: -- http://www.videolan.org/developers/vlc/share/lua/README.txt -- https://forum.videolan.org/viewtopic.php?f=32&t=102977 -- http://www.lua.org/manual/5.1/manual.html muted = false last_level = 0 -- Script descriptor, called when the extensions are scanned function descriptor() return { title = "Mute down ads" ; version = "0.1" ; author = "Valentas K." ; url = 'http://www.vu.lt'; shortdesc = "Mute down ads"; description = "<center><b>Mute down adds</b></center><br />" .. "Edit the file .local/share/vlc/lua/extensions/mute_down_adds.lua <br /> " .. "To add an arbitrary condition for muting down adverts and other junk."; capabilities = { "input-listener" } } end function mute_down_ads() local to_mute = false local item = vlc.input.item() --vlc.msg.info("[mute_down_ads] called") local meta = item and item:metas() name = meta and meta["now_playing"] if name ~= nil then --My radio station shows a word "REKLAMA" when it is playing an ad to_mute = (string.find(name, "REKLAMA") ~= nil) --My radio station shows date string when it is playing news/hosts chat to_mute = to_mute or (string.find(name, "%d%d%d%d%-%d%d%-%d%d") ~= nil) end if (not muted) and to_mute then last_level = vlc.volume.get() vlc.volume.set(0) muted = true --vlc.msg.info("[mute_down_ads]: on") end if muted and (not to_mute) then vlc.volume.set(last_level) muted = false --vlc.msg.info("[mute_down_adds]: off") end end function input_changed() mute_down_ads() end function meta_changed() mute_down_ads() end function activate() mute_down_ads() end function deactivate() if muted then vlc.volume.set(last_level) muted = false --vlc.msg.info("[mute_down_adds]: off") end end


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 25 guests