diff options
author | Christoph Heinrich <christoph.heinrich@student.tugraz.at> | 2022-09-04 19:50:52 +0200 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2022-09-14 13:29:11 +0200 |
commit | e302c9b7dd9991d0d8114bb41cd10cf30693e32e (patch) | |
tree | c1ef7fb4f506b0e8867eb88cb97296aeb4bad85a | |
parent | b9c7e5b5fff88c86ed19c9753b3b8a2499293bee (diff) | |
download | mpv-e302c9b7dd9991d0d8114bb41cd10cf30693e32e.tar.bz2 mpv-e302c9b7dd9991d0d8114bb41cd10cf30693e32e.tar.xz |
ytdl_hook: simplify exclude option parsing
The parsing used to be unnecessarily complicated,
now it's easier to read and understand.
-rw-r--r-- | player/lua/ytdl_hook.lua | 7 |
1 files changed, 2 insertions, 5 deletions
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 |