-
Notifications
You must be signed in to change notification settings - Fork 6
/
options.lua
68 lines (59 loc) · 2.75 KB
/
options.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
local SCRIPT_NAME = "mpv_crop_script"
local SCRIPT_KEYBIND = "c"
local SCRIPT_HANDLER = "crop-screenshot"
--------------------
-- Script options --
--------------------
local script_options = OptionParser(SCRIPT_NAME)
local option_values = script_options.values
script_options:add_options({
{nil, nil, "mpv_crop_script.lua options and default values"},
{nil, nil, "Output options #", true},
{"output_template", "${filename} ${#pos:%02h.%02m.%06.3s} ${!full:${crop_w}x${crop_h} ${%unique:%03d}}.${ext}",
"Filename output template. See README.md for property expansion documentation."},
{nil, nil, [[Script-provided properties:
filename - filename without extension
file_ext - original extension without leading dot
path - original file path
pos - playback time
ext - output file extension without leading dot
crop_w - crop width
crop_h - crop height
crop_x - left
crop_y - top
crop_x2 - right
crop_y2 - bottom
full - boolean denoting a full (temporary) screenshot instead of crop
is_image - boolean denoting the source file is likely an image (zero duration and position)
unique - counter that will increase per each existing filename, until a unique name is found]]},
{"output_format", "png",
"Format (encoder) to save final crops in. For example, png, mjpeg, targa, bmp"},
{"output_extension", "",
"Output extension. Leave blank to try to choose from the encoder (if supported)"},
{"create_directories", false,
"Whether to create the directories in the final output path (defined by output_template)"},
{"skip_screenshot_for_images", true,
"If the current file is an image, skip taking a temporary screenshot and crop the image directly"},
{"keep_original", false,
"Keep the full-sized temporary screenshot as well"},
{nil, nil, "Crop tool options #", true},
{"overlay_transparency", 160,
"Transparency (0 - opaque, 255 - transparent) of the dim overlay on the non-cropped area"},
{"overlay_lightness", 0,
"Ligthness (0 - black, 255 - white) of the dim overlay on the non-cropped area"},
{"draw_mouse", false,
"Draw the crop crosshair"},
{"guide_type", "none",
"Crop guide type. One of: none, grid, center"},
{"color_invert", false,
"Use black lines instead of white for the crop frame and crosshair"},
{"auto_invert", false,
"Try to check if video is light or dark upon opening crop tool, and invert the colors if necessary"},
{nil, nil, "Misc options #", true},
{"warn_about_template", true,
"Warn about output_template missing ${ext}, to ensure the extension is not missing"},
{"disable_keybind", false,
"Disable the built-in keybind"}
})
-- Read user-given options, if any
script_options:load_options()