[download]

config/mpv/scripts/history.lua

   1 local function history()
   2     local home = os.getenv("HOME")
   3     local file = io.open(home.."/.config/mpv/history", "a+")
   4 
   5     file:write(("[%s]\t%s\t%3d%%\t%s\t--\t%s\n"):format(
   6         os.date("%F %T"),
   7         os.date("!%T", mp.get_property("time-pos") or 0),
   8         mp.get_property("percent-pos"),
   9         mp.get_property("media-title"),
  10         mp.get_property("path"):gsub(home, "~")
  11     ))
  12     file:close()
  13 end
  14 
  15 mp.register_event("file-loaded", history)
  16 mp.add_hook("on_unload", 50, history)