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