From e302c9b7dd9991d0d8114bb41cd10cf30693e32e Mon Sep 17 00:00:00 2001 From: Christoph Heinrich Date: Sun, 4 Sep 2022 19:50:52 +0200 Subject: ytdl_hook: simplify exclude option parsing The parsing used to be unnecessarily complicated, now it's easier to read and understand. --- player/lua/ytdl_hook.lua | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'player') diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua index d950779f01..0656f01998 100644 --- a/player/lua/ytdl_hook.lua +++ b/player/lua/ytdl_hook.lua @@ -193,11 +193,8 @@ end local function is_blacklisted(url) if o.exclude == "" then return false end if #ytdl.blacklisted == 0 then - local joined = o.exclude - while joined:match('%|?[^|]+') do - local _, e, substring = joined:find('%|?([^|]+)') - table.insert(ytdl.blacklisted, substring) - joined = joined:sub(e+1) + for match in o.exclude:gmatch('%|?([^|]+)') do + ytdl.blacklisted[#ytdl.blacklisted + 1] = match end end if #ytdl.blacklisted > 0 then -- cgit v1.2.3