--[[ Heizölpreise Plugin lua v0.5 Copyright (C) 2018, Jacek Jendrzej 'satbaby' License: GPL This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. ]] local hop={} local top={} n = neutrino() local FontMenu = FONT.MENU local FontTitle = FONT.MENU_TITLE local conf = {} function loadConfig() local Nconfig = configfile.new() Nconfig:loadConfig("/var/tuxbox/config/neutrino.conf") conf.corner_on = Nconfig:getInt32("rounded_corners", 0) conf.corner_large = 0 conf.corner_top = 0 conf.corner_bottom = 0 conf.select = 0 if conf.corner_on then conf.corner_large = CORNER.RADIUS_LARGE conf.corner_top = (CORNER.TOP_LEFT + CORNER.TOP_RIGHT) conf.corner_bottom = (CORNER.BOTTOM_LEFT + CORNER.BOTTOM_RIGHT) end end -- character table string local b='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' -- decode function dec(data) data = string.gsub(data, '[^'..b..'=]', '') return (data:gsub('.', function(x) if (x == '=') then return '' end local r,f='',(b:find(x)-1) for i=6,1,-1 do r=r..(f%2^i-f%2^(i-1)>0 and '1' or '0') end return r; end):gsub('%d%d%d?%d?%d?%d?%d?%d?', function(x) if (#x ~= 8) then return '' end local c=0 for i=1,8 do c=c+(x:sub(i,i)=='1' and 2^(8-i) or 0) end return string.char(c) end)) end function decodeImage(b64Image) local imgTyp = b64Image:match("data:image/(.-);base64,") local repData = "data:image/" .. imgTyp .. ";base64," local b64Data = string.gsub(b64Image, repData, ""); local tmpImg = os.tmpname() local retImg = tmpImg .. "." .. imgTyp local f = io.open(retImg, "w+") f:write(dec(b64Data)) f:close() os.remove(tmpImg) return retImg end function getdata(Url,outputfile) if Url == nil then return nil end if Curl == nil then Curl = curl.new() end if Url:sub(1, 2) == '//' then Url = 'http:' .. Url end local ret, data = Curl:download{url=Url,A="Mozilla/5.0;",maxRedirs=5,followRedir=true,o=outputfile } if ret == CURL.OK then if outputfile then return 1 end return data else return nil end end function make_tab(tab,data,patern,count) local k = 0 for td in data:gmatch("<" .. patern ..".->(.-" .. patern ..">)") do local aa= td:match('