diff options
Diffstat (limited to 'dalos-cd.lua')
-rw-r--r-- | dalos-cd.lua | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/dalos-cd.lua b/dalos-cd.lua index cb0b6a7..fc1ae3d 100644 --- a/dalos-cd.lua +++ b/dalos-cd.lua @@ -47,3 +47,48 @@ dalosp.cd = { dalos.cd = dalosp.cd.create dalos:register_obj("CD", dalos.cd, "Basic Inputs") + +dalosp.dvd = { + get_settings = function (self) + return { filename = self.extra.filename } + end, + + configure = function (self) + local dlg = iup.filedlg { + dialogtype = "Open", + file = self.extra.filename, + } + iup.Popup(dlg) + if dlg.status ~= -1 then + local s, v = pcall(dvdabstract, dlg.value) + if s then + self:set_houtput(v) + return + end + end + self:set_houtput(nil) + end, + + create = function (d, tab, settings) + tab.ninputs = 0 + tab.noutputs = 1 + tab.otype = dalos.objtype.HANDLE + tab.configure = dalosp.dvd.configure + tab.default_name = "DVD" + tab.ntype = "DVD" + tab.get_settings = dalosp.dvd.get_settings + local extra = { drives_list = cdprobe() } + if settings then extra.filename = settings.filename end + local obj = dalos.object(d, tab, extra) + + if extra.filename then + local s, v = pcall(cdabstract, extra.filename) + if s then obj:set_houtput(v) end + end + + return obj + end, +} + +dalos.dvd = dalosp.dvd.create +dalos:register_obj("DVD", dalos.dvd, "Basic Inputs") |