Skip to content

Instantly share code, notes, and snippets.

@garoto
Last active August 6, 2025 07:33
Show Gist options
  • Save garoto/e0eb539b210ee077c980e01fb2daef4a to your computer and use it in GitHub Desktop.
Save garoto/e0eb539b210ee077c980e01fb2daef4a to your computer and use it in GitHub Desktop.
Simple media logger Lua script for mpv
-- Not my code: originally from https://redd.it/3t6s7k (author deleted; failed to ask for permission).
-- Only tested on Windows. Date is set to dd/mmm/yy and time to machine-wide format.
-- Save as "mpvhistory.lua" in your mpv scripts dir. Log will be saved to mpv default config directory.
-- Make sure to leave a comment if you make any improvements/changes to the script!
local HISTFILE = (os.getenv('APPDATA') or os.getenv('HOME')..'/.config')..'/mpv/mpvhistory.log';
mp.register_event('file-loaded', function()
local title, logfile;
title = mp.get_property('media-title');
title = (title == mp.get_property('filename') and '' or ('(%s)'):format(title));
logfile = io.open(HISTFILE, 'a+');
logfile:write(('[%s] %s %s\n'):format(os.date('%d/%b/%y %X'), mp.get_property('path'), title));
logfile:close();
end)
@Listarsss
Copy link

excuse me,you mean the author has deleted the script or his website?I tried but i can't open the linking you give for details。

@garoto
Copy link
Author

garoto commented Aug 1, 2025

excuse me,you mean the author has deleted the script or his website?I tried but i can't open the linking you give for details.

The reddit user who originally concocted the script deleted his account, so I was never able to ask him for permission to share it on github. The redd.it short link shown on the script comment section works and redirects to the original thread.

@Listarsss
Copy link

excuse me,you mean the author has deleted the script or his website?I tried but i can't open the linking you give for details.

The reddit user who originally concocted the script deleted his account, so I was never able to ask him for permission to share it on github. The short link shown on the script comment section works and redirects to the original thread.redd.it

well,that may be my problem.thanks

@Listarsss
Copy link

have u ever tried to use a script called bookmark or bookmarker-menu?they have similar function as this script.I tried both of them but it doen't work.I have to write a script by myself to open video automatically when open mpv.If u know something for this,i would appreciate it very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment