Skip to content

Commit

Permalink
add option to disable history db function
Browse files Browse the repository at this point in the history
  • Loading branch information
ksyasuda committed Sep 4, 2024
1 parent 6296401 commit e484aa5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions mpv-youtube-queue.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ menu_timeout=5
show_errors=yes
ytdlp_file_format=mp4
ytdlp_output_template=%(uploader)s/%(title)s.%(ext)s
use_history_db=yes
backend_host=http://localhost
backend_port=42069
7 changes: 5 additions & 2 deletions mpv-youtube-queue.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ local options = {
show_errors = true,
ytdlp_file_format = "mp4",
ytdlp_output_template = "%(uploader)s/%(title)s.%(ext)s",
use_history_db = true,
backend_host = "http://localhost",
backend_port = "42069"
}
Expand Down Expand Up @@ -208,7 +209,7 @@ local function _split_command(cmd)
return components
end

function YouTubeQueue._add_to_history(video)
function YouTubeQueue._add_to_history_db(video)
local url = options.backend_host .. ":" .. options.backend_port ..
"/add_video"
local current_date = os.date("%Y-%m-%d") -- Get the current date in YYYY-MM-DD format
Expand Down Expand Up @@ -512,7 +513,9 @@ function YouTubeQueue.play_video(direction)
mp.set_property_number("playlist-pos", index - 1)
end
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

-- add the video to the queue from the clipboard or call from script-message
Expand Down

0 comments on commit e484aa5

Please sign in to comment.