summaryrefslogtreecommitdiffstats
path: root/TOOLS
diff options
context:
space:
mode:
authorKevin Mitchell <kevmitch@gmail.com>2014-05-04 12:59:21 -0700
committerKevin Mitchell <kevmitch@gmail.com>2014-05-04 12:59:21 -0700
commit20b5fecdf14736b739db5c53c740484cedb2fbf5 (patch)
tree69b4fd0b0500a18fc66aca6bcdd0d2e7dcf7aaf0 /TOOLS
parentc91373a20204237110556c81507cdbbf3991c61b (diff)
downloadmpv-20b5fecdf14736b739db5c53c740484cedb2fbf5.tar.bz2
mpv-20b5fecdf14736b739db5c53c740484cedb2fbf5.tar.xz
TOOLS/lua: use double quotes unless there's a good reason
Diffstat (limited to 'TOOLS')
-rw-r--r--TOOLS/lua/autocrop.lua26
-rw-r--r--TOOLS/lua/drc-control.lua26
2 files changed, 26 insertions, 26 deletions
diff --git a/TOOLS/lua/autocrop.lua b/TOOLS/lua/autocrop.lua
index 0da94796df..2523dd99de 100644
--- a/TOOLS/lua/autocrop.lua
+++ b/TOOLS/lua/autocrop.lua
@@ -40,11 +40,11 @@ end
function del_filter_if_present(label)
-- necessary because mp.command('vf del @label:filter') raises an
-- error if the filter doesn't exist
- local vfs = mp.get_property_native('vf')
+ local vfs = mp.get_property_native("vf")
for i,vf in pairs(vfs) do
- if vf['label'] == label then
+ if vf["label"] == label then
table.remove(vfs, i)
- mp.set_property_native('vf', vfs)
+ mp.set_property_native("vf", vfs)
return true
end
end
@@ -77,21 +77,21 @@ end
function do_crop()
-- get the metadata
local cropdetect_metadata = mp.get_property_native(
- string.format('vf-metadata/%s', cropdetect_label)
+ string.format("vf-metadata/%s", cropdetect_label)
)
-- use it to crop if its valid
if cropdetect_metadata then
- if cropdetect_metadata['lavfi.cropdetect.w']
- and cropdetect_metadata['lavfi.cropdetect.h']
- and cropdetect_metadata['lavfi.cropdetect.x']
- and cropdetect_metadata['lavfi.cropdetect.y']
+ if cropdetect_metadata["lavfi.cropdetect.w"]
+ and cropdetect_metadata["lavfi.cropdetect.h"]
+ and cropdetect_metadata["lavfi.cropdetect.x"]
+ and cropdetect_metadata["lavfi.cropdetect.y"]
then
- mp.command(string.format('vf add @%s:crop=%s:%s:%s:%s',
+ mp.command(string.format("vf add @%s:crop=%s:%s:%s:%s",
crop_label,
- cropdetect_metadata['lavfi.cropdetect.w'],
- cropdetect_metadata['lavfi.cropdetect.h'],
- cropdetect_metadata['lavfi.cropdetect.x'],
- cropdetect_metadata['lavfi.cropdetect.y']))
+ cropdetect_metadata["lavfi.cropdetect.w"],
+ cropdetect_metadata["lavfi.cropdetect.h"],
+ cropdetect_metadata["lavfi.cropdetect.x"],
+ cropdetect_metadata["lavfi.cropdetect.y"]))
else
mp.msg.error(
"Got empty crop data. You might need to increase detect_seconds."
diff --git a/TOOLS/lua/drc-control.lua b/TOOLS/lua/drc-control.lua
index 17e9f370f9..4e1ff396e5 100644
--- a/TOOLS/lua/drc-control.lua
+++ b/TOOLS/lua/drc-control.lua
@@ -21,17 +21,17 @@ script_name=mp.get_script_name()
function print_state(params)
if params then
- mp.osd_message(script_name..':\n'
- .."method = "..params['method'].."\n"
- .."target = "..params['target'])
+ mp.osd_message(script_name..":\n"
+ .."method = "..params["method"].."\n"
+ .."target = "..params["target"])
else
- mp.osd_message(script_name..':\noff')
+ mp.osd_message(script_name..":\noff")
end
end
function get_index_of_drc(afs)
for i,af in pairs(afs) do
- if af['label']==script_name then
+ if af["label"]==script_name then
return i
end
end
@@ -46,30 +46,30 @@ function append_drc(afs)
target="0.25"
}
}
- print_state(afs[#afs]['params'])
+ print_state(afs[#afs]["params"])
end
function modify_or_create_af(fun)
- afs=mp.get_property_native('af')
+ afs=mp.get_property_native("af")
i=get_index_of_drc(afs)
if not i then
append_drc(afs)
else
fun(afs,i)
end
- mp.set_property_native('af',afs)
+ mp.set_property_native("af",afs)
end
function drc_toggle_method_handler()
modify_or_create_af(
function (afs,i)
- new_method=(afs[i]['params']['method']+1)%3
+ new_method=(afs[i]["params"]["method"]+1)%3
if new_method==0 then
table.remove(afs,i)
print_state(nil)
else
- afs[i]['params']['method']=tostring((afs[i]['params']['method'])%2+1)
- print_state(afs[i]['params'])
+ afs[i]["params"]["method"]=tostring((afs[i]["params"]["method"])%2+1)
+ print_state(afs[i]["params"])
end
end
)
@@ -78,8 +78,8 @@ end
function drc_scale_target(factor)
modify_or_create_af(
function (afs)
- afs[i]['params']['target']=tostring(afs[i]['params']['target']*factor)
- print_state(afs[i]['params'])
+ afs[i]["params"]["target"]=tostring(afs[i]["params"]["target"]*factor)
+ print_state(afs[i]["params"])
end
)
end