diff options
author | Piotr Dobrowolski <admin@tastycode.pl> | 2017-01-08 17:17:43 +0100 |
---|---|---|
committer | Piotr Dobrowolski <admin@tastycode.pl> | 2017-01-08 17:17:43 +0100 |
commit | a8d82e060066a78792786693cbf5a1188dad6ee0 (patch) | |
tree | 08de443e55a38c1394ce42d8cc46b2146594c415 | |
parent | 1496814f1b399e7dde97fb4e0da3f7a463bded03 (diff) | |
download | love2d-signage-a8d82e060066a78792786693cbf5a1188dad6ee0.tar.gz love2d-signage-a8d82e060066a78792786693cbf5a1188dad6ee0.tar.bz2 love2d-signage-a8d82e060066a78792786693cbf5a1188dad6ee0.tar.xz love2d-signage-a8d82e060066a78792786693cbf5a1188dad6ee0.zip |
Fix weather formatting and parsing
-rw-r--r-- | screens/weather.lua | 6 | ||||
-rw-r--r-- | screens/weather_thread.lua | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/screens/weather.lua b/screens/weather.lua index 9af7eaf..779ff10 100644 --- a/screens/weather.lua +++ b/screens/weather.lua @@ -31,16 +31,16 @@ function node.render() if weatherGlyphs[state.weather] then love.graphics.setFont(weatherFont) - love.graphics.print(weatherGlyphs[state.weather], 150, 0) + love.graphics.print(weatherGlyphs[state.weather], 150, 35) end love.graphics.setFont(textFont) - love.graphics.printf(tostring(state.temperature) .. "°", 600, 180, 650, 'center') + love.graphics.printf(tostring(state.temperature) .. "°", 600, 150, 650, 'center') love.graphics.setFont(smallFont) love.graphics.printf(os.date("Last update: %Y/%m/%d %H:%M", state.lastUpdate), 0, love.graphics.getHeight() - 60, love.graphics.getWidth(), 'center') if state.insideTemperature then - love.graphics.printf("Room: " .. state.insideTemperature .. "° / " .. state.insideHumidity .. "%RH", 0, love.graphics.getHeight() - 100, love.graphics.getWidth(), 'center') + love.graphics.printf("Room: " .. tostring(state.insideTemperature) .. "° / " .. tostring(state.insideHumidity) .. "%RH", 0, love.graphics.getHeight() - 100, love.graphics.getWidth(), 'center') end else love.graphics.setColor( 255, 255, 255, 80 ) diff --git a/screens/weather_thread.lua b/screens/weather_thread.lua index 8c3e9f4..4a627be 100644 --- a/screens/weather_thread.lua +++ b/screens/weather_thread.lua @@ -12,7 +12,7 @@ if c == 200 then local r, c, h = http.request(insideURL) if c == 200 then - for n in string.gmatch(string.gsub(r, ",", "."), ":(%S+)[*%%]") do + for n in string.gmatch(string.gsub(r, ",", "."), ":%s*(%S+)[*%%]") do insideData[#insideData+1] = n end end |