Skip to content

Commit

Permalink
auto_profiles.lua: actually exit when no auto profiles are defined
Browse files Browse the repository at this point in the history
Unsetting _G.mp_event_loop at the top level quits the script, but not
within callbacks. Use the new exit() function instead. Fixes e2284fb.

This actually has an edge case since e2284fb where you can add auto
profiles only later with load-config-file and the script stays unloaded,
but it's still reasonable to quit if mpv.conf has no conditional
profiles. You could always explicitly set --load-auto-profiles=yes in
this case.
  • Loading branch information
guidocella committed Nov 1, 2024
1 parent 139af13 commit d95c2ac
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions player/lua/auto_profiles.lua
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,7 @@ mp.observe_property("profile-list", "native", function (_, profiles_property)
load_profiles(profiles_property)

if #profiles < 1 and mp.get_property("load-auto-profiles") == "auto" then
-- make it exit immediately
_G.mp_event_loop = function() end
exit()
return
end

Expand Down

0 comments on commit d95c2ac

Please sign in to comment.