mirror of
https://github.com/NotAShelf/nyxexprs.git
synced 2025-10-03 07:23:32 +00:00
pkgs: init mpvScripts under applications/video
This commit is contained in:
parent
d52fa53348
commit
557e694c0e
3 changed files with 34 additions and 9 deletions
16
pkgs/applications/video/mpv/scripts/save-history/default.nix
Normal file
16
pkgs/applications/video/mpv/scripts/save-history/default.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
lib,
|
||||
mpvScripts,
|
||||
}:
|
||||
mpvScripts.buildLua {
|
||||
pname = "save-history";
|
||||
version = "unstable-2024-03-18";
|
||||
|
||||
src = builtins.filterSource (path: type: type != "directory" || (!lib.hasSuffix path ".nix")) ./.;
|
||||
|
||||
meta = {
|
||||
description = "Save history of played files";
|
||||
homepage = "https://github.com/notashelf/nyxpkgs";
|
||||
maintainers = [lib.maintainers.NotAShelf];
|
||||
};
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
local HISTFILE = (os.getenv('XDG_DATA_HOME') or os.getenv('HOME')) .. '/mpv/history.log';
|
||||
|
||||
mp.register_event('file-loaded', function()
|
||||
local title, fp;
|
||||
|
||||
title = mp.get_property('media-title');
|
||||
title = (title == mp.get_property('filename') and "" or (' (%s)'):format(title));
|
||||
|
||||
fp = io.open(HISTFILE, 'a+');
|
||||
fp:write(('[%s] %s%s\n'):format(os.date('%Y-%m-%d %X'), mp.get_property('path'), title));
|
||||
fp:close();
|
||||
end)
|
Loading…
Add table
Add a link
Reference in a new issue