module(..., package.seeall) -- Load libraries require("modelfunctions") fs = require("acf.fs") -- ################################################################################ -- SET VARIABLES local packagename="vlc-daemon" local packagename="vlc" local processname="vlc" local configfile = "/etc/conf.d/"..tostring(processname) local logfile = "/var/log/vlc/vlc.log" function set_processname(p) processname = p configfile = "/etc/conf.d/"..tostring(processname) end -- ################################################################################ -- LOCAL FUNCTIONS -- ################################################################################ -- PUBLIC FUNCTIONS function get_startstop(self, clientdata) return modelfunctions.get_startstop(processname) end function startstop_service(self, startstop, action) return modelfunctions.startstop_service(startstop, action) end function getstatus() return modelfunctions.getstatus(processname, packagename, tostring(processname).." Status") end function getconfigfile() -- FIXME Validate return modelfunctions.getfiledetails(configfile) end function get_filedetails() local path=logfile local path2 if fs.is_file(configfile) then for line in string.gmatch(fs.read_file(configfile) or "", "(.-)\n") do path2=string.match(line,"^VLC_OPTS.*--logfile%s+(%S+)") or path2 end end if path2 then path=path2 end return modelfunctions.getfiledetails(path) end function setconfigfile(self, filedetails) -- FIXME Validate return modelfunctions.setfiledetails(self, filedetails, {configfile}) end function getleases() return modelfunctions.getfiledetails(leasefile) end