Skip to content

Commit

Permalink
ytdl_hook.lua: fix hook triggering while it shouldn't
Browse files Browse the repository at this point in the history
  • Loading branch information
kasper93 committed Jul 12, 2024
1 parent f470b63 commit c0f5d23
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions player/lua/ytdl_hook.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@ local function on_load_hook(load_fail)
local url = mp.get_property("stream-open-filename", "")
local force = url:find("^ytdl://")
local early = force or o.try_ytdl_first
if early and load_fail then
if early == load_fail then
return
end
if not force and (not url:find("^https?://") or is_blacklisted(url)) then
Expand All @@ -1166,7 +1166,7 @@ local function on_load_hook(load_fail)
run_ytdl_hook(url)
end

mp.add_hook("on_load", 10, function() on_load_hook() end)
mp.add_hook("on_load", 10, function() on_load_hook(false) end)
mp.add_hook("on_load_fail", 10, function() on_load_hook(true) end)

mp.add_hook("on_load", 20, function ()
Expand Down

0 comments on commit c0f5d23

Please sign in to comment.