@Didier-T j'ai repris ton conky et ton meteo.lua pour faire un test et toujours pas de résultat.
conkyrc
# -- Conky settings -- #
background yes
update_interval 1
cpu_avg_samples 2
net_avg_samples 2
override_utf8_locale yes
double_buffer yes
no_buffers yes
text_buffer_size 2048
# -- Window specifications -- #
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
border_inner_margin 0
border_outer_margin 0
minimum_size 280 100
maximum_width 310
alignment tm
gap_x 0
gap_y 20
# -- Graphics settings -- #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
# -- Text settings -- #
use_xft yes
xftfont MaiandraGD:size=24
xftalpha 0.4
uppercase no
default_color 8b8b8b
# -- Declaration template -- #
template0 ${image ~/Meteo_lua/conky/script/images/\1 -p \2 -s \3} # -- images fond -- #
template1 ${lua Meteo_\1 \2 \3 \4 \5} # -- gestion météo --#
template2 ${lua_parse Meteo_\1 \2 \3 \4 60 \5} # -- icones météo -- \2=repertoir icones \3=position \4=taille \5=jour (pour les prévisions) #
template3 ${lua Lune_\1}
lua_load ~/Meteo_lua/conky/script/meteo.lua
TEXT
#### Lancement du script récupérant les données météo ####
${template1 Maj http://www.accuweather.com/fr/fr/argenteuil/133593 5 1800 /tmp}
#### Premier cadre ####
##### Heure #####
${voffset -16}${font LED_mono :style=Medium:size=60}${color 434343}${goto 30}${time %H}${goto 140}${time %M}${font LED_mono :size=25:style=Medium}${color 808080}${goto 235}${time %S}
##### Date #####
${voffset 8}${color yellow}${font URW Chancery L:style=Bold:size=18}${alignc}${exec date "+%A %d %B %Y"|sed 's/^.\| [a-z]/\U&/g'}
##### ville #####
${voffset -10}${goto 5}${color ffe595}${template1 Ville}
##### température actuelle #####
${voffset -10}${goto 15}${font URW Chancery L:style=Bold:size=30}${if_match ${template1 TempAct}<5}${color lightblue}${blink ${template1 TempAct}°}${else}${color white}${template1 TempAct}°${endif}
##### Affichage conditions météo #####
${voffset -25}${font URW Chancery L:style=Bold:size=12}${color white}${alignc}${template1 CondMeteo}
##### Affichage infos vent ######
${voffset -60}${color ffe595}${font Helvetica LT Std:style=Bold:size=10}${alignr}${template1 VentDirP}
${color ffe595}${font Helvetica LT Std:style=Bold:size=10}${goto 200}${template1 VentForce} km/h
#### Second cadre ####
##### Affichage Probabilité de précipitations Jour/Nuit #####
${voffset 47}${color lightwhite}${font Helvetica LT Std:style=Bold:size=10}${goto 40}${template1 Jour_ProbOrage 1}${goto 220}${template1 Nuit_ProbOrage 1}
##### Affichage temperature #####
${voffset 7}${goto 75}${template1 Jour_Temp 1}°${goto 250}${template1 Nuit_Temp 1}°
##### Affichage conditions météo #####
${voffset -8}${font Bitstream Vera Sans Mono:style=condensed:size=6}${color grey} ${template1 Jour_CondMeteo1 1}${goto 170} ${template1 Nuit_CondMeteo1 1}
${template1 Jour_CondMeteo2 1}${goto 170} ${template1 Nuit_CondMeteo2 1}
##### Affichage lunaison #####
${voffset -65}${font URW Chancery L:style=Bold:size=10}${color FEEFEF}${alignc}${template3 ephemerides1}
${voffset -5}${alignc}${template3 ephemerides2}
#### troisieme cadre ####
${voffset 52}${font Ubuntu :size=10:style=bold}${color lightwhite}${goto 35}${template1 Jour_ProbOrage 2}${goto 105}${template1 Jour_ProbOrage 3}${goto 170}${template1 Jour_ProbOrage 4}${goto 235}${template1 Jour_ProbOrage 5}
##### Affichage temperature #####
${voffset 14}${goto 27}${font Ubuntu :size=10:style=bold}${color red}${template1 Jour_Temp 2}°${color white}/${color lightblue}${template1 Nuit_Temp 2}°${goto 97}${color red}${template1 Jour_Temp 3}°${color white}/${color lightblue}${template1 Nuit_Temp 3}°${goto 167}${color red}${template1 Jour_Temp 4}°${color white}/${color lightblue}${template1 Nuit_Temp 4}°${goto 237}${color red}${template1 Jour_Temp 5}°${color white}/${color lightblue}${template1 Nuit_Temp 5}°
##### Affichage vitesse du vent #####
${voffset 8}${font Ubuntu :size=9:style=bold}${color ffe595}${goto 27}${template1 Jour_VentForce 2}${font Ubuntu :size=6:style=bold} km/h${goto 97}${voffset -4}${font Ubuntu :size=9:style=bold}${template1 Jour_VentForce 3}${font Ubuntu :size=6:style=bold} km/h${goto 167}${voffset -4}${font Ubuntu :size=9:style=bold}${template1 Jour_VentForce 4}${font Ubuntu :size=6:style=bold} km/h${goto 237}${voffset -4}${font Ubuntu :size=9:style=bold}${template1 Jour_VentForce 5}${font Ubuntu :size=6:style=bold} km/h
#### quatrième cadre ####
##### Heure mise à jour #####
${voffset 40}${font URW Chancery L:style=Bold:size=16}${alignc}Dernière mise à jour : ${template1 Heure}h${template1 Minute}
#### Affichage des cadres utilisés dans le conky ####
${voffset -935}
#### premier cadre ####
${template0 base.png 0,40 280x170}
${template0 flip_bg.png 24,10 100x100}
${template0 flip_bg.png 134,10 100x100}
#### Second cadre ####
${template0 base.png 0,245 280x50}
#### troisieme cadre ####
${template0 base.png 0,320 280x40}
${template0 base180.png 0,358 280x40}
#### quatrieme cadre ####
${template0 base1.png 0,420 280x30}
#### icones premier cadre ####
${template2 IconeM ~/Meteo_lua/conky/meteo+lune/icones/base 74,120 132x79}
${template2 IconeV ~/Meteo_lua/conky/meteo+lune/icones/base/vent 235,130 44x44}
#### icones Second cadre ####
${template2 Jour_IconeM ~/Meteo_lua/conky/meteo+lune/icones/base -15,205 132x79 1}
${template2 Nuit_IconeM ~/Meteo_lua/conky/meteo+lune/icones/base 160,205 132x79 1}
${image /tmp/lune.png -p 111,210 -s 63x63 -f 60}
#### icones troisieme cadre ####
${template2 Jour_IconeM ~/Meteo_lua/conky/meteo+lune/icones/base 0,295 86x52 2}
${template2 Jour_IconeM ~/Meteo_lua/conky/meteo+lune/icones/base 68,295 86x52 3}
${template2 Jour_IconeM ~/Meteo_lua/conky/meteo+lune/icones/base 133,295 86x52 4}
${template2 Jour_IconeM ~/Meteo_lua/conky/meteo+lune/icones/base 200,295 86x52 5}
${template2 Jour_IconeV ~/Meteo_lua/conky/meteo+lune/icones/base/vent 0,344 30x30 2}
${template2 Jour_IconeV ~/Meteo_lua/conky/meteo+lune/icones/base/vent 70,344 30x30 3}
${template2 Jour_IconeV ~/Meteo_lua/conky/meteo+lune/icones/base/vent 140,344 30x30 4}
${template2 Jour_IconeV ~/Meteo_lua/conky/meteo+lune/icones/base/vent 210,344 30x30 5}
${template2 Nuit_IconeM ~/Meteo_lua/conky/meteo+lune/icones/base 0,375 86x52 2}
${template2 Nuit_IconeM ~/Meteo_lua/conky/meteo+lune/icones/base 68,375 86x52 3}
${template2 Nuit_IconeM ~/Meteo_lua/conky/meteo+lune/icones/base 133,375 86x52 4}
${template2 Nuit_IconeM ~/Meteo_lua/conky/meteo+lune/icones/base 200,375 86x52 5}
meteo.lua
-- Créé par Didier-T (forum.ubuntu-fr.org)
-- Nécessite imagemagique
require "io"
function lune(r)
s = "${exec wget -q -O "..r.."/cal_lunaire http://www.calendrier-lunaire.net/}"
conky_parse( s )
local file = assert(io.open(r..'/cal_lunaire', "rb") )
local line = file:read()
for line in file:lines() do
local pos1 = string.find(line, '">')
local pos2 = string.find(line, "</", pos1)
if string.find(line, "ephemerides_1") ~= nil then
pos1 = string.find(line, 'src="')
pos2 = string.find(line, '" /')
s = "${exec wget -q -O "..r.."/lune.png http://www.calendrier-lunaire.net/"..string.sub(line, pos1+5, pos2-1).."}"
conky_parse( s )
conky_parse( "${exec convert "..r.."/lune.png -transparent '#091a2a' "..r.."/lune.png}" )
elseif string.find(line, "<h2>") ~= nil then
ephemerides1 = string.sub(line, pos1+2, pos2-1)
local pos3 = string.find(line, 'n>', pos2)
local pos4 = string.find(line, "</", pos2+3)
ephemerides2 = string.sub(line, pos3+3, pos4-1)
ephemerides = ephemerides1.." "..ephemerides2
elseif string.find(line, "Visibilit") ~= nil then
Visibilite = string.sub(line, pos1+2, pos2-3)
elseif string.find(line, "Phases") ~= nil then
Phases = string.gsub(string.sub(line, pos1+2, pos2-1), "é", "é")
local pos3 = string.find(Phases, ',')
Phases1 = string.sub(Phases, 0, pos3-1)
Phases2 = string.sub(Phases, pos3+2)
elseif string.find(line, "Noeud lunaire") ~= nil then
local a = string.gsub(string.sub(line, pos1+2, pos2-1), "Dans ", "")
Noeud_lunaire = string.gsub(a, " Jours", "")
elseif string.find(line, "Apog") ~= nil then
local a = string.gsub(string.sub(line, pos1+2, pos2-1), "Dans ", "")
Apogee = string.gsub(a, " Jours", "")
elseif string.find(line, "Perig") ~= nil then
local a = string.gsub(string.sub(line, pos1+2, pos2-1), "Dans ", "")
Perigee = string.gsub(a, " Jours", "")
elseif string.find(line, "Distance") ~= nil then
Distance = string.sub(line, pos1+2, pos2-4)
elseif string.find(line, "Age de la Lune") ~= nil then
Age = string.sub(line, pos1+2, pos2-1)
elseif string.find(line, "La Lune se") ~= nil then
local a = string.sub(line, pos1+2, pos2-1)
pos3 = string.find(a, ":")
Lever_LuneHeure = string.sub(a, 0, pos3-1)
Lever_LuneMinute = string.sub(a, pos3+1)
local pos3 = string.find(line, '">', pos2)
local pos4 = string.find(line, "</", pos3+3)
a = string.sub(line, pos3+2, pos4-1)
local pos5 = string.find(a, ":")
Coucher_LuneHeure = string.sub(a, 0, pos5-1)
Coucher_LuneMinute = string.sub(a, pos5+1)
elseif string.find(line, "eclipse_partielle") ~= nil then
local pos3 = string.find(line, '">', pos1+3)
local a = string.gsub(string.sub(line, pos3+2, pos2-1), "<br />", "à")
Eclipse_partielle = a
elseif string.find(line, "eclipse_totale") ~= nil then
local pos3 = string.find(line, '">', pos1+3)
local a = string.gsub(string.sub(line, pos3+2, pos2-1), "<br />", "à")
Eclipse_total = a
end
end
io.close(file)
end
function test_image(i)
if i == "1" then
return "1su.png"
elseif i == "2" then
return "2msu.png"
elseif i == "3" then
return "3psu.png"
elseif i == "4" then
return "4ic.png"
elseif i == "5" then
return "5h.png"
elseif i == "6" then
return "6mc.png"
elseif i == "7" then
return "7c.png"
elseif i == "8" then
return "8d.png"
elseif i == "11" then
return "9f.png"
elseif i == "12" then
return "10s.png"
elseif i == "13" then
return "11mcs.png"
elseif i == "14" then
return "12psus.png"
elseif i == "15" then
return "13t.png"
elseif i == "16" then
return "14mct.png"
elseif i == "17" then
return "15psut.png"
elseif i == "18" then
return "16r.png"
elseif i == "19" then
return "17fl.png"
elseif i == "20" then
return "18mcfl.png"
elseif i == "21" then
return "19psfl.png"
elseif i == "22" then
return "20sn.png"
elseif i == "23" then
return "21mcsn.png"
elseif i == "24" then
return "22i.png"
elseif i == "25" then
return "23sl.png"
elseif i == "26" then
return "24fr.png"
elseif i == "29" then
return "25rsn.png"
elseif i == "30" then
return "27ho.png"
elseif i == "31" then
return "28co.png"
elseif i == "32" then
return "26w.png"
elseif i == "33" then
return "29cl.png"
elseif i == "34" then
return "31mcl.png"
elseif i == "35" then
return "32pc.png"
elseif i == "36" then
return "33ic.png"
elseif i == "37" then
return "34h.png"
elseif i == "38" then
return "35mc.png"
elseif i == "39" then
return "36pcs.png"
elseif i == "40" then
return "37mcs.png"
elseif i == "41" then
return "38pct.png"
elseif i == "42" then
return "39mct.png"
elseif i == "43" then
return "40mcfl.png"
elseif i == "44" then
return "41mcsn.png"
end
end
function direction_vent(i)
if i == "Calme" then
return 0
elseif i == "N" then
return 10
elseif i == "NNE" then
return 11
elseif i == "NE" then
return 12
elseif i == "ENE" then
return 13
elseif i == "E" then
return 14
elseif i == "ESE" then
return 15
elseif i == "SE" then
return 16
elseif i == "SSE" then
return 17
elseif i == "S" then
return 2
elseif i == "SSO" then
return 3
elseif i == "SO" then
return 4
elseif i == "OSO" then
return 5
elseif i == "O" then
return 6
elseif i == "ONO" then
return 7
elseif i == "NO" then
return 8
elseif i == "NNO" then
return 9
else
return 1
end
end
function vent_plein(d)
local b
if string.len(d) == 1 then
if string.find(d, "N") ~= nil then
b = string.gsub(d, "N", "Nord")
elseif string.find(d, "S") ~= nil then
b = string.gsub(d, "S", "Sud")
elseif string.find(d, "E") ~= nil then
b = string.gsub(d, "E", "Est")
elseif string.find(d, "O") ~= nil then
b = string.gsub(d, "O", "Ouest")
end
else
b = d
end
return b
end
function icone_vent(d, fo)
local f = tonumber(fo)
local n
if f <= 25 then
n = d
elseif f <= 50 then
n = d + 17
elseif f <= 75 then
n = d + 34
elseif f >= 76 then
n = d + 51
end
if n <= 9 then
n = "0"..n
end
return n..".png"
end
function decoupage(d)
local l1, l2, n, p1, p2, n1, n2, l1b, l2b
if string.len(d) >= 21 then
n = math.ceil(string.len(d)/2)
p1 = string.find(d, " ", n)
p2 = string.find(d, " ", -n)
if p1 >= p2 then
l1b = string.sub(d, 1, p2-1)
l2b = string.sub(d, p2+1)
else
l1b = string.sub(d, 1, p1-1)
l2b = string.sub(d, p1+1)
end
else
l1b = d
l2b = " "
end
n1 = math.ceil((21 - string.len(l1b))/2)
l1 = string.rep(" ", n1)..l1b
n2 = math.ceil((21 - string.len(l2b))/2)
l2 = string.rep(" ", n2)..l2b
return l1, l2, l1b, l2b
end
function jour_court(j)
local ABJour1 = string.upper(string.sub(j, 1, 1)) --Majuscule
local ABJour2 = string.sub(j, 2, 3) -- 2 caractere suivant
local ABJour = ABJour1..ABJour2 -- jour abrege
return ABJour
end
function jour_n(a, j, x)
local pos3, iconej,Jour, CondMeteoj, CondMeteoj1, CondMeteoj2, Temp, TempjRes, Vent, VentDirj, VentForcej, iconev, VentP, Uv, ProbOrage, NivPrec, QPluie, QNeige, DPrecHeure, DPluieHeure, DPrecNuit, DPluieNuit, niconej, nCondMeteoj, nCondMeteoj1, nCondMeteoj2, nTemp, nTempjRes, nVent, nVentDirj, nVentForcej, niconev, nVentP, nUv, nProbOrage, nNivPrec, nQPluie, nQNeige, nDPrecHeure, nDPluieHeure, nDPrecMinute, nDPluieMinute, LeverSoleilHeure, CoucherSoleilHeure, LeverLuneHeure, CoucherLuneHeure, DureeJourHeure, DureeNuitHeure, LeverSoleilMinute, CoucherSoleilMinute, LeverLuneMinute, CoucherLuneMinute, DureeJourMinute, DureeNuitMinute, ABJour, CondMeteoj1se, CondMeteoj2se, nCondMeteoj1se, nCondMeteoj2se
local i = j+x
local s = '${exec wget -q --load-cookies '..Rep..'/cookie -O '..Rep..'/details'..j..' '..a..'details'..i..'.aspx}'
conky_parse( s )
local file = assert(io.open(Rep..'/details'..j, "rb") )
local line = file:read()
for line in file:lines() do
line = string.gsub(line, ",", ".")
local pos1 = string.find(line, '">', 40)
local pos2 = string.find(line, "</")
if string.find(line, "imgDayIcon") ~= nil then
pos1 = string.find(line, 'blue/')
pos2 = string.find(line, "_int")
iconej = test_image(string.sub(line, pos1+5, pos2-1))
elseif string.find(line, "lblDetails") ~= nil then
pos3 = string.find(line, "pour")
Jour = string.sub(line, pos3+5, pos2-1)
ABJour = jour_court(Jour) --jour abrege
elseif string.find(line, "lblDayText") ~= nil then
CondMeteoj = string.sub(line, pos1+2, pos2-1)
CondMeteoj1, CondMeteoj2, CondMeteoj1se, CondMeteoj2se = decoupage(CondMeteoj)
elseif string.find(line, "lblHighValue") ~= nil then Temp = string.sub(line, pos1+2, pos2-7)
elseif string.find(line, "lblRealFeelValue") ~= nil then TempjRes = string.sub(line, pos1+2, pos2-7)
elseif string.find(line, "lblWindsValue") ~= nil then
Vent = string.sub(line, pos1+2, pos2-1)
if Vent == "Calme" then
VentDirj = "Calme"
VentForcej = "0"
else
pos3 = string.find(Vent, " ")
VentDirj = string.gsub(string.sub(Vent, 1, pos3-1), "W", "O")
VentForcej = string.sub(Vent, pos3+1)
end
iconev = icone_vent(direction_vent(VentDirj), VentForcej)
VentP = vent_plein(VentDirj)
elseif string.find(line, "lblMaxUVValue") ~= nil then Uv = string.sub(line, pos1+2, pos2-1)
elseif string.find(line, "lblTStormProbValue") ~= nil then ProbOrage = string.sub(line, pos1+2, pos2-2)
elseif string.find(line, "lblPrecipValue") ~= nil then NivPrec = string.sub(line, pos1+2, pos2-1)
elseif string.find(line, "lblRainValue") ~= nil then QPluie = string.sub(line, pos1+2, pos2-1)
elseif string.find(line, "lblSnowValue") ~= nil then QNeige = string.sub(line, pos1+2, pos2-1)
elseif string.find(line, "lblHoursPrecipValue") ~= nil then
DPrecHeure = string.sub(line, pos1+2, pos2-8)
DPrecMinute = "00"
elseif string.find(line, "lblHoursOfRainValue") ~= nil then
DPluieHeure = string.sub(line, pos1+2, pos2-8)
DPluieMinute = "00"
elseif string.find(line, "imgNightIcon") ~= nil then
pos1 = string.find(line, 'blue/')
pos2 = string.find(line, "_int")
niconej = test_image(string.sub(line, pos1+5, pos2-1))
elseif string.find(line, "lblNightText") ~= nil then
nCondMeteoj = string.sub(line, pos1+2, pos2-1)
nCondMeteoj1, nCondMeteoj2, nCondMeteoj1se, nCondMeteoj2se = decoupage(nCondMeteoj)
elseif string.find(line, "lblLowValue") ~= nil then nTemp = string.sub(line, pos1+2, pos2-7)
elseif string.find(line, "lblRealFeelNValue") ~= nil then nTempjRes = string.sub(line, pos1+2, pos2-7)
elseif string.find(line, "lblWindsNValue") ~= nil then
nVent = string.sub(line, pos1+2, pos2-1)
if nVent == "Calme" then
nVentDirj = "Calme"
nVentForcej = "0"
else
pos3 = string.find(Vent, " ")
nVentDirj = string.gsub(string.sub(Vent, 1, pos3-1), "W", "O")
nVentForcej = string.sub(Vent, pos3+1)
end
niconev = icone_vent(direction_vent(VentDirj), VentForcej)
nVentP = vent_plein(VentDirj)
elseif string.find(line, "lblTStormProbNValue") ~= nil then nProbOrage = string.sub(line, pos1+2, pos2-2)
elseif string.find(line, "lblPrecipNValue") ~= nil then nNivPrec = string.sub(line, pos1+2, pos2-1)
elseif string.find(line, "lblRainNValue") ~= nil then nQPluie = string.sub(line, pos1+2, pos2-1)
elseif string.find(line, "lblSnowNValue") ~= nil then nQNeige = string.sub(line, pos1+2, pos2-1)
elseif string.find(line, "lblHoursPrecipNValue") ~= nil then
nDPrecHeure = string.sub(line, pos1+2, pos2-8)
nDPrecMinute = "00"
elseif string.find(line, "lblHoursOfRainNValue") ~= nil then
nDPluieHeure = string.sub(line, pos1+2, pos2-8)
nDPluieMinute = "00"
end
pos1 = string.find(line, ': ')
if string.find(line, "lblSunrise") ~= nil then
local a = string.sub(line, pos1+2, pos2-1)
pos3 = string.find(a, ":")
LeverSoleilHeure = string.sub(a, 0, pos3-1)
LeverSoleilMinute = string.sub(a, pos3+1)
elseif string.find(line, "lblSunset") ~= nil then
local a = string.sub(line, pos1+2, pos2-1)
pos3 = string.find(a, ":")
CoucherSoleilHeure = string.sub(a, 0, pos3-1)
CoucherSoleilMinute = string.sub(a, pos3+1)
elseif string.find(line, "lblMoonrise") ~= nil then
local a = string.sub(line, pos1+2, pos2-1)
pos3 = string.find(a, ":")
LeverLuneHeure = string.sub(a, 0, pos3-1)
LeverLuneMinute = string.sub(a, pos3+1)
elseif string.find(line, "lblMoonset") ~= nil then
local a = string.sub(line, pos1+2, pos2-1)
pos3 = string.find(a, ":")
CoucherLuneHeure = string.sub(a, 0, pos3-1)
CoucherLuneMinute = string.sub(a, pos3+1)
elseif string.find(line, "lblDaylight") ~= nil then
DureeJourHeure = string.sub(line, pos1+2, pos2-1)
DureeJourMinute = "00"
elseif string.find(line, "lblDarkness") ~= nil then
DureeNuitHeure = string.sub(line, pos1+2, pos2-1)
DureeNuitMinute = "00"
end
end
conditionJour[j] = { CondMeteo=CondMeteoj, Temp=Temp, TempRes=TempjRes, VentDir=VentDirj, VentForce=VentForcej, Uv=Uv, ProbOrage=ProbOrage, NivPrec=NivPrec, QPluie=QPluie, QNeige=QNeige, DPrecHeure=DPrecHeure, DPluieHeure=DPluieHeure, DPrecMinute=DPrecMinute, DPluieMinute=DPluieMinute, IconeM=iconej, IconeV=iconev, VentP=VentP, CondMeteo1=CondMeteoj1, CondMeteo2=CondMeteoj2, CondMeteo1se=CondMeteoj1se, CondMeteo2se=CondMeteoj2se }
conditionNuit[j] = { CondMeteo=nCondMeteoj, Temp=nTemp, TempRes=nTempjRes, VentDir=nVentDirj, VentForce=nVentForcej, ProbOrage=nProbOrage, NivPrec=nNivPrec, QPluie=nQPluie, QNeige=nQNeige, DPrecHeure=nDPrecHeure, DPluieHeure=nDPluieHeure, DPrecMinute=nDPrecMinute, DPluieMinute=nDPluieMinute, IconeM=niconej, IconeV=niconev, VentP=nVentP, CondMeteo1=nCondMeteoj1, CondMeteo2=nCondMeteoj2, CondMeteo1se=nCondMeteoj1se, CondMeteo2se=nCondMeteoj2se }
InfoJour[j] = { Jour=Jour, LeverSoleilHeure=LeverSoleilHeure, CoucherSoleilHeure=CoucherSoleilHeure, LeverLuneHeure=LeverLuneHeure, CoucherLuneHeure=CoucherLuneHeure, DureeJourHeure=DureeJourHeure, DureeNuitHeure=DureeNuitHeure, LeverSoleilMinute=LeverSoleilMinute, CoucherSoleilMinute=CoucherSoleilMinute, LeverLuneMinute=LeverLuneMinute, CoucherLuneMinute=CoucherLuneMinute, DureeJourMinute=DureeJourMinute, DureeNuitMinute=DureeNuitMinute, ABJour=ABJour }
io.close(file)
end
function conky_Meteo_Maj(cmd, jours, delais, r)
if t == nil then
local bar, bar1
local l = string.sub(cmd, 0, string.find(cmd, '/quick.')-1)
local a = 1
while bar == nil do
a = a+1
bar = string.find(l, '/', -a)
end
local l1 = string.sub(cmd, 0, bar-1)
local b = 1
while bar1 == nil do
b = b+1
bar1 = string.find(l1, '/', -b)
end
l = string.sub(cmd, bar1, string.find(cmd, '/quick.')-1)
Rep = r..l
if os.execute("cd "..Rep) ~= 0 then
os.execute("mkdir "..r..string.sub(cmd, bar1, bar-1))
os.execute("mkdir "..Rep)
end
t = os.time()-delais
start = 1
end
if tonumber(delais) <= os.difftime(os.time(), t) then
if os.execute("ping -c 1 www.google.com") == 0 then
Heure = nil
while Heure == nil do
local s = '${exec wget -q --save-cookies '..Rep..'/cookie -O '..Rep..'/curr_cond_raw '..cmd..'}'
local addr_week = string.sub(cmd, 0, string.find(cmd, 'quick.')-1)
conky_parse( s )
if not conditionJour then
conditionJour = {}
conditionNuit = {}
InfoJour= {}
end
local file = assert(io.open(Rep.."/curr_cond_raw", "rb") )
local line = file:read()
for line in file:lines() do
local pos1 = string.find(line, '">')
local pos2 = string.find(line, "</")
if string.find(line, "imgCurConCondition") ~= nil then
pos1 = string.find(line, 'blue/')
pos2 = string.find(line, "_int")
icone = test_image(string.sub(line, pos1+5, pos2-1))
elseif string.find(line, "lblRealFeelValue") ~= nil then TempRes = string.sub(line, pos1+2, pos2-7)
elseif string.find(line, "lblCurrentTemp") ~= nil then TempAct = string.sub(line, pos1+2, pos2-7)
elseif string.find(line, "lblCurrentTime") ~= nil then
local a = string.sub(line, pos1+2, pos2-1)
local pos3 = string.find(a, ":")
Heure = string.sub(a, 0, pos3-1)
Minute = string.sub(a, pos3+1)
elseif string.find(line, "lblCurrentText") ~= nil then
CondMeteo = string.sub(line, pos1+2, pos2-1)
CondMeteo1, CondMeteo2, CondMeteo1se, CondMeteo2se = decoupage(CondMeteo)
elseif string.find(line, "lblWindsValue") ~= nil then
local Vent = string.sub(line, pos1+2, pos2-1)
if Vent == "Calme" then
VentDir = "Calme"
VentForce = "0"
else
local pos3 = string.find(Vent, " ")
VentDir = string.gsub(string.sub(Vent, 1, pos3-1), "W", "O")
VentForce = string.sub(Vent, pos3+1, -6)
end
IconeV = icone_vent(direction_vent(VentDir), VentForce)
VentPlein = vent_plein(VentDir)
elseif string.find(line, "lblHumidityValue") ~= nil then Humidite = string.sub(line, pos1+2, pos2-2)
elseif string.find(line, "lblDewPointValue") ~= nil then Rose = string.sub(line, pos1+2, pos2-7)
elseif string.find(line, "lblPressureValue") ~= nil then Pression = string.sub(line, pos1+2, pos2-4)
elseif string.find(line, "lblPressureTenValue") ~= nil then EvoPression = string.sub(line, pos1+2, pos2-2)
elseif string.find(line, "lblVisibilityValue") ~= nil then Visibilite = string.sub(line, pos1+2, pos2-4)
elseif string.find(line, "lblSunRiseValue") ~= nil then
local a = string.sub(line, pos1+2, pos2-1)
local pos3 = string.find(a, ":")
LeverSoleilHeure = string.sub(a, 0, pos3-1)
LeverSoleilMinute = string.sub(a, pos3+1)
elseif string.find(line, "lblSunSetValue") ~= nil then
local a = string.sub(line, pos1+2, pos2-1)
local pos3 = string.find(a, ":")
CoucherSoleilHeure = string.sub(a, 0, pos3-1)
CoucherSoleilMinute = string.sub(a, pos3+1)
elseif string.find(line, "lblDate") ~= nil then Date = string.sub(line, pos1+2, pos2-1)
elseif string.find(line, "lnkLocation") ~= nil then
local pos3 = string.find(line, ",", pos1)
Ville = string.sub(line, pos1+2, pos3-1)
end
end
io.close(file)
t = os.time()
if 14400 <= os.difftime(os.time(), t) or start == 1 then
local Jour
local s = '${exec wget -q --load-cookies '..Rep..'/cookie -O '..Rep..'/details1 '..addr_week..'details1.aspx}'
conky_parse( s )
local file = assert(io.open(Rep..'/details1', "rb") )
local line = file:read()
for line in file:lines() do
line = string.gsub(line, ",", ".")
local pos1 = string.find(line, "pour", 40)
local pos2 = string.find(line, "</")
if string.find(line, "lblDetails") ~= nil then
Jour = string.sub(line, pos1+5, pos2-1)
end
end
io.close(file)
if Date == Jour then
for i = 1,jours do jour_n(addr_week, i, 0) end
else
for i = 1,jours do jour_n(addr_week, i, 1) end
end
start = 2
end
end
lune(r)
end
collectgarbage()
end
return " "
end
--Retour d'information météo
--Condition courrante
function conky_Meteo_IconeM(r, p, s, f)
return "${image "..r.."/"..icone.." -p "..p.." -s "..s.." -f "..f.."}"
end
function conky_Meteo_TempRes()
return tonumber(TempRes)
end
function conky_Meteo_TempAct()
return tonumber(TempAct)
end
function conky_Meteo_Heure()
return Heure
end
function conky_Meteo_Minute()
return Minute
end
function conky_Meteo_CondMeteo()
return CondMeteo
end
function conky_Meteo_CondMeteo1()
return CondMeteo1
end
function conky_Meteo_CondMeteo2()
return CondMeteo2
end
function conky_Meteo_CondMeteo1se()
return CondMeteo1se
end
function conky_Meteo_CondMeteo2se()
return CondMeteo2se
end
function conky_Meteo_VentDir()
return VentDir
end
function conky_Meteo_VentDirP()
return VentPlein
end
function conky_Meteo_VentForce()
return tonumber(VentForce)
end
function conky_Meteo_IconeV(r, p, s, f)
return "${image "..r.."/"..IconeV.." -p "..p.." -s "..s.." -f "..f.."}"
end
function conky_Meteo_Humidite()
return tonumber(Humidite)
end
function conky_Meteo_Rose()
return tonumber(Rose)
end
function conky_Meteo_Pression()
return tonumber(Pression)
end
function conky_Meteo_EvoPression()
return EvoPression
end
function conky_Meteo_Visibilite()
return tonumber(Visibilite)
end
function conky_Meteo_HLeverSoleilC()
return LeverSoleilHeure
end
function conky_Meteo_MLeverSoleilC()
return LeverSoleilMinute
end
function conky_Meteo_HCoucherSoleilC()
return CoucherSoleilHeure
end
function conky_Meteo_MCoucherSoleilC()
return CoucherSoleilMinute
end
function conky_Meteo_Date()
return Date
end
function conky_Meteo_Ville()
return Ville
end
--Prévision Météo
--Jour
function conky_Meteo_Jour_CondMeteo(j)
return conditionJour[tonumber(j)].CondMeteo
end
function conky_Meteo_Jour_CondMeteo1(j)
return conditionJour[tonumber(j)].CondMeteo1
end
function conky_Meteo_Jour_CondMeteo2(j)
return conditionJour[tonumber(j)].CondMeteo2
end
function conky_Meteo_Jour_CondMeteo1se(j)
return conditionJour[tonumber(j)].CondMeteo1se
end
function conky_Meteo_Jour_CondMeteo2se(j)
return conditionJour[tonumber(j)].CondMeteo2se
end
function conky_Meteo_Jour_Temp(j)
return tonumber(conditionJour[tonumber(j)].Temp)
end
function conky_Meteo_Jour_TempRes(j)
return tonumber(conditionJour[tonumber(j)].TempRes)
end
function conky_Meteo_Jour_VentDir(j)
return conditionJour[tonumber(j)].VentDir
end
function conky_Meteo_Jour_VentDirP(j)
return conditionJour[tonumber(j)].VentP
end
function conky_Meteo_Jour_VentForce(j)
return tonumber(conditionJour[tonumber(j)].VentForce)
end
function conky_Meteo_Jour_Uv(j)
return tonumber(conditionJour[tonumber(j)].Uv)
end
function conky_Meteo_Jour_ProbOrage(j)
return tonumber(conditionJour[tonumber(j)].ProbOrage)
end
function conky_Meteo_Jour_NivPrec(j)
return tonumber(conditionJour[tonumber(j)].NivPrec)
end
function conky_Meteo_Jour_QPluie(j)
return tonumber(conditionJour[tonumber(j)].QPluie)
end
function conky_Meteo_Jour_QNeige(j)
return tonumber(conditionJour[tonumber(j)].QNeige)
end
function conky_Meteo_Jour_HDureePrec(j)
return conditionJour[tonumber(j)].DPrecHeure
end
function conky_Meteo_Jour_MDureePrec(j)
return conditionJour[tonumber(j)].DPrecMinute
end
function conky_Meteo_Jour_HDureePluie(j)
return conditionJour[tonumber(j)].DPluieHeure
end
function conky_Meteo_Jour_MDureePluie(j)
return conditionJour[tonumber(j)].DPluieMinute
end
function conky_Meteo_Jour_IconeM(r, p, s, f, j)
return "${image "..r.."/"..conditionJour[tonumber(j)].IconeM.." -p "..p.." -s "..s.." -f "..f.."}"
end
function conky_Meteo_Jour_IconeV(r, p, s, f, j)
return "${image "..r.."/"..conditionJour[tonumber(j)].IconeV.." -p "..p.." -s "..s.." -f "..f.."}"
end
--Nuit
function conky_Meteo_Nuit_CondMeteo(j)
return conditionNuit[tonumber(j)].CondMeteo
end
function conky_Meteo_Nuit_CondMeteo1(j)
return conditionNuit[tonumber(j)].CondMeteo1
end
function conky_Meteo_Nuit_CondMeteo2(j)
return conditionNuit[tonumber(j)].CondMeteo2
end
function conky_Meteo_Nuit_CondMeteo1se(j)
return conditionNuit[tonumber(j)].CondMeteo1se
end
function conky_Meteo_Nuit_CondMeteo2se(j)
return conditionNuit[tonumber(j)].CondMeteo2se
end
function conky_Meteo_Nuit_Temp(j)
return tonumber(conditionNuit[tonumber(j)].Temp)
end
function conky_Meteo_Nuit_TempRes(j)
return tonumber(conditionNuit[tonumber(j)].TempRes)
end
function conky_Meteo_Nuit_VentDir(j)
return conditionNuit[tonumber(j)].VentDir
end
function conky_Meteo_Nuit_VentDirP(j)
return conditionNuit[tonumber(j)].VentP
end
function conky_Meteo_Nuit_VentForce(j)
return tonumber(conditionNuit[tonumber(j)].VentForce)
end
function conky_Meteo_Nuit_ProbOrage(j)
return tonumber(conditionNuit[tonumber(j)].ProbOrage)
end
function conky_Meteo_Nuit_NivPrec(j)
return tonumber(conditionNuit[tonumber(j)].NivPrec)
end
function conky_Meteo_Nuit_QPluie(j)
return tonumber(conditionNuit[tonumber(j)].QPluie)
end
function conky_Meteo_Nuit_QNeige(j)
return tonumber(conditionNuit[tonumber(j)].QNeige)
end
function conky_Meteo_Nuit_HDureePrec(j)
return conditionNuit[tonumber(j)].DPrecHeure
end
function conky_Meteo_Nuit_MDureePrec(j)
return conditionNuit[tonumber(j)].DPrecMinute
end
function conky_Meteo_Nuit_HDureePluie(j)
return conditionNuit[tonumber(j)].DPluieHeure
end
function conky_Meteo_Nuit_MDureePluie(j)
return conditionNuit[tonumber(j)].DPluieMinute
end
function conky_Meteo_Nuit_IconeM(r, p, s, f, j)
return "${image "..r.."/"..conditionNuit[tonumber(j)].IconeM.." -p "..p.." -s "..s.." -f "..f.."}"
end
function conky_Meteo_Nuit_IconeV(r, p, s, f, j)
return "${image "..r.."/"..conditionNuit[tonumber(j)].IconeV.." -p "..p.." -s "..s.." -f "..f.."}"
end
--Infos sur la journée
function conky_Meteo_Jour(j)
return InfoJour[tonumber(j)].Jour
end
function conky_Meteo_ABJour(j)
return InfoJour[tonumber(j)].ABJour --jour abrege
end
function conky_Meteo_HLeverSoleil(j)
return InfoJour[tonumber(j)].LeverSoleilHeure
end
function conky_Meteo_MLeverSoleil(j)
return InfoJour[tonumber(j)].LeverSoleilMinute
end
function conky_Meteo_HCoucherSoleil(j)
return InfoJour[tonumber(j)].CoucherSoleilHeure
end
function conky_Meteo_MCoucherSoleil(j)
return InfoJour[tonumber(j)].CoucherSoleilMinute
end
function conky_Meteo_HLeverLune(j)
return InfoJour[tonumber(j)].LeverLuneHeure
end
function conky_Meteo_MLeverLune(j)
return InfoJour[tonumber(j)].LeverLuneMinute
end
function conky_Meteo_HCoucherLune(j)
return InfoJour[tonumber(j)].CoucherLuneHeure
end
function conky_Meteo_MCoucherLune(j)
return InfoJour[tonumber(j)].CoucherLuneMinute
end
function conky_Meteo_HDureeJour(j)
return InfoJour[tonumber(j)].DureeJourHeure
end
function conky_Meteo_MDureeJour(j)
return InfoJour[tonumber(j)].DureeJourMinute
end
function conky_Meteo_HDureeNuit(j)
return InfoJour[tonumber(j)].DureeNuitHeure
end
function conky_Meteo_MDureeNuit(j)
return InfoJour[tonumber(j)].DureeNuitMinute
end
--Lunaison
function conky_Lune_ephemerides()
return ephemerides
end
function conky_Lune_ephemerides1()
return ephemerides1
end
function conky_Lune_ephemerides2()
return ephemerides2
end
function conky_Lune_Visibilite()
return Visibilite
end
function conky_Lune_Phases()
return Phases
end
function conky_Lune_Phases1()
return Phases1
end
function conky_Lune_Phases2()
return Phases2
end
function conky_Lune_Noeudlunaire()
return Noeud_lunaire
end
function conky_Lune_Apogee()
return Apogee
end
function conky_Lune_Perigee()
return Perigee
end
function conky_Lune_Distance()
return Distance
end
function conky_Lune_Age()
return Age
end
function conky_Lune_HLeverLune()
return Lever_LuneHeure
end
function conky_Lune_MLeverLune()
return Lever_LuneMinute
end
function conky_Lune_HCoucherLune()
return Coucher_LuneHeure
end
function conky_Lune_MCoucherLune()
return Coucher_LuneMinute
end
function conky_Lune_EclipsePartielle()
return Eclipse_partielle
end
function conky_Lune_EclipseTotal()
return Eclipse_total
end