Created
December 18, 2016 15:30
-
-
Save Informatic/29485b32f1df36ab1d113306926309ed to your computer and use it in GitHub Desktop.
MagicLantern continuous recording Lua replacement (for Canon 500D, seems to work fine for me)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- starts movie recording after a delay | |
contrec_running = false | |
contrec_stop = false | |
contrec_countdown = 0 | |
function contrec_main() | |
if contrec_running then contrec_stop = true return end | |
if camera.mode == MODE.MOVIE and movie.recording == false and contrec_menu.submenu["Delay Amount"].value > 0 then | |
contrec_running = true | |
contrec_stop = false | |
local i | |
for i = contrec_menu.submenu["Delay Amount"].value, 0, -1 do | |
contrec_countdown = i | |
if menu.visible then | |
display.notify_box(string.format("Movie Start in %ds", i)) | |
-- else we'll just let lvinfo item take care of notification | |
end | |
task.yield(1000) | |
if movie.recording or contrec_stop then | |
display.notify_box(string.format("Movie Start Canceled", i)) | |
contrec_running = false | |
contrec_stop = false | |
return | |
end | |
end | |
movie.start() | |
if contrec_menu.submenu["Stop After"].value > 0 then | |
for i = contrec_menu.submenu["Stop After"].value, 0, -1 do | |
contrec_countdown = -i | |
task.yield(1000) | |
if movie.recording == false or contrec_stop then | |
display.notify_box(string.format("Movie Stop Canceled", i)) | |
contrec_running = false | |
contrec_stop = false | |
return | |
end | |
end | |
if movie.recording then movie.stop() end | |
else | |
while not contrec_stop do | |
task.yield(1000) | |
if movie.recording == false then | |
movie.start() | |
display.notify_box("Restarted.") | |
end | |
end | |
end | |
contrec_running = false | |
end | |
end | |
contrec_menu = menu.new | |
{ | |
parent = "Movie", | |
name = "Continuous recording", | |
help = "Start movie recording after a delay, and then restart when it stops", | |
help2 = "Use SET to start or cancel the delay", | |
submenu = | |
{ | |
{ | |
name = "Run", | |
help = "Start the delay count down now", | |
help2 = "You can also use SET to start or cancel the delay", | |
run_in_separate_task = true, | |
select = contrec_main | |
}, | |
{ | |
name = "Delay Amount", | |
min = 0, | |
max = 600, | |
unit = UNIT.TIME, | |
update = function(this) contrec_menu.value = this.value end, | |
}, | |
{ | |
name = "Stop After", | |
min = 0, | |
max = 1800, | |
unit = UNIT.TIME | |
} | |
} | |
} | |
event.keypress = function(key) | |
if key == KEY.SET and camera.mode == MODE.MOVIE and menu.visible == false then | |
if contrec_running then | |
contrec_stop = true | |
elseif contrec_menu.submenu["Delay Amount"].value > 0 then | |
display.notify_box("Movie Start Trggered") | |
task.create(contrec_main) | |
end | |
end | |
end | |
lv.info | |
{ | |
name = "Delayed Start Info", | |
value = "", | |
priority = 100, | |
update = function(this) | |
if contrec_running then | |
this.background = COLOR.RED | |
this.foreground = COLOR.WHITE | |
if contrec_countdown > 0 then | |
this.value = string.format("Start in %ds",contrec_countdown) | |
else | |
this.value = string.format("Stop in %ds",-contrec_countdown) | |
end | |
else | |
this.value = "" | |
end | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment