summaryrefslogtreecommitdiffstats
path: root/player/lua/ytdl_hook.lua
diff options
context:
space:
mode:
authorRicardo Constantino <wiiaboo@gmail.com>2017-07-11 23:40:40 +0100
committerRicardo Constantino <wiiaboo@gmail.com>2017-07-11 23:42:22 +0100
commitdb60cbb80acf3709e6d0756fffa42a87baf27973 (patch)
tree5d78e36fd550131d7fe81a51b0bd1c2054dcb1e6 /player/lua/ytdl_hook.lua
parent042e98f4c9afb5cb41c727a6cf61a1e447710d9b (diff)
downloadmpv-db60cbb80acf3709e6d0756fffa42a87baf27973.tar.bz2
mpv-db60cbb80acf3709e6d0756fffa42a87baf27973.tar.xz
ytdl_hook: actually load the script-opts
Also, comma-separated list doesn't actually work, even quote-surrounded. Switch to using | instead.
Diffstat (limited to 'player/lua/ytdl_hook.lua')
-rw-r--r--player/lua/ytdl_hook.lua12
1 files changed, 7 insertions, 5 deletions
diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua
index b01bf68f30..72fa58774a 100644
--- a/player/lua/ytdl_hook.lua
+++ b/player/lua/ytdl_hook.lua
@@ -5,6 +5,7 @@ local options = require 'mp.options'
local o = {
exclude = ""
}
+options.read_options(o)
local ytdl = {
path = "youtube-dl",
@@ -100,12 +101,12 @@ local function extract_chapters(data, video_length)
end
local function is_blacklisted(url)
- if o.blacklist == "" then return false end
+ if o.exclude == "" then return false end
if #ytdl.blacklisted == 0 then
- local joined = o.blacklist
- while joined:match(',?[^,]+') do
- local _, e, domain = joined:find(',?([^,]+)')
- table.insert(ytdl.blacklisted, domain)
+ local joined = o.exclude
+ while joined:match('%|?[^|]+') do
+ local _, e, substring = joined:find('%|?([^|]+)')
+ table.insert(ytdl.blacklisted, substring)
joined = joined:sub(e+1)
end
end
@@ -113,6 +114,7 @@ local function is_blacklisted(url)
url = url:match('https?://(.+)')
for _, exclude in ipairs(ytdl.blacklisted) do
if url:match(exclude) then
+ msg.verbose('URL matches excluded substring. Skipping.')
return true
end
end