forked from Arieleg/mpv-copyTime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcopyTime.lua
More file actions
22 lines (18 loc) · 755 Bytes
/
Copy pathcopyTime.lua
File metadata and controls
22 lines (18 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require 'mp'
local function set_clipboard(text)
mp.commandv("run", "powershell", "set-clipboard", text);
end
local function copyTime()
local time_pos = mp.get_property_number("time-pos")
local time_in_seconds = time_pos
local time_seg = time_pos % 60
time_pos = time_pos - time_seg
local time_hours = math.floor(time_pos / 3600)
time_pos = time_pos - (time_hours * 3600)
local time_minutes = time_pos/60
time_seg,time_ms=string.format("%.03f", time_seg):match"([^.]*).(.*)"
time = string.format("%02d:%02d:%02d.%s", time_hours, time_minutes, time_seg, time_ms)
mp.osd_message(string.format("Copied to Clipboard: %s", time))
set_clipboard(time)
end
mp.add_key_binding("Ctrl+c", "copyTime", copyTime)