diff --git a/.config/mpv/scripts/youtube-quality.lua b/.config/mpv/scripts/youtube-quality.lua index 6ba23e0..71b6a6d 100644 --- a/.config/mpv/scripts/youtube-quality.lua +++ b/.config/mpv/scripts/youtube-quality.lua @@ -112,7 +112,7 @@ function show_menu() draw_menu() end function choose_prefix(i) - if i == selected and i == active then return opts.selected_and_active + if i == selected and i == active then return opts.selected_and_active elseif i == selected then return opts.selected_and_inactive end if i ~= selected and i == active then return opts.unselected_and_active @@ -157,7 +157,7 @@ function show_menu() mp.add_forced_key_binding(opts.toggle_menu_binding, "escape", destroy) draw_menu() - return + return end local ytdl = { @@ -186,7 +186,7 @@ function download_formats() url = string.gsub(url, "ytdl://", "") -- Strip possible ytdl:// prefix. -- don't fetch the format list if we already have it - if format_cache[url] ~= nil then + if format_cache[url] ~= nil then local res = format_cache[url] return res, table_size(res) end @@ -240,7 +240,7 @@ end -- register script message to show menu -mp.register_script_message("toggle-quality-menu", +mp.register_script_message("toggle-quality-menu", function() if destroyer ~= nil then destroyer() @@ -258,7 +258,8 @@ function reload_resume() local reload_duration = mp.get_property_native("duration") local time_pos = mp.get_property("time-pos") - mp.set_property_number("playlist-pos", playlist_pos) + --mp.set_property_number("playlist-pos", playlist_pos) + mp.commandv("playlist-play-index", playlist_pos) -- Tries to determine live stream vs. pre-recordered VOD. VOD has non-zero -- duration property. When reloading VOD, to keep the current time position