Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion memo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
--
-- A recent files menu for mpv

mp.msg.debug("dev copy!")

local default_history_path = "~~state/memo-history.log"
local options = {
-- File path gets expanded, leave empty for in-memory history
history_path = "~~/memo-history.log",
history_path = default_history_path,

-- How many entries to display in menu
entries = 10,
Expand Down Expand Up @@ -80,6 +83,22 @@ mp.options.read_options(options, "memo", function(list)
end)
options.path_prefixes = parse_path_prefixes(options.path_prefixes)

-- Automatically migrate history from `~~/` to `~~state/`
if options.history_path == default_history_path then
mp.msg.debug("using default history_path")
local function expand_path(path)
return mp.command_native({"expand-path", path})
end
local old_path = expand_path("~~/memo-history.log")
local new_path = expand_path(options.history_path)

if mp.utils.file_info(old_path) ~= nil and mp.utils.file_info(new_path) == nil then
-- memo-history.log is only found at the old location
mp.msg.info("Migrating history file to the new default location")
os.rename(old_path, new_path)
end
end

local assdraw = require "mp.assdraw"

local osd = mp.create_osd_overlay("ass-events")
Expand Down