2016-05-04 15:21:09 +00:00
|
|
|
{ pkgs, lib, ... }:
|
2016-04-28 20:55:18 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
|
2017-03-25 21:49:26 +00:00
|
|
|
scripts = lib.concatStringsSep "," [
|
|
|
|
good
|
|
|
|
delete
|
|
|
|
];
|
|
|
|
|
2017-06-20 17:30:14 +00:00
|
|
|
mpv = pkgs.symlinkJoin {
|
|
|
|
name = "mpv";
|
|
|
|
paths = [
|
|
|
|
(pkgs.writeDashBin "mpv" ''
|
|
|
|
exec ${pkgs.mpv}/bin/mpv --no-config --script=${scripts} "$@"
|
|
|
|
'')
|
2017-06-24 14:40:49 +00:00
|
|
|
pkgs.mpv
|
2017-06-20 17:30:14 +00:00
|
|
|
];
|
|
|
|
};
|
2016-04-28 20:55:18 +00:00
|
|
|
|
2016-05-04 15:21:09 +00:00
|
|
|
moveToDir = key: dir: pkgs.writeText "move-with-${key}.lua" ''
|
|
|
|
tmp_dir = "${dir}"
|
|
|
|
|
|
|
|
function move_current_track_${key}()
|
|
|
|
track = mp.get_property("path")
|
|
|
|
os.execute("mkdir -p '" .. tmp_dir .. "'")
|
|
|
|
os.execute("mv '" .. track .. "' '" .. tmp_dir .. "'")
|
|
|
|
print("moved '" .. track .. "' to " .. tmp_dir)
|
|
|
|
end
|
|
|
|
|
|
|
|
mp.add_key_binding("${key}", "move_current_track_${key}", move_current_track_${key})
|
|
|
|
'';
|
|
|
|
|
|
|
|
good = moveToDir "G" "./.good";
|
|
|
|
delete = moveToDir "D" "./.graveyard";
|
|
|
|
|
2016-08-06 21:16:18 +00:00
|
|
|
up = moveToDir "U" "./up";
|
|
|
|
down = moveToDir "Y" "./down";
|
|
|
|
|
2016-04-28 20:55:18 +00:00
|
|
|
in {
|
2017-05-11 16:03:51 +00:00
|
|
|
environment.systemPackages = [
|
2016-04-28 20:55:18 +00:00
|
|
|
mpv
|
|
|
|
];
|
|
|
|
}
|