add option to disable history db function

This commit is contained in:
ksyasuda 2024-09-04 11:47:40 -07:00
parent 62964016e4
commit e484aa5068
No known key found for this signature in database
2 changed files with 6 additions and 2 deletions

View File

@ -26,5 +26,6 @@ menu_timeout=5
show_errors=yes show_errors=yes
ytdlp_file_format=mp4 ytdlp_file_format=mp4
ytdlp_output_template=%(uploader)s/%(title)s.%(ext)s ytdlp_output_template=%(uploader)s/%(title)s.%(ext)s
use_history_db=yes
backend_host=http://localhost backend_host=http://localhost
backend_port=42069 backend_port=42069

View File

@ -59,6 +59,7 @@ local options = {
show_errors = true, show_errors = true,
ytdlp_file_format = "mp4", ytdlp_file_format = "mp4",
ytdlp_output_template = "%(uploader)s/%(title)s.%(ext)s", ytdlp_output_template = "%(uploader)s/%(title)s.%(ext)s",
use_history_db = true,
backend_host = "http://localhost", backend_host = "http://localhost",
backend_port = "42069" backend_port = "42069"
} }
@ -208,7 +209,7 @@ local function _split_command(cmd)
return components return components
end end
function YouTubeQueue._add_to_history(video) function YouTubeQueue._add_to_history_db(video)
local url = options.backend_host .. ":" .. options.backend_port .. local url = options.backend_host .. ":" .. options.backend_port ..
"/add_video" "/add_video"
local current_date = os.date("%Y-%m-%d") -- Get the current date in YYYY-MM-DD format local current_date = os.date("%Y-%m-%d") -- Get the current date in YYYY-MM-DD format
@ -512,7 +513,9 @@ function YouTubeQueue.play_video(direction)
mp.set_property_number("playlist-pos", index - 1) mp.set_property_number("playlist-pos", index - 1)
end end
YouTubeQueue.print_current_video() YouTubeQueue.print_current_video()
YouTubeQueue._add_to_history(current_video) if options.use_history_db then
YouTubeQueue._add_to_history_db(current_video)
end
end end
-- add the video to the queue from the clipboard or call from script-message -- add the video to the queue from the clipboard or call from script-message