-
Notifications
You must be signed in to change notification settings - Fork 1
/
suckless-cut.lua
824 lines (653 loc) · 20.2 KB
/
suckless-cut.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
local config = {
export_mode = "ffmpeg"
--[[
supported:
- smoothie
- ffmpeg
cycle by pressing K
]]
,smoothie_path = "smoothie-rs"
,ffmpeg_path = "ffmpeg"
--[[
defaults to checking in path
Windows users: DO NOT FORGET TO ESCAPE \ BY DOUBLING THEM, i.e.:
"D:\\This\\is\\OKAY\\smoothie-rs.exe"
"D:\This\is NOT\OKAY\smoothie-rs.exe"
]] --
,cut_mode = 'trim'
--[[
supported:
- trim: merge each file's own cut to a single file
- split: each cut is exported in it's own file
cycle by pressing k
]] --
,switch_above = 119
,output_directory = ""
--[[
folder where videos get outputed, there's three possible settings:
- an empty strings which means output in the same directory as the video
- "." for working directory
- "D:\\Videos\\", do not forget to duplicate back slashes \
]] --
,dur = 2500
-- Duration of OSC (top left) messages, in milliseconds
,verbose = false
-- Off by default, can be toggled by pressing Ctrl+v
}
require "mp.options".read_options(config, "suckless-cut")
local mp = require 'mp'
local msg = require 'mp.msg'
local utils = require 'mp.utils'
local switchExportRan = false
mp.register_event("file-loaded", function()
local container_fps = mp.get_property('container-fps')
if container_fps == nil then return end
local vid_fps = tonumber(container_fps)
if vid_fps == 0 or switchExportRan then
-- disabled by user / already ran
return
elseif config.switch_above > vid_fps then
print("FPS is above trigger limit, switching export mode to smoothie")
config.export_mode = "smoothie"
end
switchExportRan = true
end)
Osdwarn = false -- Used when user made too many trimming points
Trs = {} -- Creates a fresh empty table, will be appended start/fin timecodes
Index = 1 -- Selects the trim 1, for it to be increased/decreased later
local function verb(...)
local args = { ... }
local text = ""
for i, v in ipairs(args) do
text = text .. tostring(v)
end
if config.verbose == true then
print("VERB", text)
end
end
local function notify(duration, ...)
local args = { ... }
local text = ""
for i, v in ipairs(args) do
text = text .. tostring(v)
end
if text == nil or text == "" then
return
end
print("", text)
mp.command(string.format("show-text \"%s\" %d 1", text, duration))
end
local function dump()
local vals = {
'container-fps', 'time-pos',
'playback-time/full', 'stream-open-filename',
'estimated-frame-number', 'duration'
}
for _, val in ipairs(vals) do
print(val, ": ", mp.get_property(val))
end
end; mp.add_key_binding("Ctrl+d", "dump", dump)
local function setindex(index)
notify(config.dur, ("Setting index to [" .. index .. "]"))
Index = index
end
mp.register_script_message('setindex', setindex)
local function round(int)
return (math.floor(int * 100)) / 100
end
local function get_fn()
local fn = utils.join_path(mp.get_property("working-directory", ""), (mp.get_property("path", "")))
assert(io.open(fn, "r"), "\nFailed to get path " .. fn .. " insufficient permissions?")
-- -- additional path checking
-- if (io.open(fn, "r") == nil) then
-- fn = utils.join_path(utils.getcwd(), fn)
-- else
-- print("Failed getting path " .. fn)
-- end
verb("PATH: " .. fn)
return fn
end
local function get_basename(path)
local _, basename = utils.split_path(path)
assert(basename, "Failed to get basename from " .. path)
return basename
end
local function selectindex()
-- local fps = mp.get_property('container-fps')
local menu = {
type = 'menu_type',
title = 'Select an index to switch back to',
items = {}
}
for i, cur in ipairs(Trs) do
if cur['start'] or cur['end'] then
menu['items'][i] = {}
menu['items'][i]['title'] = (round(cur['start']) or '') .. ' - ' .. (round(cur['fin']) or '')
menu['items'][i]['value'] = "script-message setindex " .. i
menu['items'][i]['hint'] = get_basename(cur['path'])
end
end
mp.commandv('script-message-to', 'uosc', 'open-menu', (utils.format_json(menu)))
end; mp.add_key_binding("Ctrl+t", "selectindex", selectindex)
local function create_chapter(time_pos)
if not time_pos then
time_pos = mp.get_property_number("time-pos")
end
verb("Creating chapter at ", time_pos)
local time_pos_osd = mp.get_property_osd("playback-time/full")
local curr_chapter = mp.get_property_number("chapter")
local chapter_count = mp.get_property_number("chapter-list/count")
local all_chapters = mp.get_property_native("chapter-list")
if chapter_count == 0 then
all_chapters[1] = {
title = "",
time = time_pos
}
curr_chapter = 0
else
for i = chapter_count, curr_chapter + 2, -1 do
all_chapters[i + 1] = all_chapters[i]
end
all_chapters[curr_chapter + 2] = {
title = "",
time = time_pos
}
end
mp.set_property_native("chapter-list", all_chapters)
--mp.set_property_number("chapter", curr_chapter+1)
time_pos = nil
end; mp.add_key_binding("n", "createChapter", create_chapter)
local function deletechapters()
mp.set_property_native("chapter-list", {})
end; mp.add_key_binding("Ctrl+D", "deletechapters", deletechapters)
local function reloadTrs()
-- rebuilds chapters from Trs
mp.set_property_native("chapter-list", {})
-- Delete all chapters
for i, val in pairs(Trs) do
if val['path'] == get_fn() then
if Trs[i]['start'] then
create_chapter(Trs[i]['start'])
else
verb("not creating start chapter for index ", i)
end
if Trs[i]['fin'] then
create_chapter(Trs[i]['fin'])
else
verb("Not creating fin chapter for index ", i)
end
end
end
end;
mp.add_key_binding("R", "reloadTrs", reloadTrs)
mp.register_event("file-loaded", reloadTrs)
local function incrIndex()
if #Trs < 2 and Trs[Index + 1] == nil then
notify(config.dur, "You only have one starter index,\nstart making a second index before cycling through them.")
return
end
if Trs[Index + 1] == nil then
Index = 1 -- Looping through
notify(config.dur, "[c] (Looping) Increased index back down to " .. Index)
else
Index = Index + 1
notify(config.dur, "[C] Increased index to " .. Index)
end
end; mp.add_key_binding("C", "increaseIndex", incrIndex)
local function decrIndex()
if #Trs < 2 then
notify(config.dur, "You only have one starter index,\nstart making a second index before cycling through them.")
return
end
if Trs[Index - 1] == nil then
Index = #Trs -- Looping through
notify(config.dur, "[c] (Looping) Lowered index back up to " .. Index)
else
Index = Index - 1
notify(config.dur, "[c] Lowered index to " .. Index)
end
end; mp.add_key_binding("c", "decreaseIndex", decrIndex)
local function showPoints()
if config.verbose then
print(utils.format_json(Trs))
end
print("export mode: " .. config.export_mode)
print("cut mode: " .. config.cut_mode)
if #Trs == 0 then
notify(config.dur,
"cut mode: " .. config.cut_mode .. " | export mode: " .. config.export_mode .. "\nNo trimming points yet")
return
end
msg = "cut mode: " .. config.cut_mode .. " | export mode: " .. config.export_mode .. "\n"
if #Trs > 11 and Osdwarn == false then
notify(config.dur, "You have too much trimming points\nfor it to fit on the OSD, check the console.")
Osdwarn = true
return
end
for ind, _ in ipairs(Trs) do
if Trs[ind]['path'] ~= nil then
msg = msg .. "\n" .. "[" .. ind .. "] " .. get_basename(Trs[ind]['path'])
end
if Trs[ind].start ~= nil then --/fps
msg = msg .. " : " .. string.sub(string.format(Trs[ind].start), 1, 4)
end
if Trs[ind].fin ~= nil then --/fps
msg = msg .. " - " .. string.sub(string.format(Trs[ind].fin), 1, 4)
end
end
print(msg)
mp.osd_message(msg, config.dur / 500) -- 2x longer than normal dur, divide by / 1000 for same length
end; mp.add_key_binding("Ctrl+p", "showPoints", showPoints)
local function getIndex()
notify(config.dur, "[g] Selected index is " .. Index)
end; mp.add_key_binding("Ctrl+g", "getCurrentIndex", getIndex)
local function initIndex()
if Trs[Index] == nil then
Trs[Index] = {}
end
end
local function start(sof)
initIndex()
local pos = mp.get_property_number('playback-time/full')
local fn = get_fn()
local curframe = "unfilled start"
if sof == true then
curframe = "0"
else
curframe = mp.get_property_number('time-pos')
end
if Trs[Index] == nil then Trs[Index] = {} end
Trs[Index]['start'] = curframe
Trs[Index]['path'] = fn
notify(config.dur, "[g] Set start point of index [" .. Index .. "] at " .. round(pos))
create_chapter(); reloadTrs()
end; mp.add_key_binding("g", "set-start", start)
local function sof()
start(true)
-- will probably remove the rest of this function later
-- local fn = get_fn()
-- notify(dur, "[G] Setting index " .. Index .. " to 00:00:00 (start of file)")
-- if Trs[Index] == nil then Trs[Index] = {} end
-- Trs[Index]['start'] = "0"
-- Trs[Index]['path'] = fn
end; mp.add_key_binding("G", "set-sof", sof)
local function fin(eof)
initIndex()
local pos = mp.get_property_number('playback-time/full')
local fn = get_fn()
local curframe = "unfilled fin"
if eof == true then
curframe = string.format(mp.get_property('duration'))
else
curframe = mp.get_property_number('time-pos')
end
if Trs[Index] == nil then Trs[Index] = {} end
Trs[Index]['fin'] = curframe
if Trs[Index]['start'] == nil and Trs[Index - 1] and Trs[Index - 1]['start'] ~= nil then
notify(config.dur, "[g] You need to set a start point first.")
return nil
-- Trs[Index-1]['fin'] = curframe
end
Trs[Index]['path'] = fn
notify(config.dur, "[h] Set end point of index [" .. Index .. "] at " .. round(pos))
if Trs[Index + 1] == nil then
Trs[Index + 1] = {}
end
if Trs[Index + 1]['start'] == nil and Trs[Index + 1]['fin'] == nil then -- Only step up if it's the last index
Index = Index +
1 -- Else it means the user has went back down on an older index
end
create_chapter(); reloadTrs()
end; mp.add_key_binding("h", "set-fin", fin)
local function eof()
fin(true)
-- same as sof
-- local fn = get_fn()
-- print("", utils.format_json(Trs))
-- if Trs[Index]['start'] == nil then
-- notify(dur, "[g] You need to set a start point first.")
-- return
-- end
-- local framecount = mp.get_property('duration')
-- notify(dur, "[H] Set end point of index [" .. Index .. "] to " .. framecount .. " (End of file)")
-- Trs[Index]['fin'] = string.format(framecount)
-- Trs[Index]['path'] = fn
end; mp.add_key_binding("H", "set-eof", eof)
---------------------------------------------------
-- the following functions are used by render() ---
---------------------------------------------------
local function sanitizeFilepath(filepath)
local sanitized = filepath
if package.config:sub(1,1) == '\\' then -- Check if the system is Windows
sanitized = filepath:gsub("/", "\\") -- Replace forward slashes with backslashes
end
return sanitized
end
local function checkTrs(tbl)
-- Check if the table is empty
if next(tbl) == nil then
print("next is nil ")
return false
end
-- Get the last element of the table
local lastObject = tbl[#tbl]
-- Check if the last object contains all required keys
if lastObject.path and lastObject.fin and lastObject.start then
print("contains all keys")
return true
else
print("insuficient keys")
print(utils.format_json(tbl[#tbl]))
print(utils.format_json(tbl))
return false
end
end
local function appendSuffix(path, suffix)
local basename = path:match("^.+[\\/](.+)$")
if basename then
local dotIndex = basename:find("%.")
if dotIndex then
local namePart = basename:sub(1, dotIndex - 1)
local extension = basename:sub(dotIndex)
return path:sub(1, -(#basename + 1)) .. namePart .. suffix .. extension
else
return path .. suffix
end
else
error("Failed adding suffix '" .. suffix .. "' to video file path " .. path, 1)
end
end
-- https://docs.python.org/3/library/tempfile.html#tempfile.gettempdir
local tempfolder = os.getenv("TEMP")
if utils.readdir(tempfolder) == nil then
tempfolder = os.getenv("TMPDIR")
if utils.readdir(tempfolder) == nil then
if package.config:sub(1, 1) == '\\' then
tempfolder = "C:\\Temp"
else
tempfolder = "/tmp"
end
if utils.readdir(tempfolder) == nil then
error("failed to find temp folder")
end
end
end
local function table_to_args(args)
for index, object in ipairs(args) do
if string.find(object, "%s") then
args[index] = '"' .. object .. '"'
end
end
return table.concat(args, " ")
end
local function render()
-- hides https://mpv.io/manual/master/#terminal-status-line
mp.set_property_bool("quiet", true)
Commands = {}
if checkTrs(Trs) == false then
Trs[#Trs] = nil
end
-- this fixed something at some point
-- Trs[#Trs] = nil -- remove last object
local ffi = require("ffi")
ffi.cdef [[
int system(const char *command);
]]
if config.cut_mode == 'split' then
if config.export_mode == "smoothie" then
for _, val in pairs(Trs) do
Cmd = {
args = {
"-i", val['path'],
"--override", "runtime;cut type;trim",
"--stripaudio",
"--override", "runtime;timecodes;" .. val['start'] .. '-' .. val['fin']
}
}
end
Commands[#Commands + 1] = Cmd
elseif config.export_mode == 'ffmpeg' then
for _, val in pairs(Trs) do
local outPath = appendSuffix(
val['path'],
round(val['start']) .. '-' .. round(val['fin'])
)
Cmd = {
args = {
"-loglevel", "error",
"-stats",
"-ss", val['start'],
"-i", val['path'],
"-map", "0",
"-to", val['fin'],
"-c", "copy",
outPath
}
}
Commands[#Commands + 1] = Cmd
end
end
elseif config.cut_mode == 'trim' then
local unique = {}
for _, value in pairs(Trs) do
if not unique[value.path] then
unique[value.path] = {}
end
unique[value.path][#unique[value.path] + 1] = { start = value['start'], fin = value['fin'] }
end
if config.export_mode == "smoothie" then
for key, value in pairs(unique) do
Cmd = {
args = {
"-i", key,
"--override", "runtime;cut type;trim",
"--stripaudio",
"--override"
}
}
local arg = "runtime;timecodes"
for index, timecodes in ipairs(value) do
-- print(index, utils.format_json(timecodes))
arg = arg .. ';' .. timecodes['start'] .. '-' .. timecodes['fin']
end
arg = '"' .. arg .. '"'
table.insert(Cmd.args, arg)
Commands[#Commands + 1] = Cmd
end
elseif config.export_mode == "ffmpeg" then
print("unique: " .. utils.format_json(unique))
for in_path, cuts in pairs(unique) do
local cutted_paths = {}
for _, cut in pairs(cuts) do
local outPath = sanitizeFilepath(utils.join_path(
tempfolder,
get_basename(in_path) .. '-' .. cut.start .. '-' .. cut.fin .. "-cut.mkv"
))
local args = table_to_args({
"-loglevel", "error",
"-stats",
"-ss", cut.start,
"-i", in_path,
"-map", "0",
"-to", cut.fin,
"-c", "copy",
outPath
})
cutted_paths[#cutted_paths + 1] = outPath
verb("temp cut: " .. args)
ffi.C.system(config.ffmpeg_path .. " " .. args)
end
local concat_path = utils.join_path(tempfolder, "slc-concat-temp.txt")
local file = io.open(concat_path, "w")
-- print("cutted paths: " .. utils.to_string(cutted_paths))
if not file then
error("Unable to open file '" .. concat_path .. "' for writing.")
end
for index, path in ipairs(cutted_paths) do
verb("writing " .. index .. " line '" .. path .. "'")
file:write("file '" .. path .. "'\n")
end
file:close()
local args = table_to_args({
"-hide_banner",
"-loglevel", "error",
"-stats",
"-f", "concat",
"-safe", "0",
"-i", concat_path,
"-c", "copy",
"-default_mode", "infer_no_subs",
"-ignore_unknown",
"-strict", "experimental",
appendSuffix(in_path, "-trim")
})
verb("final concat :" .. args)
ffi.C.system(config.ffmpeg_path .. " " .. args)
end
else
error("Unknown export mode '" .. config.export_mode .. "'")
end
end
--[[
if config.cut_mode == 'split' then
for key, val in pairs(Trs) do
if config.export_mode == 'smoothie' then
verb('setting smoothie split args')
Cmd = {
args = {
"-i", val['path'],
"--override", "runtime;cut type;trim",
"--stripaudio",
"--override", "runtime;timecodes;" .. val['start'] .. '-' .. val['fin']
}
}
elseif config.export_mode == 'ffmpeg' then
verb('setting ffmpeg split args')
local outPath = appendSuffix(
val['path'],
round(val['start']) .. '-' .. round(val['fin'])
)
Cmd = {
args = {
"-loglevel", "error",
"-stats",
"-i", val['path'],
"-ss", val['start'],
"-to", val['fin'],
"-c", "copy",
outPath
}
}
end
Commands[#Commands + 1] = Cmd
end
elseif config.cut_mode == 'trim' then
local unique = {}
for key, value in pairs(Trs) do
if not unique[value.path] then
unique[value.path] = {}
end
unique[value.path][#unique[value.path] + 1] = { start = value['start'], fin = value['fin'] }
end
for key, value in pairs(unique) do
if config.export_mode == "smoothie" then
Cmd = {
args = {
"-i", key,
"--override", "runtime;cut type;trim",
"--stripaudio",
"--override"
}
}
local arg = "runtime;timecodes"
for index, timecodes in ipairs(value) do
-- print(index, utils.format_json(timecodes))
arg = arg .. ';' .. timecodes['start'] .. '-' .. timecodes['fin']
end
arg = '"' .. arg .. '"'
table.insert(Cmd.args, arg)
Commands[#Commands + 1] = Cmd
else
print("\27[31mffmpeg yet\27[0m")
end
end
end
]]
if not config.verbose then
mp.set_property("vo", "null")
mp.commandv('quit')
end
for _, Cmd in pairs(Commands) do
local command = ''
verb("what even is args: " .. utils.format_json(Cmd.args))
for i, element in ipairs(Cmd.args) do
if string.find(element, "%s") then
Cmd.args[i] = '"' .. element .. '"'
end
end
command = table.concat(Cmd.args, " ")
if config.verbose == true and config.export_mode == "smoothie" then
command = command .. ' --verbose'
print('COMMAND: ' .. command)
end
-- -- another way
-- mp.command_native({
-- name = "subprocess",
-- playback_only = false,
-- capture_stdout = true,
-- args = Cmd.args,
-- detach = true
-- })
if config.export_mode == "smoothie" then
ffi.C.system(config.smoothie_path .. " " .. command)
elseif config.export_mode == "ffmpeg" and config.cut_mode == "split" then
ffi.C.system(config.ffmpeg_path .. " " .. command)
end
-- print(utils.to_string(config.export_mode ~= "smoothie") .. " AND " .. utils.to_string(config.cut_mode ~= "trim"))
-- if config.export_mode ~= "smoothie" and config.cut_mode ~= "trim" then
-- print("we gud :3")
-- if config.export_mode == "smoothie" then
-- print("haha!")
-- ffi.C.system(config.smoothie_path .. " " .. command)
-- elseif config.export_mode == "ffmpeg" then
-- ffi.C.system(config.ffmpeg_path .. " " .. command)
-- else
-- error("Unknown export mode \"" .. config.export_mode .. "\"")
-- end
-- end
end
if not config.verbose then
mp.commandv('quit')
end
mp.set_property_bool("quiet", false)
end; mp.add_key_binding("Ctrl+r", "exportSLC", render)
local function cycleCutModes()
if config.cut_mode == 'trim' then
notify(config.dur, "[k] SPLIT MODE: Separating cuts into separate files")
config.cut_mode = 'split'
elseif config.cut_mode == 'split' then
notify(config.dur, "[k] TRIM MODE: Joining each videos' cuts")
config.cut_mode = 'trim'
end
end; mp.add_key_binding("k", "toggleCutModes", cycleCutModes)
local function cycleExportModes()
if config.export_mode == 'ffmpeg' then
notify(config.dur, "[k] EXPORT MODE: smoothie")
config.export_mode = 'smoothie'
elseif config.export_mode == 'smoothie' then
notify(config.dur, "[k] EXPORT MODE: ffmpeg")
config.export_mode = 'ffmpeg'
else
notify(config.dur, "unknown export mode '" .. config.export_mode .. "' falling back to ffmpeg")
config.export_mode = 'ffmpeg'
end
end; mp.add_key_binding("K", "toggleExportModes", cycleExportModes)
local function toggleVerb()
if config.verbose == true then
notify(config.dur, "[Ctrl+v] toggled off Verbose")
config.verbose = false
elseif config.verbose == false then
notify(config.dur, "[Ctrl+v] toggled on Verbose")
config.verbose = true
end
end; mp.add_key_binding("Ctrl+v", "toggleSLCverbose", toggleVerb)