- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
/I_MythTVFrontend1.xml
r1 r3 47 47 local MYTH_FRONTEND_SEND_ACTION_CMD = "http://%s/Frontend/SendAction?Action=%s" 48 48 local MYTH_FRONTEND_GET_STATUS_CMD = "http://%s/Frontend/GetStatus" 49 local MYTH_FRONTEND_GET_SCREENSHOT_CMD = "http://%s/MythFE/GetScreenShot?format=jpg& width=%d"49 local MYTH_FRONTEND_GET_SCREENSHOT_CMD = "http://%s/MythFE/GetScreenShot?format=jpg&width=%d" 50 50 51 51 local FRONTEND_SERVICE = "urn:mythttv-org:serviceId:Frontend1" 52 local HADEVICE_SID = "urn:micasaverde-com:serviceId:HaDevice1" 52 53 local PARENT_DEVICE 53 54 … … 129 130 end 130 131 132 local function toboolean(v) 133 return (type(v) == "string" and v == "true") or (type(v) == "number" and v ~= 0) or (type(v) == "boolean" and v) 134 end 135 131 136 function mythfrontendPoll() 132 137 local resp = cmdGetStatus() … … 136 141 137 142 function mythfrontendRefreshPoll() 138 local pollingEnabled = luup.variable_get(HADEVICE_SID, "PollingEnabled", PARENT_DEVICE)139 local pollMinDelay = luup.variable_get(HADEVICE_SID, "PollMinDelay", PARENT_DEVICE)143 local pollingEnabled = toboolean(luup.variable_get(HADEVICE_SID, "PollingEnabled", PARENT_DEVICE)) 144 local pollMinDelay = tonumber(luup.variable_get(HADEVICE_SID, "PollMinDelay", PARENT_DEVICE), 10) 140 145 mythfrontendLog("PollingEnabled=" .. tostring(pollingEnabled) .. ", PollMinDelay=" .. tostring(pollMinDelay) ) 141 146 if (pollingEnabled) then … … 158 163 159 164 -- make sure we have the polling defined 160 local pollingEnabled = luup.variable_get(HADEVICE_SID, "PollingEnabled", PARENT_DEVICE)161 local pollMinDelay = luup.variable_get(HADEVICE_SID, "PollMinDelay", PARENT_DEVICE)162 163 if (pollMinDelay == nil or type(pollMinDelay) ~= "number") then165 local pollingEnabled = toboolean(luup.variable_get(HADEVICE_SID, "PollingEnabled", PARENT_DEVICE)) 166 local pollMinDelay = tonumber(luup.variable_get(HADEVICE_SID, "PollMinDelay", PARENT_DEVICE), 10) 167 168 if (pollMinDelay == nil) then 164 169 luup.variable_set(HADEVICE_SID, "PollMinDelay", 60, PARENT_DEVICE) 165 170 end 166 171 167 if (pollingEnabled == nil or type(pollMinDelay) ~= "boolean") then168 -- according to spec and to bypass bug #0002058, use 1 instead of true169 luup.variable_set(HADEVICE_SID, "PollingEnabled", 1, PARENT_DEVICE)170 end172 if (pollingEnabled == nil) then 173 luup.variable_set(HADEVICE_SID, "PollingEnabled", "true", PARENT_DEVICE) 174 end 175 mythfrontendLog("PollingEnabled=" .. tostring(pollingEnabled) .. ", PollMinDelay=" .. tostring(pollMinDelay) ) 171 176 -- 172 177 -- Avoid blocking startup 173 178 -- 174 luup.call_delay("mythfrontendPoll", 5) 179 if (pollingEnabled) then 180 luup.call_delay("mythfrontendPoll", 5) 181 end 175 182 return true, "Good to go", "MythFrontend" 176 183 end
Note: See TracChangeset
for help on using the changeset viewer.