Skip to content

Commit

Permalink
Add options.enabled
Browse files Browse the repository at this point in the history
close #22
  • Loading branch information
natural-harmonia-gropius authored Jan 19, 2024
1 parent cef15af commit bc330f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ KEY script-binding recentmenu/last
## Options

```ini
enabled = yes # whether to record current playing file, can be used with auto-profile
path = "~~/recent.json" # where the history is stored
length = 10 # number of items
width = 88 # number of characters for the item
Expand Down
4 changes: 3 additions & 1 deletion recentmenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ local utils = require("mp.utils")
local options = require("mp.options")

local o = {
enabled = true,
path = "~~/recent.json",
length = 10,
width = 88,
ignore_same_series = true,
}
options.read_options(o)
options.read_options(o, _, function() end)

local path = mp.command_native({ "expand-path", o.path })

Expand Down Expand Up @@ -324,6 +325,7 @@ end

function on_load()
current_item = { nil, nil, nil }
if not o.enabled then return end
local path = mp.get_property("path")
if not path then return end
local filename = mp.get_property("filename")
Expand Down

0 comments on commit bc330f4

Please sign in to comment.