Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1326 Le 09/09/2016, à 20:43

seelord

Re : [Conky] Alternative à weather.com (3)

Re,
Merci de lui avoir posé la question j'ai lu sa réponse j'ai mis un espace entre:

${alignr}"espace"${execpi 600 sed -n '9p' $HOME/1_accuweather/curr_cond}

Et la ça fonctionne ...

Edit: J'ai relu sa réponse et oui un espace à la fin de la ligne fonctionne aussi tongue

Ah oublié une chose importante .... Tu le remercieras de ma part wink

Dernière modification par seelord (Le 09/09/2016, à 23:39)


Rien ne sert d'avoir une grosse tête, suffit juste de mettre les pieds dans le plat...^^

Hors ligne

#1327 Le 11/09/2016, à 10:05

loutch

Re : [Conky] Alternative à weather.com (3)

Hello

Tu le remercieras de ma part 

Fait



@+

Dernière modification par loutch (Le 11/09/2016, à 10:06)

Hors ligne

#1328 Le 27/10/2016, à 12:45

ragamatrix

Re : [Conky] Alternative à weather.com (3)

loutch a écrit :

Re

Moi reste plus qu'a franciser tout ça .

Suis pas fana de ce genre d'icônes .
http://pix.tdct.org/upload/thumb/1473338641.png

@+

edit

Changer pour l'ancien pack d'icones j'aime mieux


http://pix.tdct.org/upload/thumb/1473343561.png


@+

Salut loutch,
pourrais-tu tu stp nous poster la config du conky ci-dessus ?
As-tu aussi ce genre de conky avec le script wunderground ?
Bonne aprem
cordialement raga wink

Dernière modification par ragamatrix (Le 27/10/2016, à 12:45)

Hors ligne

#1329 Le 29/10/2016, à 08:45

loutch

Re : [Conky] Alternative à weather.com (3)

@ ragamatrix

No Problemo

Il est un peu plus grand (5 cadres) que sur la capture d'écran mais pour avoir le même tu peux supprimer le 3' et 4' cadre ainsi que dans le 2' cadre la dernière ligne au-dessus des icônes fait appel au script wunderground.

1477727593.png

accuweather.fr

  
background yes
use_xft yes
xftfont GE Inspira:size=9
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
own_window_argb_visual yes
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_pager
double_buffer yes
minimum_size 450 540
maximum_width 465
text_buffer_size 2048
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color white #dbc38f
default_outline_color black
alignment tl
gap_x 60
gap_y 60
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
# Fonctionne uniquement avec les polices Fixes
#use_spacer yes
imlib_cache_size 0 
 uppercase no
 
 color7 6495ee
 color9 red
 	
	lua_load ~/.conky/lua/image.lua
	
TEXT

${execi 600 bash $HOME/1_accuweather/1_accuweather -f2015 -h2015}
#### Prelier cadre ####
${voffset -14}${font LED_mono :style=Medium:size=58}${color 434343}${goto 30}${time %H}${goto 140}${time %M}${font LED_mono :size=20:style=Medium}${color 808080}${goto 233}${time %S}$font
#### Date ####
${voffset -30}${color white}${font GE Inspira:size=9}${alignc -108}${time %A, %d %B %Y}$font
### vent ####
${voffset -10}
${goto 310}${font GE Inspira:size=10}Vent : ${execi 90 sed -n '5p' $HOME/1_accuweather/curr_cond} 
${goto 310}Vitesse : ${execi 90 sed -n '6p' $HOME/1_accuweather/curr_cond}
${goto 310}Préssion : ${execi 90 sed -n '8p' $HOME/1_accuweather/curr_cond}
${goto 310}Indice UV : ${execi 90 sed -n '9p' $HOME/1_accuweather/curr_cond} $font
#### Ville ####
${voffset -36}${font GE Inspira:size=12:}Sarreguemines : ${font} Temp.: ${execi 90 sed -n '2p' $HOME/1_accuweather/curr_cond} °C   Res.: ${execi 90 sed -n '3p' $HOME/1_accuweather/curr_cond} °C  
${execi 90 sed -n '4p' $HOME/1_accuweather/curr_cond}
Alerte 1 : ${execi 600  sed -n '1p' $HOME/1_accuweather/Alertes}
Alerte 2 : ${execi 600  sed -n '2p' $HOME/1_accuweather/Alertes}
#### Deuxième cadre ####
#### Affichage date ####
${voffset -8}
${goto 20}${execi 3600 echo `date --date="1 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="1 day" | awk '{print $3}'`}\
${goto 115}${execi 3600 echo `date --date="2 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="2 day" | awk '{print $3}'`}\
${goto 215}${execi 3600 echo `date --date="3 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="3 day" | awk '{print $3}'`}\
${goto 305}${execi 3600 echo `date --date="4 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="4 day" | awk '{print $3}'`}\
${goto 400}${execi 3600 echo `date --date="5 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="5 day" | awk '{print $3}'`}
##### Affichage temperatures #####
${voffset -14}
${goto 20}${color7}${execi 90 sed -n '9p' $HOME/1_accuweather/first_days}°${color}/${color9}${execi 90 sed -n '8p' $HOME/1_accuweather/first_days}°${color}\
${goto 115}${color7}${execi 90 sed -n '14p' $HOME/1_accuweather/first_days}°${color}/${color9}${execi 90 sed -n '13p' $HOME/1_accuweather/first_days}°${color}\
${goto 215}${color7}${execi 90 sed -n '19p' $HOME/1_accuweather/first_days}°${color}/${color9}${execi 90 sed -n '18p' $HOME/1_accuweather/first_days}°${color}\
${goto 305}${color7}${execi 90 sed -n '24p' $HOME/1_accuweather/first_days}°${color}/${color9}${execi 90 sed -n '23p' $HOME/1_accuweather/first_days}°${color}\
${goto 400}${color7}${execi 90 sed -n '4p' $HOME/1_accuweather/last_days}°${color}/${color9}${execi 90 sed -n '3p' $HOME/1_accuweather/last_days}°${color}
##### Affichage direction du vent et vitesse #####
${voffset -17}${execi 1800 bash $HOME/2b_Wunderground_API/2b}
${goto 20}${execi 90 sed -n '98p' $HOME/2b_Wunderground_API/Simple_Forecast}-${execi 90 sed -n '96p' $HOME/2b_Wunderground_API/Simple_Forecast}km/h\
${goto 115}${execi 90 sed -n '204p' $HOME/2b_Wunderground_API/Simple_Forecast}-${execi 90 sed -n '202p' $HOME/2b_Wunderground_API/Simple_Forecast}km/h\
${goto 215}${execi 90 sed -n '310p' $HOME/2b_Wunderground_API/Simple_Forecast}-${execi 90 sed -n '308p' $HOME/2b_Wunderground_API/Simple_Forecast}km/h\
${goto 305}${execi 90 sed -n '416p' $HOME/2b_Wunderground_API/Simple_Forecast}-${execi 90 sed -n '414p' $HOME/2b_Wunderground_API/Simple_Forecast}km/h\
${goto 400}${execi 90 sed -n '522p' $HOME/2b_Wunderground_API/Simple_Forecast}-${execi 90 sed -n '520p' $HOME/2b_Wunderground_API/Simple_Forecast}km/h
#### Troisième cadre ####
#### Conditions ####
${voffset 44}${font GE Inspira:size=8}
${execi 90 sed -n '10p' $HOME/1_accuweather/first_days| cut -c1-14}\
${goto 95}${execi 90 sed -n '15p' $HOME/1_accuweather/first_days| cut -c1-14}\
${goto 200}${execi 90 sed -n '20p' $HOME/1_accuweather/first_days| cut -c1-14}\
${goto 290}${execi 90 sed -n '25p' $HOME/1_accuweather/first_days| cut -c1-14}\
${goto 385}${execi 90 sed -n '10p' $HOME/1_accuweather/last_days| cut -c1-14}
${execi 90 sed -n '10p' $HOME/1_accuweather/first_days| cut -c15-29}\
${goto 95}${execi 90 sed -n '15p' $HOME/1_accuweather/first_days| cut -c15-29}\
${goto 200}${execi 90 sed -n '20p' $HOME/1_accuweather/first_days| cut -c15-29}\
${goto 290}${execi 90 sed -n '25p' $HOME/1_accuweather/first_days| cut -c15-29}\
${goto 385}${execi 90 sed -n '10p' $HOME/1_accuweather/last_days| cut -c15-29}$font
#### Quatrième cadre ####
${voffset 6}
${goto 25}LEVER/COUCHER DU SOLEIL                                               ${goto 270}LEVER/COUCHER DE LUNE
Lever du soleil ${execi 3600 sed -n '14p' $HOME/1_accuweather/curr_cond}       ${goto 250}Lever de lune ${execi 3600 sed -n '18p' $HOME/1_accuweather/curr_cond}
Coucher de soleil ${execi 3600 sed -n '15p' $HOME/1_accuweather/curr_cond}     ${goto 250}Coucher de lune ${execi 3600 sed -n '19p' $HOME/1_accuweather/curr_cond}
Durée ${execi 3600 sed -n '16p' $HOME/1_accuweather/curr_cond}                 ${goto 250}Durée ${execi 3600 sed -n '20p' $HOME/1_accuweather/curr_cond}
                                                                               ${goto 250}${execi 600  sed -n '6p' $HOME/2b_Wunderground_API/Moon_Sun}  Vis. ${execi 600  sed -n '2p' $HOME/2b_Wunderground_API/Moon_Sun}% 
#### Cinquième cadre ####
${voffset -18}
${color FFFFFF}${goto 10}${voffset 16}${cpu cpu0}%\
${goto 55}${exec expr `cat /sys/class/hwmon/hwmon2/temp1_input` / 1000} °\
${goto 105}${execi 120 hddtemp -n /dev/sda} °\
${goto 155}${hwmon 1 temp 1} °\
${goto 200}${memperc}%\
${goto 255}${fs_used_perc /}%\
${goto 305}${fs_used_perc /home}%\
${goto 350}${downspeed wlp2s0}\
${goto 400}${upspeed wlp2s0}
${color 6495ee}${goto 10}CPU\
${goto 50}Temp\
${goto 100}Disque\
${goto 150}Carte\
${goto 200}Ram\
${goto 250}Racine\
${goto 300}Home\
${goto 350}Entrant\
${goto 400}Sortant $color
${goto 250}Signal : ${wireless_link_qual wlp2s0} %${goto 350}${totaldown wlp2s0}${goto 400}${totalup wlp2s0}
${color FFFFFF}${font caviar dreams:size=8}Uptime: ${uptime_short}
${color FFFFFF}${font caviar dreams:size=8}Processes: ${processes}
${color FFFFFF}${font caviar dreams:size=8}Running: ${running_processes}
${voffset -54}
${color 6495ee}${font caviar dreams:size=8}${alignr 20}${nodename}
${color 6495ee}${font caviar dreams:size=8}${alignr 20}Mageia 5 $machine
${color 6495ee}${font caviar dreams:size=8}${alignr 20}Kernel: ${kernel}${color}
#### Affichage des cadres utilisés dans le conky ####
${voffset -935}
#### premier cadre ####
${lua fDrawImage $HOME/1_accuweather/fond/base.png 0 40 450 112}
${lua fDrawImage $HOME/1_accuweather/fond/flip_bg.png 22 3 100 100}
${lua fDrawImage $HOME/1_accuweather/fond/flip_bg.png 132 3 100 100}
#### Second cadre ####
${lua fDrawImage $HOME/1_accuweather/fond/base.png 0 155 450 85}
#### Troisième cadre ####
${lua fDrawImage $HOME/1_accuweather/fond/base.png 0 245 450 45}
#### Quatrième cadre ####
${lua fDrawImage $HOME/1_accuweather/fond/base.png 0 295 450 85}
#### Cinquième cadre ####
${lua fDrawImage $HOME/1_accuweather/fond/base.png 0 385 450 85}
#### icônes premier cadre ####
${lua fDrawImage $HOME/1_accuweather/forecast_2015/forecast_0.png 215 70 110 70}\
${lua fDrawImage $HOME/1_accuweather/Wind1.png 370 40 90 90}
#### icônes Second cadre ####
${lua fDrawImage $HOME/1_accuweather/forecast_2015/forecast_2.png -10 190 90 55}\
${lua fDrawImage $HOME/1_accuweather/forecast_2015/forecast_3.png  85 190 90 55}\
${lua fDrawImage $HOME/1_accuweather/forecast_2015/forecast_4.png 185 190 90 55}\
${lua fDrawImage $HOME/1_accuweather/forecast_2015/forecast_5.png 280 190 90 55}\
${lua fDrawImage $HOME/1_accuweather/forecast_2015/forecast_6.png 375 190 90 55}
#### icônes Quatrième cadre ####
${lua fDrawImage $HOME/1_accuweather/Forecast_Images_2015/1.png 140 305 110 70}\
${lua fDrawImage $HOME/1_accuweather/Forecast_Images_2015/33.png 350 305 110 70}
${voffset - 900}

wunderground un peu différent

1477727761.png

  
background yes
use_xft yes
xftfont GE Inspira:size=9
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
own_window_argb_visual yes
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_pager
double_buffer yes
minimum_size 450 440
maximum_width 455
text_buffer_size 2048
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color white #dbc38f
default_outline_color black
alignment tl
gap_x 60
gap_y 60
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
# Fonctionne uniquement avec les polices Fixes
#use_spacer yes
imlib_cache_size 0 
 uppercase no
 
 color7 6495ee
 color9 red
 	
	lua_load ~/.conky/lua/image.lua
	
TEXT

#### Lancement du script récupérant les données météo ####
${execi 1800 bash $HOME/2b_Wunderground_API/2b}
#### Premier cadre ####
##### Heure #####
${voffset -14}${font LED_mono :style=Medium:size=55}${color 434343}${goto 32}${time %H}${goto 142}${time %M}${font LED_mono :size=20:style=Medium}${color 808080}${goto 235}${time %S}$font
##### Date #####
${voffset -36}${color white}${font GE Inspira:size=9:style=Bold}${alignc -108}${exec date "+%A %d %B %Y"}
##### Affichage infos vent ######
${voffset 10}${color white}${font GE Inspira:size=9}${goto 300}Vent : ${execi 600  sed -n '73p' $HOME/2b_Wunderground_API/Conditions-fr}          
${goto 300}Vitesse : ${execi 600  sed -n '74p' $HOME/2b_Wunderground_API/Hourly} km/h
${goto 300}Pluie : ${execi 600  sed -n '57p' $HOME/2b_Wunderground_API/Simple_Forecast} mm
##### ville + heure mise à jour #####
${voffset -18}${goto 15}${font Ubuntu:size=10}${color white}Sarreguemines : $font ${execi 600  sed -n '63p' $HOME/2b_Wunderground_API/Conditions-fr}
  Temp.: ${execi 600  sed -n '67p' $HOME/2b_Wunderground_API/Conditions} °C     Res.: ${execi 600  sed -n '113p' $HOME/2b_Wunderground_API/Conditions} °C
  Alerte 1 : ${execi 600  sed -n '1p' $HOME/2b_Wunderground_API/Alertes}
  Alerte 2 : ${execi 600  sed -n '2p' $HOME/2b_Wunderground_API/Alertes}  ${alignr 14}Dernière mise à jour : ${execi 600  sed -n '53p' $HOME/2b_Wunderground_API/Conditions | cut -c18-22}
#### Deuxième cadre ####
##### Affichage temperature #####
${voffset -8}
${goto 20}${color9}${execi 600  sed -n '145p' $HOME/2b_Wunderground_API/Simple_Forecast}°${color}/${color7}${execi 600  sed -n '150p' $HOME/2b_Wunderground_API/Simple_Forecast}°${color}\
${goto 95}${color9}${execi 600  sed -n '251p' $HOME/2b_Wunderground_API/Simple_Forecast}°${color}/${color7}${execi 600  sed -n '256p' $HOME/2b_Wunderground_API/Simple_Forecast}°${color}\
${goto 170}${color9}${execi 600  sed -n '357p' $HOME/2b_Wunderground_API/Simple_Forecast}°${color}/${color7}${execi 600  sed -n '362p' $HOME/2b_Wunderground_API/Simple_Forecast}°${color}\
${goto 245}${color9}${execi 600  sed -n '463p' $HOME/2b_Wunderground_API/Simple_Forecast}°${color}/${color7}${execi 600  sed -n '468p' $HOME/2b_Wunderground_API/Simple_Forecast}°${color}\
${goto 320}${color9}${execi 600  sed -n '569p' $HOME/2b_Wunderground_API/Simple_Forecast}°${color}/${color7}${execi 600  sed -n '574p' $HOME/2b_Wunderground_API/Simple_Forecast}°${color}\
${goto 400}${color9}${execi 600  sed -n '675p' $HOME/2b_Wunderground_API/Simple_Forecast}°${color}/${color7}${execi 600  sed -n '680p' $HOME/2b_Wunderground_API/Simple_Forecast}°${color}  $color



##### Affichage vitesse du vent #####
${voffset -20}
${goto 20}${execi 90 sed -n '96p' $HOME/2b_Wunderground_API/Simple_Forecast}km/h\
${goto 95}${execi 90 sed -n '202p' $HOME/2b_Wunderground_API/Simple_Forecast}km/h\
${goto 168}${execi 90 sed -n '308p' $HOME/2b_Wunderground_API/Simple_Forecast}km/h\
${goto 248}${execi 90 sed -n '414p' $HOME/2b_Wunderground_API/Simple_Forecast}km/h\
${goto 324}${execi 90 sed -n '520p' $HOME/2b_Wunderground_API/Simple_Forecast}km/h\
${goto 398}${execi 90 sed -n '626p' $HOME/2b_Wunderground_API/Simple_Forecast}km/h
##### Affichage direction du vent #####
${voffset -17}
${goto 20}${execi 90 sed -n '98p' $HOME/2b_Wunderground_API/Simple_Forecast}\
${goto 95}${execi 90 sed -n '204p' $HOME/2b_Wunderground_API/Simple_Forecast}\
${goto 168}${execi 90 sed -n '310p' $HOME/2b_Wunderground_API/Simple_Forecast}\
${goto 248}${execi 90 sed -n '416p' $HOME/2b_Wunderground_API/Simple_Forecast}\
${goto 324}${execi 90 sed -n '522p' $HOME/2b_Wunderground_API/Simple_Forecast}\
${goto 398}${execi 90 sed -n '628p' $HOME/2b_Wunderground_API/Simple_Forecast}
##### Affichage Date #####
${voffset -17}
${goto 20}${execi 3600 echo `date --date="1 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="1 day" | awk '{print $3}'`}\
${goto 95}${execi 3600 echo `date --date="2 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="2 day" | awk '{print $3}'`}\
${goto 168}${execi 3600 echo `date --date="3 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="3 day" | awk '{print $3}'`}\
${goto 248}${execi 3600 echo `date --date="4 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="4 day" | awk '{print $3}'`}\
${goto 324}${execi 3600 echo `date --date="5 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="5 day" | awk '{print $3}'`}\
${goto 398}${execi 3600 echo `date --date="6 day" | awk '{print $1}' | cut -c1-3`}.${execi 3600 echo `date --date="6 day" | awk '{print $3}'`}
#### Troisième cadre ####
${voffset 1}
${goto 25}LEVER/COUCHER DU SOLEIL                                               ${goto 270}LEVER/COUCHER DE LUNE
${voffset -15}
Lever du soleil : ${execi 600  sed -n '16p' $HOME/2b_Wunderground_API/Moon_Sun} h ${execi 600  sed -n '18p' $HOME/2b_Wunderground_API/Moon_Sun}       ${goto 250}Lever de lune : ${execi 600  sed -n '26p' $HOME/2b_Wunderground_API/Moon_Sun} h ${execi 600  sed -n '28p' $HOME/2b_Wunderground_API/Moon_Sun}
Coucher de soleil : ${execi 600  sed -n '21p' $HOME/2b_Wunderground_API/Moon_Sun} h ${execi 600  sed -n '23p' $HOME/2b_Wunderground_API/Moon_Sun}     ${goto 250}Coucher de lune : ${execi 600  sed -n '31p' $HOME/2b_Wunderground_API/Moon_Sun} h ${execi 600  sed -n '33p' $HOME/2b_Wunderground_API/Moon_Sun}
Indice UV : ${execi 600  sed -n '121p' $HOME/2b_Wunderground_API/Conditions}                                                                                                                                            ${goto 250}Phase : ${execi 600  sed -n '6p' $HOME/2b_Wunderground_API/Moon_Sun}
Prévision pluie : ${execi 600  sed -n '133p' $HOME/2b_Wunderground_API/Conditions} mm                                                                                                                                    ${goto 250}Visibilitée : ${execi 600  sed -n '2p' $HOME/2b_Wunderground_API/Moon_Sun} %
#### Troisième cadre ####                                                                
${color FFFFFF}${goto 10}${voffset 10}${cpu cpu0}%\
${goto 55}${exec expr `cat /sys/class/hwmon/hwmon2/temp1_input` / 1000} °\
${goto 105}${execi 120 hddtemp -n /dev/sda} °\
${goto 155}${hwmon 1 temp 1} °\
${goto 200}${memperc}%\
${goto 255}${fs_used_perc /}%\
${goto 305}${fs_used_perc /home}%\
${goto 350}${downspeed wlp2s0}\
${goto 400}${upspeed wlp2s0}
${color 6495ee}${goto 10}CPU\
${goto 50}Temp\
${goto 100}Disque\
${goto 150}Carte\
${goto 200}Ram\
${goto 250}Racine\
${goto 300}Home\
${goto 350}Entrant\
${goto 400}Sortant $color
${goto 250}Signal : ${wireless_link_qual wlp2s0} %${goto 350}${totaldown wlp2s0}${goto 400}${totalup wlp2s0}
${color FFFFFF}${font caviar dreams:size=8}Uptime: ${uptime_short}
${color FFFFFF}${font caviar dreams:size=8}Processes: ${processes}
${color FFFFFF}${font caviar dreams:size=8}Running: ${running_processes}
${voffset -54}
${color 6495ee}${font caviar dreams:size=8}${alignr 20}${nodename}
${color 6495ee}${font caviar dreams:size=8}${alignr 20}Mageia 5 $machine
${color 6495ee}${font caviar dreams:size=8}${alignr 20}Kernel: ${kernel}
#### Affichage des cadres utilisés dans le conky ####
${voffset -935}
#### premier cadre ####
${lua fDrawImage $HOME/2b_Wunderground_API/fond/base.png 0 40 450 110}
${lua fDrawImage $HOME/2b_Wunderground_API/fond/flip_bg.png 22 3 100 100}
${lua fDrawImage $HOME/2b_Wunderground_API/fond/flip_bg.png 132 3 100 100}
#### Second cadre ####
${lua fDrawImage $HOME/2b_Wunderground_API/fond/base.png 0 155 450 85}
#### Troisième cadre ####
${lua fDrawImage $HOME/2b_Wunderground_API/fond/base.png 0 245 450 85}
#### Quatrième cadre ####
${lua fDrawImage $HOME/2b_Wunderground_API/fond/base.png 0 335 450 85}
#### icônes premier cadre ####
${lua fDrawImage $HOME/2b_Wunderground_API/Now.png 205 75 100 70}
${lua fDrawImage $HOME/2b_Wunderground_API/Wind1.png 370 55 90 90}
#### icônes Second cadre ####
${lua fDrawImage $HOME/2b_Wunderground_API/d2.png 0 165 65 45}
${lua fDrawImage $HOME/2b_Wunderground_API/d3.png 75 165 65 45}
${lua fDrawImage $HOME/2b_Wunderground_API/d4.png 150 165 65 45}
${lua fDrawImage $HOME/2b_Wunderground_API/d5.png 225 165 65 45}
${lua fDrawImage $HOME/2b_Wunderground_API/d6.png 300 165 65 45}
${lua fDrawImage $HOME/2b_Wunderground_API/d7.png 375 165 65 45}
#### icônes troisième cadre ####
${lua fDrawImage $HOME/2b_Wunderground_API/Forecast_Images/1.png 140 255 100 70}\
${lua fDrawImage $HOME/2b_Wunderground_API/Forecast_Images/33.png 350 255 100 70}
${voffset -450}

@+

Dernière modification par loutch (Le 29/10/2016, à 08:59)

Hors ligne

#1330 Le 29/10/2016, à 16:11

ragamatrix

Re : [Conky] Alternative à weather.com (3)

Merci beaucoup loutch et bon week-end wink ++

Hors ligne

#1331 Le 23/12/2016, à 10:24

jdt37b

Re : [Conky] Alternative à weather.com (3)

Bon jour,
Le conky méteo dont on a parlé ici ne fonctionne plus en version 1.10, y compris en le modifiant avec la nouvelle syntaxe (pb lua apparemment ?)
Je suis donc revenu en 1.09.
Mais, dans Xenial, qu'apporte de plus cette version 1.10  ?  (à part se retartiner les conkies ! smile )
Merci.


Acer Aspire XC330 - AMD A9-9420 - 8Go - HDD 1To - AMD Radeon R5 - Xubuntu 20.04 LTS (Focal) - 64 bits
Asus VivoBook X515JA - Intel Core i3-1005G1 - 8Go - SSD 0,5To - Intel driver i915 - Xubuntu 20.04 LTS (Focal) - 64 bits

Hors ligne

#1332 Le 17/01/2017, à 22:29

daniel38100

Re : [Conky] Alternative à weather.com (3)

Bonjour à tous ,

Je viens de mettre a jour le pack météo fond d'écran

Disponible ici Accuweather-3 v3.10

le recmeteo.py

#! /usr/bin/python3
# -*- coding: utf-8 -*-
# Par Didier-T Forum Ubuntu.fr
# Ajout notification par jpdipsy Forum Ubuntu.fr
# Ajout notification via DBus par ti_tux Forum Ubuntu.fr
# Ajout création repsauv si inexistant par jpdipsy Forum Ubuntu.fr
# Repris par Daniel38100 à partir de la version 2.00 en 01/2017


from socket import timeout
from urllib.request import Request, urlopen, URLError
from os import path, makedirs, system
from time import time, sleep, strftime, localtime
from re import search, compile, findall
from sys import argv
from gc import collect
from bs4 import BeautifulSoup, Tag, NavigableString
from datetime import date, datetime


Version='2.00a'

homedir=path.expanduser('~')

#### initialisation des variables
adressWeb="http://www.accuweather.com/fr/fr/belfort/133341/daily-weather-forecast/133341"
repsauv="~/essais"
huitHeures="oui"
nbFoisHuit=1
matin="oui"
apresmidi="oui"
soiree="oui"
nuit="oui"
nbJour=1
interval=30
notifi="oui"
externe=None
Id="sans"
demon="non"
fullnotify="non"
MAJP="oui"

for a in argv:
    if search("adressWeb=", a) is not None:
        adressWeb=compile("adressWeb=(.*)").search(a).group(1)
    if search("repsauv=", a) is not None:
        repsauv=compile("repsauv=(.*)").search(a).group(1)
    if search("huitHeures=", a) is not None:
        huitHeures=compile("huitHeures=(.*)").search(a).group(1)
    if search("nbJour=", a) is not None:
        nbJour=compile("nbJour=(.*)").search(a).group(1)
    if search("interval=", a) is not None:
        interval=compile("interval=(.*)").search(a).group(1)
    if search("notify=", a) is not None:
        notifi=compile("notify=(.*)").search(a).group(1)
    if search("notifyPartielle=", a) is not None:
        fullnotify=compile("notifyPartielle=(.*)").search(a).group(1)
    if search("matin=", a) is not None:
        matin=compile("matin=(.*)").search(a).group(1)
    if search("apresmidi=", a) is not None:
        apresmidi=compile("apresmidi=(.*)").search(a).group(1)
    if search("soiree=", a) is not None:
        soiree=compile("soiree=(.*)").search(a).group(1)
    if search("nuit=", a) is not None:
        nuit=compile("nuit=(.*)").search(a).group(1)
    if search("externe=", a) is not None:
        externe=compile("externe=(.*)").search(a).group(1)
    if search("nbFoisHuit=", a) is not None:
        nbFoisHuit=compile("nbFoisHuit=(.*)").search(a).group(1)
    if search("id=", a) is not None:
        Id=compile("id=(.*)").search(a).group(1)
    if search("demon=", a) is not None:
        demon=compile("demon=(.*)").search(a).group(1)
    if search("MAJP=", a) is not None:
        MAJP=compile("MAJP=(.*)").search(a).group(1)

nbJour=int(nbJour)
interval=int(interval)
repsauv=repsauv.replace("~", homedir)
notifi=str.lower(notifi)
fullnotify==str.lower(fullnotify)
huitHeures=str.lower(huitHeures)
nbFoisHuit=int(nbFoisHuit)
MAJP=str(MAJP)

#### fin initialisation des variables

#### Fonction de traitement des fichiers
def traitement(adress, fichier, repsauv):
    current_balise=None
    x=1
    user_agent='Mozilla/5.0 (X11; Linux x86_64)'
    headers={ 'User-Agent' : user_agent }
    while current_balise is None:
        response=None
        while response is None:
            try:
                html_page=urlopen(adress, timeout=10)
            except (URLError) as error:
                print("[\033[31mFAIL\033[0m] HTML ", error)
            except timeout:
                print("[\033[31mFAIL\033[0m] erreur timeout acces HTML")
            else:
                try:
                    currentCond=html_page.read()
                except (URLError) as error:
                    print("[\033[31mFAIL\033[0m] Lecture page ", error)
                except timeout:
                    print("[\033[31mFAIL\033[0m] erreur timeout lecture page")
                else:
#                    print("[\033[32m OK \033[0m] "+adress)
                    response="ok"
            if response is None:
                sleep(10)
        current_balise=1
    soup=BeautifulSoup(currentCond, "lxml")
    resultat=''
    inter=[]
#  Huit Heures -----------------------------------------------------
    if 'hourly-weather-forecast' in adress :
        page=soup.select("[class~=overview-hourly]")[0].find_all('td')+soup.select("[class~=precip-hourly]")[0].find_all('td')+soup.select("[class~=sky-hourly]")[0].find_all('td')
        info=BeautifulSoup(str(page), "lxml").find_all('div')+BeautifulSoup(str(page), "lxml").find_all('span')
        suppr='<div class='
        detail=['Heure','','','Temp°','RealFeel®','Vent (km/h)','Pluie','Neige','Verglas','Indice UV','Couverture nuageuse','Humidité','Point de rosée','Icone']
        for i in info :
            if suppr in str(i) :
                result=str(i).replace(str(i),'')
            else :
                result=str(i).replace('</span>','').replace('<span>','').replace('</div>','').replace('<div>','')
                inter.append(result)
        ico=BeautifulSoup(str(page), "lxml").select("[class~=icon]")
        x=1
        for i in ico:
            icone=str(i).replace('<div class="icon-weather icon ','').replace('"></div>','')
            x=x+1
            inter.append(icone)
        y=0
        for i in detail:
            x=1
            while x<9 :
                if i == '' :
                    x=x+1
                    y=y+1
                else :
                    resultat=resultat+str(i)+str(x)+': '+inter[y]+'\n'
                    y=y+1
                    x=x+1
# Jour ---------------------------------------------------------
    if 'daily-weather-forecast' in adress :
        page=soup.select("[class~=detail-tab-panel]")[0]
        page=str(page).replace('<span class="setting">Mx</span>','').replace('<span class="setting">Mi</span>','')
        info=BeautifulSoup(str(page), "lxml").find_all('strong')
        inter0=[]
        for i in info:
            soup1=BeautifulSoup(str(i), "lxml")
            comment=soup1.strong.string
            inter0.append(comment)
        inter.append('VentD jour: '+inter0[0].split(' ')[0])
        inter.append('VentF jour: '+inter0[0].split(' ')[1]+'km/h')
        inter.append('VentD nuit: '+inter0[10].split(' ')[0])
        inter.append('VentF nuit: '+inter0[10].split(' ')[1]+'km/h')
        inter.append('Rafale jour:'+inter0[1])
        inter.append('Rafale nuit:'+inter0[11])
        inter.append('UV jour: '+inter0[2])
        inter.append('UV nuit: '+inter0[12])
        inter.append('Prob orage jour: '+inter0[3])
        inter.append('Prob orage nuit: '+inter0[13])
        inter.append('Précipitations jour: '+inter0[4])
        inter.append('Précipitations nuit: '+inter0[14])
        inter.append('Pluie jour: '+inter0[5])
        inter.append('Pluie nuit: '+inter0[15])
        inter.append('Neige jour: '+inter0[6])
        inter.append('Neige nuit: '+inter0[16])
        inter.append('Verglas jour: '+inter0[7])
        inter.append('Verglas nuit: '+inter0[17])
        inter.append('Heures de précipitations jour: '+inter0[8])
        inter.append('Heures de précipitations nuit: '+inter0[18])
        inter.append('Heures de pluie jour: '+inter0[9])
        inter.append('Heures de pluie nuit: '+inter0[19])
        info=BeautifulSoup(str(page), "lxml").find_all('span')
        inter0=[]
        for i in info:
            soup1=BeautifulSoup(str(i), "lxml")
            comment=soup1.span.string
            inter0.append(comment)
        inter.append('Temp jour: '+inter0[0])
        inter.append('Temp nuit: '+inter0[3])
        inter.append('Temp ress jour:'+inter0[1].replace('RealFeel®',''))
        inter.append('Temp ress nuit:'+inter0[4].replace('RealFeel®',''))
        inter.append('Prob précipitations jour:'+inter0[2].replace('Précipitations',''))
        inter.append('Prob précipitations nuit:'+inter0[5].replace('Précipitations',''))
        con=BeautifulSoup(str(page), "lxml").select("[class~=cond]")
        inter0=[]
        for i in con:
            cond=str(i).replace('<div class="cond">','').replace('</div>','').replace('  ','').replace('\n','').replace('\r','')
            inter0.append(cond)
        inter.append('Cond jour: '+inter0[0])
        inter.append('Cond nuit: '+inter0[1])
        ico=BeautifulSoup(str(page), "lxml").select("[class~=icon]")
        inter0=[]
        for i in ico:
            icone=str(i).replace('<div class="icon ','').replace('"></div>','')
            inter0.append(icone)
        inter.append('Icone jour: '+inter0[0])
        inter.append('Icone nuit: '+inter0[1])
        page=soup.select("[id~=feature-history]")[0]
        info=BeautifulSoup(str(page), "lxml").find_all('td')
        inter0=[]
        for i in info:
            soup1=BeautifulSoup(str(i), "lxml")
            comment=soup1.td.string
            inter0.append(comment)
        inter.append('Maxjour: '+inter0[0])
        inter.append('Maxnormal: '+inter0[1])
        inter.append('Maxrecord: '+inter0[2])
        inter.append('Max1ans: '+inter0[3])
        inter.append('Minjour: '+inter0[4])
        inter.append('Minnormal: '+inter0[5])
        inter.append('Minrecord: '+inter0[6])
        inter.append('Min1ans: '+inter0[7])
        page=soup.select("[class~=time-period]")
        info=BeautifulSoup(str(page), "lxml").find_all('li')
        inter0=[]
        for i in info:
            soup1=BeautifulSoup(str(i).replace('<span>','').replace('</span>',''), "lxml")
            comment=soup1.li.string
            inter0.append(comment)
        inter.append(inter0[0])
        inter.append(inter0[1])
        inter.append('Duree soleil'+inter0[2].replace('Durée',''))
        inter.append(inter0[3])
        inter.append(inter0[4])
        inter.append('Duree lune'+inter0[5].replace('Durée',''))
        for i in inter:
            resultat=resultat+i+'\n'

# quart --------------------------------------------------------
    if 'morning-weather-forecast' in adress or 'afternoon-weather-forecast' in adress or 'evening-weather-forecast' in adress or 'overnight-weather-forecast' in adress :
        page=soup.select("[class~=detail-tab-panel]")[0]
        con=BeautifulSoup(str(page), "lxml").select("[class~=cond]")
        for i in con:
            cond=str(i).replace('<span class="cond">','').replace('</span>','').replace('  ','').replace('\n','').replace('\r','')
        ico=BeautifulSoup(str(page), "lxml").select("[class~=icon]")
        for i in ico:
            icone=str(i).replace('<div class="icon ','').replace('"></div>','')
        tem=str(BeautifulSoup(str(page), "lxml").select("[class~=large-temp]")[0].select("[class~=small-temp]")[0])
        temmax=str(BeautifulSoup(str(page), "lxml").select("[class~=large-temp]")[0]).replace(str(tem),'').split('>')[1].split('<')[0]
        temmin=tem.split('/')[1].split('<')[0]
        realfeet=str(BeautifulSoup(str(page), "lxml").select("[class~=small-temp]")[1]).replace('<span class="small-temp"><em>RealFeel®</em>','').replace('</span>','').split('/')
        realfeetmin=realfeet[1]
        realfeetmax=realfeet[0]
        ventd=str(BeautifulSoup(str(page), "lxml").select("[class~=wind-point]")[0]).replace('<div class="wind-point ','').replace('"></div>','')
        stat=BeautifulSoup(str(page), "lxml").select("[class~=stats]")
        ventf=str(BeautifulSoup(str(stat), "lxml").select("[class~=wind]")[0]).replace('<li class="wind">','').replace('</li>','')
        inter.append('Cond: '+cond)
        inter.append('Icone: '+icone)
        inter.append('TempMin: '+temmin)
        inter.append('TempMax: '+temmax)
        inter.append('RealFeelMin: '+realfeetmin)
        inter.append('RealFeelMax: '+realfeetmax)
        inter.append('VentD: '+ventd)
        inter.append('VentF: '+ventf)
        stat=BeautifulSoup(str(page), "lxml").find_all('strong')
        detail=['Précipitations: ','Pluie: ','Neige: ','Humidité: ','Couverture nuageuse: ','Point de rosée: ','Visibilité: ']
        x=0
        for i in stat:
            soup1=BeautifulSoup(str(i), "lxml")
            comment=soup1.strong.string
            inter.append(detail[x]+str(comment))
            x=x+1
        for i in inter:
            resultat=resultat+i+'\n'

# CC -----------------------------------------------------------
    if 'current-weather' in adress :
        page=soup.find_all('script')
        soup1=BeautifulSoup(str(page), "lxml")
        ville=compile(" city: '(.*)',").search(str(soup1)).group(1)
        longi=compile("lon: '(.*)',").search(str(soup1)).group(1)
        lat=compile("lat: '(.*)',").search(str(soup1)).group(1)
        inter.append("Ville: "+ville)
        inter.append("Lat: "+lat)
        inter.append("Long: "+longi)
        page=soup.select("[class~=detail-tab-panel]")[0]
        cond=str(BeautifulSoup(str(page), "lxml").select("[class~=cond]")[0]).split('>')[1].split('<')[0]
        icone=str(BeautifulSoup(str(page), "lxml").select("[class~=icon]")[0]).replace('<div class="icon ','').replace('"></div>','')
        temp=str(BeautifulSoup(str(page), "lxml").select("[class~=large-temp]")[0]).split('>')[1].split('<')[0]
        realfeel=str(BeautifulSoup(str(page), "lxml").select("[class~=small-temp]")[0]).split('>')[3].split('<')[0]
        ventd=str(BeautifulSoup(str(page), "lxml").select("[class~=wind-point]")[0]).replace('<div class="wind-point ','').replace('"></div>','')
        inter.append('Cond: '+cond)
        inter.append('Icone: '+icone)
        inter.append('Temp: '+temp)
        inter.append('RealFeel:'+realfeel)
        inter.append('VentD: '+ventd)
        stat=BeautifulSoup(str(page), "lxml").find_all('strong')
        detail=['VentF: ','Humidité: ','Pression: ','Indice UV: ','Couverture nuageuse: ','Plafond: ','Point de rosée: ','Visibilité: ']
        x=0
        for i in stat:
            soup1=BeautifulSoup(str(i), "lxml")
            comment=soup1.strong.string
            inter.append(detail[x]+str(comment))
            x=x+1
        inter.append("Alerte: RAS")
        page=soup.select("[id~=feature-history]")[0]
        info=BeautifulSoup(str(page), "lxml").find_all('td')
        inter0=[]
        for i in info:
            soup1=BeautifulSoup(str(i), "lxml")
            comment=soup1.td.string
            inter0.append(comment)
        inter.append('Maxjour: '+inter0[0])
        inter.append('Maxnormal: '+inter0[1])
        inter.append('Maxrecord: '+inter0[2])
        inter.append('Max1ans: '+inter0[3])
        inter.append('Minjour: '+inter0[4])
        inter.append('Minnormal: '+inter0[5])
        inter.append('Minrecord: '+inter0[6])
        inter.append('Min1ans: '+inter0[7])
        histo=soup.find(id="feature-history")
        date=histo.find_all('th')
        jour=compile("(.*)/(.*)/(.*)").search(date[4].get_text())
        inter.append("jour: "+jour.group(1))
        inter.append("mois: "+jour.group(2))
        inter.append("année: "+str(int(jour.group(3))+1))
        date=str(datetime.now()).split(' ')[1].split(':')
        inter.append("heure: "+date[0])
        inter.append("minute: "+date[1])
        inter.append("seconde: "+date[2].split('.')[0])
        inter.append(str(int(time())))
        for i in inter:
            resultat=resultat+i+'\n'
# --------------------------------------------------------------
    fiche=open(fichier, "w")
    fiche.write(resultat)
    fiche.close()
    collect()
#### fin Fonction de traitement des fichiers

#### Mise en tache de fond
def demonise(ent, id1, id2, huitHeures, nbJour, interval, nbFoisHuit, Id, demon):
    dem=time()-(60*60)
    misajour=1
    while 1 :
        date=str(datetime.now()).split(' ')[1].split(':')
        heure=time()
        if huitHeures=="oui":
            x=0
            while x<nbFoisHuit:
                h=(x*8)+int(strftime('%H', localtime()))
                x=x+1
                traitement(ent+nb1+'/hourly-weather-forecast/'+nb2+'?hour='+str(h), repsauv+"/huitHeures"+str(x), repsauv)
                print("[\033[32m OK \033[0m] huitHeures "+str(x))
        if heure-dem >= 60*60 and MAJP=="oui":
            x=0
            while x<nbJour:
                x=x+1
                traitement(ent+nb1+'/daily-weather-forecast/'+nb2+"?day="+str(x), repsauv+"/Jour"+str(x), repsauv)
                print("[\033[32m OK \033[0m] Jour "+str(x))
                if matin=="oui":
                    traitement(ent+nb1+'/morning-weather-forecast/'+nb2+"?day="+str(x), repsauv+"/Matin"+str(x), repsauv)
                    print("[\033[32m OK \033[0m] Matin "+str(x))
                if apresmidi=="oui":
                    traitement(ent+nb1+'/afternoon-weather-forecast/'+nb2+"?day="+str(x), repsauv+"/AM"+str(x), repsauv)
                    print("[\033[32m OK \033[0m] AM "+str(x))
                if soiree=="oui":
                    traitement(ent+nb1+'/evening-weather-forecast/'+nb2+"?day="+str(x), repsauv+"/Soiree"+str(x), repsauv)
                    print("[\033[32m OK \033[0m] Soiree "+str(x))
                if nuit=="oui":
                    traitement(ent+nb1+'/overnight-weather-forecast/'+nb2+"?day="+str(x), repsauv+"/Nuit"+str(x), repsauv)
                    print("[\033[32m OK \033[0m] Nuit "+str(x))
            dem=heure
        traitement(ent+nb1+'/current-weather/'+nb2, repsauv+"/CC", repsauv)
        print("[\033[32m OK \033[0m] CC")
#        system("lunaison.py")
#        print("[\033[32m OK \033[0m] Lunaison")
        if externe is not None:
                 system(externe)
        fin=time()
        duree=fin-heure
        if notifi == "oui":
            notify2.init('Recmeteo.py')
            if heure-dem == 0:
                mess=notify2.Notification('Accuweather', "Mise a jour complete à "+str(date[0])+":"+str(date[1])+":"+str(date[2]).split('.')[0]+" en "+str(round(duree,2)).replace('.','s')+" sec", '/opt/Accuweather/icones/accuweather-logo1.png')
                mess.show()
                print("[\033[32m OK \033[0m] Mise a jour complete à "+str(date[0])+":"+str(date[1])+":"+str(date[2]).split('.')[0]+" en "+str(round(duree,2)).replace('.','s'))
            else:
                if fullnotify == "oui" :
                    mess=notify2.Notification('Accuweather', "Mise a jour partiel à "+str(date[0])+":"+str(date[1])+":"+str(date[2]).split('.')[0]+" en "+str(round(duree,2)).replace('.','s'), '/opt/Accuweather/icones/accuweather-logo1.png')
                    mess.show()
                print("[\033[32m OK \033[0m] Mise a jour partiel à "+str(date[0])+":"+str(date[1])+":"+str(date[2]).split('.')[0]+" en "+str(round(duree,2)).replace('.','s'))
        start=heure
        pause=60*interval-int(duree)
        if pause < 0:
            pause=interval
        if demon == "non":
            print("[\033[33mINFO\033[0m] Mode démon non utilisé fin de recmeteo.py")
            exit()
        collect()
        sleep(pause)
        if Id != "sans":
            if not path.exists("/proc/"+Id):
                exit()


### Initialiation de DBus pour les notifications
if notifi == "oui":
    import notify2
### Vérification répertoire
if not path.exists(repsauv):
    makedirs(repsauv)
#### Lancement du script et initialisation de la tache de fond
nb1=findall('\d+', adressWeb)[0]
nb2=findall('\d+', adressWeb)[1]
ent=adressWeb[:adressWeb.find(nb1)]
fin=adressWeb.replace(ent+nb1, "")
fin=fin.replace(fin[:fin.find(nb2)]+nb2, "")
nb2=nb2+fin
#print("[\033[33mINFO\033[0m] Recmeteo Version =", Version)
demonise(ent, nb1, nb2, huitHeures, nbJour, interval, nbFoisHuit, Id, demon)

Dernière modification par daniel38100 (Le 17/01/2017, à 22:32)

Hors ligne

#1333 Le 21/01/2017, à 15:08

daniel38100

Re : [Conky] Alternative à weather.com (3)

Bonjour @ tous

Mise a jour du pack meteo lua de Didier-T dispo ici météo.lua meteo-lua-2.deb v1.20 MAJ:21/01/17

meteo2.lua

-- Créé par Didier-T (forum.ubuntu-fr.org)
-- Nécessite imagemagick http://apt.ubuntu.com/p/imagemagick
-- Nécessite Curl
-- utilise recmeteo.py
-- Repris par Daniel38100 Forum Ubuntu.fr a partir de 1.20 en 01/1017

require "io"
require "os"
require 'cairo'

local Version = "v1.20"
local conditionJour = {}
local conditionNuit = {}
local conditionMatin = {}
local conditionAM = {}
local conditionSoiree = {}
local conditionNoct = {}
local InfoJour = {}
local conditioncourante = {}
local huitHeures = {}
local Rep, cmd, jours, matin, apresmidi, soiree, nuit, delais, r, repsauv, l, fichier_init, MAJ, tc, dermodif, VilleAdresse, start, cmd1, ID
local Debug = "Problème Info "
local home = os.getenv("HOME")
--Liste des accents et carractère non pris en charge par les patterns
local pat="%é%è%à%ä%â%ê%ô%ç%É%È%À%Â%Ä%Ê%Ô%Ç'"


--Trouve ID
function Get_ID()
    local proc, ret
    proc=io.open("/proc/self/stat", "r")
    ret=proc:read():match("%d*")
    return ret
end

--Francisation alerte
function fran_alerte(d)
    if d:match("(attendue)") ~= nil and d:match("(entre)") ~= nil then
        d = d:gsub("entre", "au")
        d = d:gsub("attendue ", "attendue du "):gsub("attendues ", "attendues du ")
    end
    if d:match("(On s'attend à de la)") ~= nil and d:match("(entre)") ~= nil then
        d = d:gsub("entre", "et")
    end
    if d:match("(depuis)") ~= nil and d:match("(dans)") ~= nil then
        d = d:gsub("depuis", "à partir de"):gsub("jusqu'à", "à partir de")
    end

    d = d:gsub("depuis","à partir de"):gsub("tard la", "tard dans la"):gsub("lorsqu'elle deviendra de la", "se transformant en"):gsub("lorsqu'elle", "puis"):gsub("et s'accumulera de", "de"):gsub("avant de finir", "jusqu'à"):gsub("la nuit du", "dans la nuit de")

    return d
end

--Traduction date
function trad_date(d)
    local date = d
    date = date:gsub("Monday", "Lundi"):gsub("Tuesday", "Mardi"):gsub("Wednesday", "Mercredi"):gsub("Thursday", "Jeudi"):gsub("Friday", "Vendredi"):gsub("Saturday", "Samedi"):gsub("Sunday", "Dimanche")

    date = date:gsub("lun", "Lun"):gsub("mar", "Mar"):gsub("mer", "Mer"):gsub("jeu", "Jeu"):gsub("ven", "Ven"):gsub("sam", "Sam"):gsub("dim", "Dim")

    date = date:gsub("Mon", "Lun"):gsub("Tue", "Mar"):gsub("Wed", "Mer"):gsub("Thu", "Jeu"):gsub("Fri", "Ven"):gsub("Sat", "Sam"):gsub("Sun", "Dim")

    date = date:gsub("January", "Janvier"):gsub("February", "Février"):gsub("March", "Mars"):gsub("April", "Avril"):gsub("May", "Mai"):gsub("June", "Juin"):gsub("July", "Juillet"):gsub("August", "Août"):gsub("September", "Septembre"):gsub("October", "Octobre"):gsub("November", "Novembre"):gsub("December", "Décembre")

    date = date:gsub("jan", "Jan"):gsub("fev", "Fév"):gsub("mar", "Mar"):gsub("avr", "Avr"):gsub("mai", "Mai"):gsub("jui", "Jui"):gsub("aou", "Aoû"):gsub("sep", "Sep"):gsub("oct", "Oct"):gsub("nov", "Nov"):gsub("dec", "Déc")

    date = date:gsub("Feb", "Fév"):gsub("Apr", "Avr"):gsub("May", "Mai"):gsub("Jun", "Juin"):gsub("Jul", "Juil"):gsub("Aug", "Aoû"):gsub("Dec", "Déc")

    return date
end

--Vérifier l'existence d'un fichier
function existe(file)
  local a = io.open(file, "r")
  local present
  if a then
    present = true
    io.close(a)
  else
    present = false
  end
  return present
end

--Formatage des pages web
function string.formatage(ligne)
ligne = ligne:gsub("&#244;", "ô"):gsub("&#226;", "â"):gsub("&#233;", "é"):gsub("&#232;", "è"):gsub("&#224;", "à"):gsub("&#231;", "ç"):gsub("&#234;", "ê"):gsub("&#246;", "ö"):gsub("&#238;", "î"):gsub("&#239;", "ï"):gsub("&#251;", "û"):gsub("&#252;", "ü"):gsub("&#39;", "'"):gsub("Poudreries", "Bourrasques de neige"):gsub("&#201;", "É"):gsub("&#176;",""):gsub("[\n\r]",""):gsub("&eacute;", "é")
return ligne
end

--Infos lunaison
function lunaison(r)
    local s, web, Lune

    web="http://www.calendrier-lunaire.net/"
    icone="http://www.calendrier-lunaire.net/module/LYmFzaWMtODMtaDItMTQyNzI5NzY4OS40ODk2LSNmZmZmZmYtMjk1LSMwMDAwMDAtMTQyNzI5NzY4OS0xLTA.png"
    f=assert(io.popen("curl --max-time 60 --retry 3 --silent '"..web.."' | grep -A63 '\"TBdoubleColTD5\"' | sed 's/%//g'"))
    line=f:read()
    i=0
    for line in f:lines() do
        print(line)
        i=i+1
--        if i==37 then
--            icone=line:match("src=\"([%w%p]*)\"")
        if i==46 then
            ephemerides1, ephemerides2=line:formatage():match("</strong>(%a*) (%a*)</li>")
        elseif i==47 then
            Visibilite=line:match("</strong>(%d*) </li>")
        elseif i==53 then
            Phases1=line:formatage():match("title=\"([%a%p%d"..pat.."]*)\" /")
        elseif i==54 then
            Phases2=line:formatage():match("title=\"([%a%p%d"..pat.."]*)\" /")
            Phases=Phases1..", "..Phases2
        elseif i==59 then
            Noeud_lunaire=line:match("</strong>([%a%d%p%s"..pat.."]*)<img")
        elseif i==58 then
            Apogee=line:match("</strong>([%a%d%p%s"..pat.."]*)<img")
        elseif i==57 then
            Perigee=line:match("</strong>([%a%d%p%s"..pat.."]*)<img")
        elseif i==49 then
            Distance=line:match("</strong>(%d*) Km</li>")
        elseif i==50 then
            Age=line:match("</strong>([%a%d%s]*)</li>")
        elseif i==3 then
            Lever_LuneHeure, Lever_LuneMinute=line:match(": ([%d%p]*):([%d%p]*)</div>")
        elseif i==4 then
            Coucher_LuneHeure, Coucher_LuneMinute=line:match(": ([%d%p]*):([%d%p]*)</div>")
            if Coucher_LuneHeure==nil then
                Coucher_LuneHeure="N/A"
                Coucher_LuneMinute="N/A"
            end
        elseif i==51 then
            Eclipse_total=line:match("</strong> ([%a%p%d%s"..pat.."]*)</a>")
        end
    end
    f:close()
    if Noeud_lunaire:match("(%d+)") ~= nil then Noeud_lunaire = Noeud_lunaire:match("(%d+)") end

    if Apogee:match("(%d+)") ~= nil then Apogee = Apogee:match("(%d+)") end
    if Perigee:match("(%d+)") ~= nil then Perigee = Perigee:match("(%d+)") end
    ephemerides = ephemerides1.." "..ephemerides2
    Eclipse_total = datelune(Eclipse_total)
    s = "${exec wget --tries=3 -q -O "..r.."/lune.png http://www.calendrier-lunaire.net/"..icone.."}"
    conky_parse( s )
--    conky_parse( "${exec convert "..r.."/lune.png -transparent '#ffffff' "..r.."/lune.png}" )

end

function datelune(d)
    local j, m, a = d:gsub("Janvier", "01"):gsub("Février", "02"):gsub("Mars", "03"):gsub("Avril", "04"):gsub("Mais", "05"):gsub("Juin", "06"):gsub("Juillet", "07"):gsub("Août", "08"):gsub("Septembre", "09"):gsub("Octobre", "10"):gsub("Novembre", "11"):gsub("Décembre", "12"):match("le (%d+) (%d+) (%d+)")
    d = os.time{year=a, month=m, day=j}

    return d

end


--Détermine icône vent
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


--Renvoi vent direction pleine en toute lettre
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


--Détermine l'icône vent en tenant conte de la force du vent
function icone_vent(d, fo)

    local f = tonumber(fo)
    local n

    if f <= Palier then
        n = d
    elseif f <= Palier*2 then
        n = d + 17
    elseif f <= Palier*3 then
        n = d + 34
    elseif f >= (Palier*3)+1 then
        n = d + 51
    end

    if n <= 9 then
        n = "0"..n
    end

    return n

end


--Découpage descriptions sur deux lignes
function decoupage(d)

    local l1, l2, n, p1, p2, n1, n2, l1b, l2b, dm, dp
    if string.len(d) >= 22 then
        n = math.ceil(string.len(d)/2)
        dm = string.sub(d, 1, n)
        dp = string.sub(d, n)
        p1 = string.find(dp, " ")
        local b = 1
        p2 = nil
        if string.find(dm, ' ') then
            while p2 == nil do
                b = b+1
                p2 = string.find(dm, ' ', -b)
            end
        end
        if p1 ~= nil then p1 = n+p1-1 end

        if p1 == nil and p2 == nil then p1 = string.find(d, " ") end
        if p2 == nil then p2 = p1 end
        if p1 == nil then p1 = p2 end
        if p1-n >= n-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((22 - string.len(l1b))/2)
    l1 = string.rep(" ", n1)..l1b
    n2 = math.ceil((22 - string.len(l2b))/2)
    l2 = string.rep(" ", n2)..l2b

--Retour information avec espaces ligne 1 & 2 et sans espaces ligne 1 & 2
    return l1, l2, l1b, l2b

end


--initialisation paramètres
function conky_init(cfg)
    print("[\27[1;43mINFO\27[0m] "..cfg)
    notifyPartielle="oui"

    local pos1

    cfg = string.gsub(cfg, "~", home)
    cfg = string.gsub(cfg, "$HOME", home)
    fichier_init = cfg

    local file = assert(io.open(cfg, "rb") )
    local line = file:read()
    for line in file:lines() do
        pos1 = string.find(line, '#')
        if pos1 ~= nil then
            line = string.sub(line, 1, pos1-1)
        end
        pos1 = string.find(line, '=')
        if string.find(line, 'repsauv=') ~= nil then
            repsauv = string.sub(line, pos1+1)
        elseif string.find(line, 'TempShell=') ~= nil then
            r = string.sub(line, pos1+1)
        elseif string.find(line, 'repscript=') ~= nil then
            repscript = string.sub(line, pos1+1)
        elseif string.find(line, 'web=') ~= nil then
            cmd1 = string.sub(line, pos1+1)
        elseif string.find(line, 'periode=') ~= nil then
            jours = string.sub(line, pos1+1)
        elseif string.find(line, 'matinée=') ~= nil then
            matin = string.sub(line, pos1+1)
        elseif string.find(line, 'am=') ~= nil then
            apresmidi = string.sub(line, pos1+1)
        elseif string.find(line, 'soiree=') ~= nil then
            soiree = string.sub(line, pos1+1)
        elseif string.find(line, 'nuit=') ~= nil then
            nuit = string.sub(line, pos1+1)
        elseif string.find(line, 'Prev8heures=') ~= nil then
            huit = string.sub(line, pos1+1)
        elseif string.find(line, 'Palier=') ~= nil then
            Palier = tonumber(string.sub(line, pos1+1))
        elseif string.find(line, 'update=') ~= nil then
            delais = string.sub(line, pos1+1)
        elseif string.find(line, 'notify=') ~= nil then
            notify = string.sub(line, pos1+1)
        elseif string.find(line, 'nbFoisHuit=') ~= nil then
            nbFoisHuit = string.sub(line, pos1+1)
        elseif string.find(line, 'notifyPartielle=') ~= nil then
            notifyPartielle = string.sub(line, pos1+1)
        end
    end
    io.close(file)
    ID = Get_ID()
    r = r:gsub("~", home):gsub("$HOME", home)
    repsauv = repsauv:gsub("~", home):gsub("$HOME", home)
    repscript = repscript:gsub("~", home):gsub("$HOME", home)

print("", "version = "..Version.."\n", "web = "..cmd1.."\n", "Pévision Nb jours = "..jours.."\n", "Pévision Matin = "..matin.."\n", "Pévision Après Midi = "..apresmidi.."\n", "Pévision Soirée = "..soiree.."\n", "Pévision Nuit = "..nuit.."\n","Prévision sur 8 heures = "..huit.."\n","nbFoisHuit= "..nbFoisHuit.."\n", "Délais = "..delais.."\n", "Chemin de travail = "..r.."\n","Palier = "..Palier.."\n", "Chemin de sauvegarde = "..repsauv.."\n", "Chemin script = "..repscript.."\n", "Notification = "..notify.."\n", "ID = "..ID)

--Création répertoire de travail
    cmd, l = cmd1:match("([%a%p%d]*)/[%a%p]*/([%d%p%a]*)")
    l1 = cmd:match("[%a%p]*/(%a*)/%d*")

    Rep = r.."/"..l1.."/"..l
    if os.execute("cd "..Rep) ~= 0 then
        os.execute("mkdir "..r.."/"..l1.."&& mkdir "..Rep)
    end

--initialisation compteurs
    t = os.time()-delais
    tc = t
    start = 1

--Vérification existence repsauv

    if os.execute("cd "..repsauv) ~= 0 then
--création de repsauv si inexistant
        local pos1 = 1
        local chemin = nil
        local cheminsup = nil
        while pos1 ~= nil do
            pos1 = string.find(repsauv, '/', pos1+1)
            if pos1 ~= nil then
                cheminsup = string.sub(repsauv, pos1)
                chemin = string.gsub(repsauv, cheminsup, "")
            else
                cheminsup = ""
                chemin = repsauv
            end
            if os.execute("cd "..chemin) ~= 0 then
                os.execute("mkdir "..chemin)
            end
        end
    end

    start=1

    MAJ ="0"

end

--Mise à jour météo
function conky_Meteo_Maj()

    local s = '${if_gw}${lua conky_Meteo_enligne}${else}${lua conky_Meteo_horsligne}${endif}'
    conky_parse( s )
    return " "
end

--hors ligne récupération de données
function conky_Meteo_horsligne()
    local value
    if dermodif2 == nil or dermodif2 ~= conky_parse("${exec date -r "..repsauv.."/CC '+%s'}") then
        dermodif2=conky_parse("${exec date -r "..repsauv.."/CC '+%s'}")
--Récupération dernière condition courante
        local file = assert(io.open(repsauv.."/CC", "r") )
        local line = file:read()
        local i = 0
        local donee = {}
        for line in file:lines() do
            i = i+1
            donee[i] = line
        end
        io.close(file)
        local t = {"Ville", "latitude", "longitude", "Cond", "Icone", "Temp", "Tempr", "VentDir", "VentForce", "Humidite", "Pression", "Uv", "CouvNuage", "Plafond", "PointRosee", "Visibilite", "Alerte", "HistoMaxJour", "HistoMaxNormalJour", "HistoMaxRecordJour", "HistoMax1Ans", "HistoMinJour", "HistoMinNormalJour", "HistoMinRecordJour", "HistoMin1Ans", "DateJour", "DateMois", "DateAnnee"}
        i=0
        for i = 1,table.getn(t) do
            donee[i]=donee[i]:match("[%a%p%d"..pat.."]*: ([%s%a%p%d"..pat.."]*)")
            value=donee[i]:match("(%d*)")
            if value ~= "" then
                donee[i] = value
            end
            conditioncourante[t[i]] = donee[i]
        end
--Récupération de l'heure de mise a jour
        time = donee[table.getn(t)+1]
        conditioncourante.Date = os.time{year=conditioncourante.DateAnnee, month=conditioncourante.DateMois, day=conditioncourante.DateJour, hour=0}
--Traitement condition courrante
        if conditioncourante.VentDir == "CLM" then
            conditioncourante.VentDir = "Calme"
            conditioncourante.VentForce = "0"
        end
        conditioncourante.Alerte = fran_alerte(conditioncourante.Alerte)
        conditioncourante.VentIcone = icone_vent(direction_vent(conditioncourante.VentDir), conditioncourante.VentForce)
        conditioncourante.VentPlein = vent_plein(conditioncourante.VentDir)
        conditioncourante.CondMeteo1, conditioncourante.CondMeteo2, conditioncourante.CondMeteo1se, conditioncourante.CondMeteo2se = decoupage(conditioncourante.Cond)
        conditioncourante.Alerte1, conditioncourante.Alerte2, conditioncourante.Alerte1se, conditioncourante.Alerte2se = decoupage(conditioncourante.Alerte)
        print("[\27[1;42m OK \27[0m] Condition courante")

--Récupération prévision

        for j = 1,jours do
            local file = assert(io.open(repsauv.."/Jour"..j, "r"))
            local line = file:read()
            local i = 0
            local donee = {}
            for line in file:lines() do
                i = i+1
                donee[i] = line
            end
            io.close(file)
            local infojournee = {}
            local t = {"VentDirJour", "VentForceJour", "VentDirNuit", "VentForceNuit", "VentRafalesJour", "VentRafalesNuit", "UvJour", "UvNuit", "ProbOrageJour", "ProbOrageNuit", "NivPrecJour", "NivPrecNuit", "QPluieJour", "QPluieNuit", "QNeigeJour", "QNeigeNuit", "EVerglasJour", "EVerglasNuit", "HeurePrecJour", "HeurePrecNuit", "HeurePluieJour", "HeurePluieNuit", "TempJour", "TempNuit", "RealFeelJour", "RealFeelNuit", "ProbPrecJour", "ProbPrecNuit", "CondMeteoJour", "CondMeteoNuit", "IconeJour", "IconeNuit", "HistoMaxJour", "HistoMaxNormalJour", "HistoMaxRecordJour", "HistoMax1Ans", "HistoMinJour", "HistoMinNormalJour", "HistoMinRecordJour", "HistoMin1Ans", "SoleilLever", "SoleilDuree", "SoleilCoucher", "LuneLever", "LuneDuree", "LuneCoucher", "DateJour", "DateMois", "DateAnnee"}
            i=0
            for i = 1,table.getn(t) do
                donee[i]=donee[i]:match("[%a%p%d"..pat.."]*: ([%s%a%p%d"..pat.."]*)")
                if donee[i]:find(":") == nil then
                    value=donee[i]:match("(%d*)")
                    if value ~= "" then
                        donee[i] = value
                    end
                end
                infojournee[t[i]] = donee[i]
            end

--Trie des infos
            local info = {}
            local y ={"VentDirJour", "VentForceJour", "VentRafalesJour", "UvJour", "ProbOrageJour", "NivPrecJour", "QPluieJour", "QNeigeJour", "EVerglasJour", "HeurePrecJour", "HeurePluieJour", "TempJour", "RealFeelJour", "ProbPrecJour", "CondMeteoJour", "IconeJour"}
            local t = {"VentDir", "VentForce", "VentRafales", "Uv", "ProbOrage", "NivPrec", "QPluie", "QNeige", "EVerglas", "HrPrecJour", "HrPluieJour", "Temp", "TempRes", "ProbPrec", "CondMeteo",  "Icone"}
            conditionJour[j] = {}
            i=0
            for i = 1, table.getn(t) do
                info[t[i]] = infojournee[y[i]]
            end
            conditionJour[j] = info
            local info1 = {}
            local y = {"VentDirNuit", "VentForceNuit", "VentRafalesNuit", "UvNuit", "ProbOrageNuit", "NivPrecNuit", "QPluieNuit", "QNeigeNuit", "EVerglasNuit", "HeurePrecNuit", "HeurePluieNuit", "TempNuit", "RealFeelNuit", "ProbPrecNuit", "CondMeteoNuit", "IconeNuit"}
            local t = {"VentDir", "VentForce", "VentRafales", "Uv", "ProbOrage", "NivPrec", "QPluie", "QNeige", "EVerglas", "HrPrecNuit", "HrPluieNuit", "Temp", "TempRes", "ProbPrec", "CondMeteo", "Icone"}
            conditionNuit[j] = {}
            i=0
            for i = 1, table.getn(t) do
                info1[t[i]] = infojournee[y[i]]
            end
            conditionNuit[j] = info1
            local info2 = {}

            InfoJour[j] = {}
            InfoJour[j].Jour = os.time{year=infojournee.DateAnnee, month=infojournee.DateMois, day=infojournee.DateJour, hour=0}
            InfoJour[j].LeverSoleilH, InfoJour[j].LeverSoleilM = infojournee.SoleilLever:match("(%d*):(%d*)")
            InfoJour[j].CoucherSoleilH, InfoJour[j].CoucherSoleilM = infojournee.SoleilCoucher:match("(%d*):(%d*)")
            InfoJour[j].Histo_Max =infojournee.HistoMax1Ans
            InfoJour[j].Histo_Min =infojournee.HistoMin1Ans

--Traitement condition courrante
            if conditionJour[j].VentDir == "CLM" then
                conditionJour[j].VentDir = "Calme"
                conditionJour[j].VentForce = "0"
            end
            conditionJour[j].VentIcone = icone_vent(direction_vent(conditionJour[j].VentDir), conditionJour[j].VentForce)
            conditionJour[j].RafalesIcone = icone_vent(direction_vent(conditionJour[j].VentDir), conditionJour[j].VentRafales)
            conditionJour[j].VentP = vent_plein(conditionJour[j].VentDir)
            conditionJour[j].CondMeteo1, conditionJour[j].CondMeteo2, conditionJour[j].CondMeteo1se, conditionJour[j].CondMeteo2se = decoupage(conditionJour[j].CondMeteo)
            if conditionNuit[j].VentDir == "Calme" then
                conditionNuit[j].VentForce = "0"
            end
            conditionNuit[j].VentIcone = icone_vent(direction_vent(conditionNuit[j].VentDir), conditionNuit[j].VentForce)
            conditionNuit[j].RafalesIcone = icone_vent(direction_vent(conditionNuit[j].VentDir), conditionNuit[j].VentRafales)
            conditionNuit[j].VentP = vent_plein(conditionNuit[j].VentDir)
            conditionNuit[j].CondMeteo1, conditionNuit[j].CondMeteo2, conditionNuit[j].CondMeteo1se, conditionNuit[j].CondMeteo2se = decoupage(conditionNuit[j].CondMeteo)
            print("[\27[1;42m OK \27[0m] Prévision "..j)

--Récupération quart de journée
            local t = {"CondMeteo", "Icone", "TempMin", "TempMax", "TempMinR", "TempMaxR", "VentDir", "VentForce", "ProbPrec", "QPluie", "QNeige", "Humidite", "CouvNuage", "PointRosee", "Visibilite"}
            if matin == "oui" then
                local file = assert(io.open(repsauv.."/Matin"..j, "r"))
                local line = file:read()
                local i = 0
                local donee = {}
                for line in file:lines() do
                    i = i+1
                    donee[i] = line
                end
                conditionMatin[j] = {}
                local info3 = {}
                for i = 1,table.getn(t) do
                    donee[i]=donee[i]:match("[%a%p%d"..pat.."]*: ([%s%a%p%d"..pat.."]*)")
                    value=donee[i]:match("(%d*)")
                    if value ~= "" then
                        donee[i] = value
                    end
                    info3[t[i]] = donee[i]
                end
                conditionMatin[j] = info3
                io.close(file)
                if conditionMatin[j].VentDir == "CLM" then
                    conditionMatin[j].VentDir = "Calme"
                    conditionMatin[j].VentForce = "0"
                end
                conditionMatin[j].VentIcone = icone_vent(direction_vent(conditionMatin[j].VentDir), conditionMatin[j].VentForce)
                conditionMatin[j].VentP = vent_plein(conditionMatin[j].VentDir)
                conditionMatin[j].CondMeteo1, conditionMatin[j].CondMeteo2, conditionMatin[j].CondMeteo1se, conditionMatin[j].CondMeteo2se = decoupage(conditionMatin[j].CondMeteo)
                print("[\27[1;42m OK \27[0m] Matin "..j)
            end


            if apresmidi == "oui" then
                local file = assert(io.open(repsauv.."/AM"..j, "r"))
                local line = file:read()
                local i = 0
                local donee = {}
                for line in file:lines() do
                    i = i+1
                    donee[i] = line
                end
                conditionAM[j] = {}
                local info3 = {}
                for i = 1,table.getn(t) do
                    donee[i]=donee[i]:match("[%a%p%d"..pat.."]*: ([%s%a%p%d"..pat.."]*)")
                    value=donee[i]:match("(%d*)")
                    if value ~= "" then
                        donee[i] = value
                    end
                    info3[t[i]] = donee[i]
                end
                conditionAM[j] = info3
                io.close(file)
                if conditionAM[j].VentDir == "CLM" then
                    conditionAM[j].VentDir = "Calme"
                    conditionAM[j].VentForce = "0"
                end
                conditionAM[j].VentIcone = icone_vent(direction_vent(conditionAM[j].VentDir), conditionAM[j].VentForce)
                conditionAM[j].VentP = vent_plein(conditionAM[j].VentDir)
                conditionAM[j].CondMeteo1, conditionAM[j].CondMeteo2, conditionAM[j].CondMeteo1se, conditionAM[j].CondMeteo2se = decoupage(conditionAM[j].CondMeteo)
                print("[\27[1;42m OK \27[0m] Apres Midi "..j)
            end


            if soiree == "oui" then
                local file = assert(io.open(repsauv.."/Soiree"..j, "r"))
                local line = file:read()
                local i = 0
                local donee = {}
                for line in file:lines() do
                    i = i+1
                    donee[i] = line
                end
                io.close(file)
                conditionSoiree[j] = {}
                local info3 = {}
                for i = 1,table.getn(t) do
                    donee[i]=donee[i]:match("[%a%p%d"..pat.."]*: ([%s%a%p%d"..pat.."]*)")
                    value=donee[i]:match("(%d*)")
                    if value ~= "" then
                        donee[i] = value
                    end
                    info3[t[i]] = donee[i]
                end
                conditionSoiree[j] = info3
                if conditionSoiree[j].VentDir == "CLM" then
                    conditionSoiree[j].VentDir = "Calme"
                    conditionSoiree[j].VentForce = "0"
                end
                conditionSoiree[j].VentIcone = icone_vent(direction_vent(conditionSoiree[j].VentDir), conditionSoiree[j].VentForce)
                conditionSoiree[j].VentP = vent_plein(conditionSoiree[j].VentDir)
                conditionSoiree[j].CondMeteo1, conditionSoiree[j].CondMeteo2, conditionSoiree[j].CondMeteo1se, conditionSoiree[j].CondMeteo2se = decoupage(conditionSoiree[j].CondMeteo)
                print("[\27[1;42m OK \27[0m] Soiree "..j)
            end

            if nuit == "oui" then
                local file = assert(io.open(repsauv.."/Nuit"..j, "r"))
                local line = file:read()
                local i = 0
                local donee = {}
                for line in file:lines() do
                    i = i+1
                    donee[i] = line
                end
                io.close(file)
                conditionNoct[j] = {}
                local info3 = {}
                for i = 1,table.getn(t) do
                    donee[i]=donee[i]:match("[%a%p%d"..pat.."]*: ([%s%a%p%d"..pat.."]*)")
                    value=donee[i]:match("(%d*)")
                    if value ~= "" then
                        donee[i] = value
                    end
                    info3[t[i]] = donee[i]
                end
                conditionNoct[j] = info3
                if conditionNoct[j].VentDir == "CLM" then
                    conditionNoct[j].VentDir = "Calme"
                    conditionNoct[j].VentForce = "0"
                end
                conditionNoct[j].VentIcone = icone_vent(direction_vent(conditionNoct[j].VentDir), conditionNoct[j].VentForce)
                conditionNoct[j].VentP = vent_plein(conditionNoct[j].VentDir)
                conditionNoct[j].CondMeteo1, conditionNoct[j].CondMeteo2, conditionNoct[j].CondMeteo1se, conditionNoct[j].CondMeteo2se = decoupage(conditionNoct[j].CondMeteo)
                print("[\27[1;42m OK \27[0m] Nuit "..j)
            end
        end


        if huit == "oui" then
            local info4 = {}
            local info3 = {}
            for y = 1,nbFoisHuit do
                local file = assert(io.open(repsauv.."/huitHeures"..y, "r"))
                t = {"Heure", "TempMax", "TempMaxR", "Humidite", "Pluie", "Neige", "Verglas", "Vent", "UV", "CouvNuage", "PointRosee", "Icone"}

                local line = file:read()
                local i = 0
                local donee = {}
                for line in file:lines() do
                    i = i+1
                    donee[i] = line
                end
                io.close(file)
                for j = 1,8 do
                    x=j+((y-1)*8)
                    huitHeures[x] = {}
                    info3[x] = {}
                end
                x=0
                for i = 1,table.getn(t) do
                    for j = 1,8 do
                        x=x+1
                        local k=j+((y-1)*8)
                        donee[x]=donee[x]:match("[%a%p%d"..pat.."]*: ([%s%a%p%d"..pat.."]*)")
                        if i ~= 8 then
                            value=donee[x]:match("(%d*)")
                            if value ~= "" then
                                donee[x] = value
                            end
                        end
                        table.insert(info3[k],i,donee[x])
                    end
                end
            end
            for j = 1,8*nbFoisHuit do
                info4 = {}
                for i = 1,table.getn(t) do
                    info4[t[i]]=info3[j][i]
                end
                huitHeures[j]=info4
                huitHeures[j].VentForce, huitHeures[j].VentDir=huitHeures[j].Vent:match("(%d*) (%a*)")
                if huitHeures[j].VentDir == "CLM" then
                    huitHeures[j].VentDir = "Calme"
                    huitHeures[j].VentForce = "0"
                end
                huitHeures[j].VentIcone = icone_vent(direction_vent(huitHeures[j].VentDir), huitHeures[j].VentForce)
                huitHeures[j].VentP = vent_plein(huitHeures[j].VentDir)
            end
            print("[\27[1;42m OK \27[0m] huit heures")
        end

--Récupération lunaison
        local file = assert(io.open(repsauv.."/lunaison", "r"))
        local line = file:read()
        local i = 0
        local donee = {}
        for line in file:lines() do
            i = i+1
            donee[i] = line
        end
        ephemerides = donee[1]
        ephemerides1 = donee[2]
        ephemerides2 = donee[3]
        Visibilite = donee[4]
        Phases = donee[5]
        Phases1 = donee[6]
        Phases2 = donee[7]
        Noeud_lunaire = donee[8]
        Apogee = donee[9]
        Perigee = donee[10]
        Distance = donee[11]
        Age = donee[12]
        Lever_LuneHeure = donee[13]
        Lever_LuneMinute = donee[14]
        Coucher_LuneHeure = donee[15]
        Coucher_LuneMinute = donee[16]
        Eclipse_total = donee[17]
        io.close(file)


        if MAJ == "0" then
            MAJ = "1"
        else
            MAJ = "0"
        end


        collectgarbage()
    end
    return ""
end

--en ligne mise à jour
function conky_Meteo_enligne()
    if start==1 then
--      os.execute("pkill -f \"python "..repscript.."/recmeteo_python_2.py adressWeb="..cmd1.." repsauv="..repsauv.." huitHeures="..huit.." nbFoisHuit="..nbFoisHuit.." nbJour="..jours.." interval="..delais.." matin="..matin.." apresmidi="..apresmidi.." soiree="..soiree.." nuit="..nuit.." notify="..notify.."\"")
        os.execute("python3 "..repscript.."/recmeteo.py adressWeb="..cmd1.." repsauv="..repsauv.." huitHeures="..huit.." nbFoisHuit="..nbFoisHuit.." nbJour="..jours.." interval="..delais.." matin="..matin.." apresmidi="..apresmidi.." soiree="..soiree.." nuit="..nuit.." notify="..notify.." notifyPartielle="..notifyPartielle.." id="..ID.." demon=oui MAJP=oui &")
    end
    if dermodif == nil or dermodif ~= conky_parse("${exec date -r "..repsauv.."/CC '+%s'}") then
        dermodif=conky_parse("${exec date -r "..repsauv.."/CC '+%s'}")
            if 3600 <= os.difftime(os.time(), tc) or start == 1 then
                start = 2
                tc = os.time()
--                lunaison(r)
--                print("[\27[1;42m OK \27[0m] lunaison")
                if repsauv ~= nil then
--lancement sauvegarde
                    sauvegarde()
                end
            end
            conky_Meteo_horsligne()

        collectgarbage()
    end
    return " "
end


--Retour d'information météo

--Condition courrante

function conky_Meteo_IconeM(r, x, y, w, h)
    conky_fDrawImage(r.."/icone_meteo/"..conditioncourante.Icone..".png", x, y, w, h)
    return ""
end

function conky_Meteo_TempRes()
    return conditioncourante.Tempr
end

function conky_Meteo_TempAct()
    return conditioncourante.Temp
end

function conky_Meteo_CondMeteo()
    return conditioncourante.Cond
end

function conky_Meteo_CondMeteo1()
    return conditioncourante.CondMeteo1
end

function conky_Meteo_CondMeteo2()
    return conditioncourante.CondMeteo2
end

function conky_Meteo_CondMeteo1se()
    return conditioncourante.CondMeteo1se
end

function conky_Meteo_CondMeteo2se()
    return conditioncourante.CondMeteo2se
end

function conky_Meteo_Alerte()
    return conditioncourante.Alerte
end

function conky_Meteo_Alerte1()
    return conditioncourante.Alerte1
end

function conky_Meteo_Alerte2()
    return conditioncourante.Alerte2
end

function conky_Meteo_Alerte1se()
    return conditioncourante.Alerte1se
end

function conky_Meteo_Alerte2se()
    return conditioncourante.Alerte2se
end

function conky_Meteo_VentDir()
    return conditioncourante.VentDir
end

function conky_Meteo_VentDirP()
    return conditioncourante.VentPlein
end

function conky_Meteo_VentForce()
    return conditioncourante.VentForce
end

function conky_Meteo_IconeV(r, x, y, w, h)
    conky_fDrawImage(r.."/vent/"..conditioncourante.VentIcone..".png", x, y, w, h)
    return ""
end

function conky_Meteo_Humidite()
    return tonumber(conditioncourante.Humidite)
end

function conky_Meteo_Rose()
    return tonumber(conditioncourante.PointRosee)
end

function conky_Meteo_Pression()
    return tonumber(conditioncourante.Pression)
end

function conky_Meteo_Visibilite()
    return tonumber(conditioncourante.Visibilite)
end

function conky_Meteo_Date(format)
    format = string.gsub(format, "_", " ")
    return trad_date(os.date(format, conditioncourante.Date))
end

function conky_Meteo_Ville()
    return conditioncourante.Ville
end

function conky_Meteo_CouvNuage()
    return tonumber(conditioncourante.CouvNuage)
end

function conky_Meteo_Uv()
    return conditioncourante.Uv
end

function conky_Meteo_latitude()
    return conditioncourante.latitude
end

function conky_Meteo_longitude()
    return conditioncourante.longitude
end

function conky_Meteo_Heure()
    return os.date("%H")
end

function conky_Meteo_Minute()
    return os.date("%M")
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_ProbPrec(j)
    return tonumber(conditionJour[tonumber(j)].ProbPrec)
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_VentRafales(j)
    return tonumber(conditionJour[tonumber(j)].VentRafales)
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_EVerglas(j)
    return tonumber(conditionJour[tonumber(j)].EVerglas)
end

function conky_Meteo_Jour_IconeM(r, x, y, w, h, j)
    conky_fDrawImage(r.."/icone_meteo/"..conditionJour[tonumber(j)].Icone..".png", x, y, w, h)
    return ""
end

function conky_Meteo_Jour_IconeV(r, x, y, w, h, j)
    conky_fDrawImage(r.."/vent/"..conditionJour[tonumber(j)].VentIcone..".png", x, y, w, h)
    return ""
end

function conky_Meteo_Jour_IconeR(r, x, y, w, h, j)
    conky_fDrawImage(r.."/vent/"..conditionJour[tonumber(j)].RafalesIcone..".png", x, y, w, h)
    return ""
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_ProbPrec(j)
    return tonumber(conditionNuit[tonumber(j)].ProbPrec)
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_VentRafales(j)
    return tonumber(conditionNuit[tonumber(j)].VentRafales)
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_EVerglas(j)
    return tonumber(conditionNuit[tonumber(j)].EVerglas)
end

function conky_Meteo_Nuit_IconeM(r, x, y, w, h, j)
    conky_fDrawImage(r.."/icone_meteo/"..conditionNuit[tonumber(j)].Icone..".png", x, y, w, h)
    return ""
end

function conky_Meteo_Nuit_IconeV(r, x, y, w, h, j)
    conky_fDrawImage(r.."/vent/"..conditionNuit[tonumber(j)].VentIcone..".png", x, y, w, h)
    return ""
end

function conky_Meteo_Nuit_IconeR(r, x, y, w, h, j)
    conky_fDrawImage(r.."/vent/"..conditionNuit[tonumber(j)].RafalesIcone..".png", x, y, w, h)
    return ""
end


--Infos sur la journée

function conky_Meteo_Jour(format, j)
    format = string.gsub(format, "_", " ")
    return trad_date(os.date(format, InfoJour[tonumber(j)].Jour))
end

function conky_Meteo_HLeverSoleil(j)
    return InfoJour[tonumber(j)].LeverSoleilH
end

function conky_Meteo_MLeverSoleil(j)
    return InfoJour[tonumber(j)].LeverSoleilM
end

function conky_Meteo_LeverSoleil(j)
    return tonumber((InfoJour[tonumber(j)].LeverSoleilH*60)+InfoJour[tonumber(j)].LeverSoleilM)
end

function conky_Meteo_HCoucherSoleil(j)
    return InfoJour[tonumber(j)].CoucherSoleilH
end

function conky_Meteo_MCoucherSoleil(j)
    return InfoJour[tonumber(j)].CoucherSoleilM
end

function conky_Meteo_CoucherSoleil(j)
    return tonumber((InfoJour[tonumber(j)].CoucherSoleilH*60)+InfoJour[tonumber(j)].CoucherSoleilM)
end

function conky_Meteo_HDureeJour(j)
    return InfoJour[tonumber(j)].CoucherSoleilH-InfoJour[tonumber(j)].LeverSoleilH
end

function conky_Meteo_MDureeJour(j)
    return os.date("%M", ((((InfoJour[tonumber(j)].CoucherSoleilH*3600)-3600)+(InfoJour[tonumber(j)].CoucherSoleilM*60))-(((InfoJour[tonumber(j)].LeverSoleilH*3600))+(InfoJour[tonumber(j)].LeverSoleilM*60))))
end

function conky_Meteo_Histo_Min(j)
    return InfoJour[tonumber(j)].Histo_Min
end

function conky_Meteo_Histo_Max(j)
    return InfoJour[tonumber(j)].Histo_Max
end


--Matin

function conky_Meteo_Matin_CondMeteo(j)
    return conditionMatin[tonumber(j)].CondMeteo
end

function conky_Meteo_Matin_CondMeteo1(j)
    return conditionMatin[tonumber(j)].CondMeteo1
end

function conky_Meteo_Matin_CondMeteo2(j)
    return conditionMatin[tonumber(j)].CondMeteo2
end

function conky_Meteo_Matin_CondMeteo1se(j)
    return conditionMatin[tonumber(j)].CondMeteo1se
end

function conky_Meteo_Matin_CondMeteo2se(j)
    return conditionMatin[tonumber(j)].CondMeteo2se
end

function conky_Meteo_Matin_TempMax(j)
    return tonumber(conditionMatin[tonumber(j)].TempMax)
end

function conky_Meteo_Matin_TempMin(j)
    return tonumber(conditionMatin[tonumber(j)].TempMin)
end

function conky_Meteo_Matin_TempMaxRes(j)
    return tonumber(conditionMatin[tonumber(j)].TempMaxR)
end

function conky_Meteo_Matin_TempMinRes(j)
    return tonumber(conditionMatin[tonumber(j)].TempMinR)
end

function conky_Meteo_Matin_ProbPrec(j)
    return tonumber(conditionMatin[tonumber(j)].ProbPrec)
end

function conky_Meteo_Matin_VentDir(j)
    return conditionMatin[tonumber(j)].VentDir
end

function conky_Meteo_Matin_VentDirP(j)
    return conditionMatin[tonumber(j)].VentP
end

function conky_Meteo_Matin_VentForce(j)
    return tonumber(conditionMatin[tonumber(j)].VentForce)
end

function conky_Meteo_Matin_QPluie(j)
    return tonumber(conditionMatin[tonumber(j)].QPluie)
end

function conky_Meteo_Matin_QNeige(j)
    return tonumber(conditionMatin[tonumber(j)].QNeige)
end

function conky_Meteo_Matin_Humidite(j)
    return tonumber(conditionMatin[tonumber(j)].Humidite)
end

function conky_Meteo_Matin_CouvNuage(j, r)
    if r == nil then r = 100 end
    local Couv = (tonumber(conditionMatin[tonumber(j)].CouvNuage) / 100) * r
    if Couv - math.floor(Couv) <= 0.5 then
        Couv = math.floor(Couv)
    else
        Couv = math.ceil(Couv)
    end
    return Couv
end

function conky_Meteo_Matin_Rose(j)
    return tonumber(conditionMatin[tonumber(j)].PointRosee)
end

function conky_Meteo_Matin_Visibilite(j)
    return tonumber(conditionMatin[tonumber(j)].Visibilite)
end

function conky_Meteo_Matin_IconeM(r, x, y, w, h, j)
    conky_fDrawImage(r.."/icone_meteo/"..conditionMatin[tonumber(j)].Icone..".png", x, y, w, h)
    return ""
end

function conky_Meteo_Matin_IconeV(r, x, y, w, h, j)
    conky_fDrawImage(r.."/vent/"..conditionMatin[tonumber(j)].VentIcone..".png", x, y, w, h)
    return ""
end


--Après Midi

function conky_Meteo_AM_CondMeteo(j)
    return conditionAM[tonumber(j)].CondMeteo
end

function conky_Meteo_AM_CondMeteo1(j)
    return conditionAM[tonumber(j)].CondMeteo1
end

function conky_Meteo_AM_CondMeteo2(j)
    return conditionAM[tonumber(j)].CondMeteo2
end

function conky_Meteo_AM_CondMeteo1se(j)
    return conditionAM[tonumber(j)].CondMeteo1se
end

function conky_Meteo_AM_CondMeteo2se(j)
    return conditionAM[tonumber(j)].CondMeteo2se
end

function conky_Meteo_AM_TempMax(j)
    return tonumber(conditionAM[tonumber(j)].TempMax)
end

function conky_Meteo_AM_TempMin(j)
    return tonumber(conditionAM[tonumber(j)].TempMin)
end

function conky_Meteo_AM_TempMaxRes(j)
    return tonumber(conditionAM[tonumber(j)].TempMaxR)
end

function conky_Meteo_AM_TempMinRes(j)
    return tonumber(conditionAM[tonumber(j)].TempMinR)
end

function conky_Meteo_AM_ProbPrec(j)
    return tonumber(conditionAM[tonumber(j)].ProbPrec)
end

function conky_Meteo_AM_VentDir(j)
    return conditionAM[tonumber(j)].VentDir
end

function conky_Meteo_AM_VentDirP(j)
    return conditionAM[tonumber(j)].VentP
end

function conky_Meteo_AM_VentForce(j)
    return tonumber(conditionAM[tonumber(j)].VentForce)
end

function conky_Meteo_AM_QPluie(j)
    return tonumber(conditionAM[tonumber(j)].QPluie)
end

function conky_Meteo_AM_QNeige(j)
    return tonumber(conditionAM[tonumber(j)].QNeige)
end

function conky_Meteo_AM_Humidite(j)
    return tonumber(conditionAM[tonumber(j)].Humidite)
end

function conky_Meteo_AM_CouvNuage(j, r)
    if r == nil then r = 100 end
    local Couv = (tonumber(conditionAM[tonumber(j)].CouvNuage) / 100) * r
    if Couv - math.floor(Couv) <= 0.5 then
        Couv = math.floor(Couv)
    else
        Couv = math.ceil(Couv)
    end
    return Couv
end

function conky_Meteo_AM_Rose(j)
    return tonumber(conditionAM[tonumber(j)].PointRosee)
end

function conky_Meteo_AM_Visibilite(j)
    return tonumber(conditionAM[tonumber(j)].Visibilite)
end

function conky_Meteo_AM_IconeM(r, x, y, w, h, j)
    conky_fDrawImage(r.."/icone_meteo/"..conditionAM[tonumber(j)].Icone..".png", x, y, w, h)
    return ""
end

function conky_Meteo_AM_IconeV(r, x, y, w, h, j)
    conky_fDrawImage(r.."/vent/"..conditionAM[tonumber(j)].VentIcone..".png", x, y, w, h)
    return ""
end


--Soirée

function conky_Meteo_Soiree_CondMeteo(j)
    return conditionSoiree[tonumber(j)].CondMeteo
end

function conky_Meteo_Soiree_CondMeteo1(j)
    return conditionSoiree[tonumber(j)].CondMeteo1
end

function conky_Meteo_Soiree_CondMeteo2(j)
    return conditionSoiree[tonumber(j)].CondMeteo2
end

function conky_Meteo_Soiree_CondMeteo1se(j)
    return conditionSoiree[tonumber(j)].CondMeteo1se
end

function conky_Meteo_Soiree_CondMeteo2se(j)
    return conditionSoiree[tonumber(j)].CondMeteo2se
end

function conky_Meteo_Soiree_TempMax(j)
    return tonumber(conditionSoiree[tonumber(j)].TempMax)
end

function conky_Meteo_Soiree_TempMin(j)
    return tonumber(conditionSoiree[tonumber(j)].TempMin)
end

function conky_Meteo_Soiree_TempMaxRes(j)
    return tonumber(conditionSoiree[tonumber(j)].TempMaxR)
end

function conky_Meteo_Soiree_TempMinRes(j)
    return tonumber(conditionSoiree[tonumber(j)].TempMinR)
end

function conky_Meteo_Soiree_ProbPrec(j)
    return tonumber(conditionSoiree[tonumber(j)].ProbPrec)
end

function conky_Meteo_Soiree_VentDir(j)
    return conditionSoiree[tonumber(j)].VentDir
end

function conky_Meteo_Soiree_VentDirP(j)
    return conditionSoiree[tonumber(j)].VentP
end

function conky_Meteo_Soiree_VentForce(j)
    return tonumber(conditionSoiree[tonumber(j)].VentForce)
end

function conky_Meteo_Soiree_QPluie(j)
    return tonumber(conditionSoiree[tonumber(j)].QPluie)
end

function conky_Meteo_Soiree_QNeige(j)
    return tonumber(conditionSoiree[tonumber(j)].QNeige)
end

function conky_Meteo_Soiree_Humidite(j)
    return tonumber(conditionSoiree[tonumber(j)].Humidite)
end

function conky_Meteo_Soiree_CouvNuage(j, r)
    if r == nil then r = 100 end
    local Couv = (tonumber(conditionSoiree[tonumber(j)].CouvNuage) / 100) * r
    if Couv - math.floor(Couv) <= 0.5 then
        Couv = math.floor(Couv)
    else
        Couv = math.ceil(Couv)
    end
    return Couv
end

function conky_Meteo_Soiree_Rose(j)
    return tonumber(conditionSoiree[tonumber(j)].PointRosee)
end

function conky_Meteo_Soiree_Visibilite(j)
    return tonumber(conditionSoiree[tonumber(j)].Visibilite)
end

function conky_Meteo_Soiree_IconeM(r, x, y, w, h, j)
    conky_fDrawImage(r.."/icone_meteo/"..conditionSoiree[tonumber(j)].Icone..".png", x, y, w, h)
    return ""
end

function conky_Meteo_Soiree_IconeV(r, x, y, w, h, j)
    conky_fDrawImage(r.."/vent/"..conditionSoiree[tonumber(j)].VentIcone..".png", x, y, w, h)
    return ""
end


--Nuit

function conky_Meteo_Noct_CondMeteo(j)
    return conditionNoct[tonumber(j)].CondMeteo
end

function conky_Meteo_Noct_CondMeteo1(j)
    return conditionNoct[tonumber(j)].CondMeteo1
end

function conky_Meteo_Noct_CondMeteo2(j)
    return conditionNoct[tonumber(j)].CondMeteo2
end

function conky_Meteo_Noct_CondMeteo1se(j)
    return conditionNoct[tonumber(j)].CondMeteo1se
end

function conky_Meteo_Noct_CondMeteo2se(j)
    return conditionNoct[tonumber(j)].CondMeteo2se
end

function conky_Meteo_Noct_TempMax(j)
    return tonumber(conditionNoct[tonumber(j)].TempMax)
end

function conky_Meteo_Noct_TempMin(j)
    return tonumber(conditionNoct[tonumber(j)].TempMin)
end

function conky_Meteo_Noct_TempMaxRes(j)
    return tonumber(conditionNoct[tonumber(j)].TempMaxR)
end

function conky_Meteo_Noct_TempMinRes(j)
    return tonumber(conditionNoct[tonumber(j)].TempMinR)
end

function conky_Meteo_Noct_ProbPrec(j)
    return tonumber(conditionNoct[tonumber(j)].ProbPrec)
end

function conky_Meteo_Noct_VentDir(j)
    return conditionNoct[tonumber(j)].VentDir
end

function conky_Meteo_Noct_VentDirP(j)
    return conditionNoct[tonumber(j)].VentP
end

function conky_Meteo_Noct_VentForce(j)
    return tonumber(conditionNoct[tonumber(j)].VentForce)
end

function conky_Meteo_Noct_QPluie(j)
    return tonumber(conditionNoct[tonumber(j)].QPluie)
end

function conky_Meteo_Noct_QNeige(j)
    return tonumber(conditionNoct[tonumber(j)].QNeige)
end

function conky_Meteo_Noct_Humidite(j)
    return tonumber(conditionNoct[tonumber(j)].Humidite)
end

function conky_Meteo_Noct_CouvNuage(j, r)
    if r == nil then r = 100 end
    local Couv = (tonumber(conditionNoct[tonumber(j)].CouvNuage) / 100) * r
    if Couv - math.floor(Couv) <= 0.5 then
        Couv = math.floor(Couv)
    else
        Couv = math.ceil(Couv)
    end
    return Couv
end

function conky_Meteo_Noct_Rose(j)
    return tonumber(conditionNoct[tonumber(j)].PointRosee)
end

function conky_Meteo_Noct_Visibilite(j)
    return tonumber(conditionNoct[tonumber(j)].Visibilite)
end

function conky_Meteo_Noct_IconeM(r, x, y, w, h, j)
    conky_fDrawImage(r.."/icone_meteo/"..conditionNoct[tonumber(j)].Icone..".png", x, y, w, h)
    return ""
end

function conky_Meteo_Noct_IconeV(r, x, y, w, h, j)
    conky_fDrawImage(r.."/vent/"..conditionNoct[tonumber(j)].VentIcone..".png", x, y, w, h)
    return ""
end

--Huit prochaines heures


function conky_Meteo_huitHeures_VentDirP(j)
    return huitHeures[tonumber(j)].VentP
end

function conky_Meteo_huitHeures_IconeV(r, x, y, w, h, j)
    conky_fDrawImage(r.."/vent/"..huitHeures[tonumber(j)].VentIcone..".png", x, y, w, h)
    return ""
end

function conky_Meteo_huitHeures_Heure(j)
    return tonumber(huitHeures[tonumber(j)].Heure)
end

function conky_Meteo_huitHeures_IconeM(r, x, y, w, h, j)
    conky_fDrawImage(r.."/icone_meteo/"..huitHeures[tonumber(j)].Icone..".png", x, y, w, h)
    return ""
end

function conky_Meteo_huitHeures_Temp(j)
    return tonumber(huitHeures[tonumber(j)].TempMax)
end

function conky_Meteo_huitHeures_TempR(j)
    return tonumber(huitHeures[tonumber(j)].TempMaxR)
end

function conky_Meteo_huitHeures_VentDir(j)
    return huitHeures[tonumber(j)].VentDir
end

function conky_Meteo_huitHeures_VentForce(j)
    return tonumber(huitHeures[tonumber(j)].VentForce)
end

function conky_Meteo_huitHeures_Humidite(j)
    return tonumber(huitHeures[tonumber(j)].Humidite)
end

function conky_Meteo_huitHeures_CouvNuage(j)
    return tonumber(huitHeures[tonumber(j)].CouvNuage)
end

function conky_Meteo_huitHeures_Rose(j)
    return tonumber(huitHeures[tonumber(j)].PointRosee)
end

function conky_Meteo_huitHeures_ProbPluie(j)
    return tonumber(huitHeures[tonumber(j)].Pluie)
end

function conky_Meteo_huitHeures_ProbNeige(j)
    return tonumber(huitHeures[tonumber(j)].Neige)
end

function conky_Meteo_huitHeures_ProbVerglas(j)
    return tonumber(huitHeures[tonumber(j)].Verglas)
end

function conky_Meteo_huitHeures_Uv(j)
    return tonumber(huitHeures[tonumber(j)].UV)
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_EclipseTotal()
    if format == nil then format = "%A_%d_%B_%Y_à_%H:%M" end
    format = string.gsub(format, "_", " ")
    return trad_date(os.date(format, Eclipse_total))
end

--Fonction d'affichage
function conky_fDrawImage(path,x,y,w,h,arc)

    path = string.gsub(path, "~", home)
    path = string.gsub(path, "$HOME", home)

    local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)

    local function fDrawImage(path,x,y,w,h,arc)
        x=x+(w/2)
        y=y+(h/2)
        local img =  cairo_image_surface_create_from_png(path)
        local w_img, h_img = cairo_image_surface_get_width (img), cairo_image_surface_get_height (img)

        local cr = cairo_create (cs)
        cairo_translate (cr, x, y)

        if arc then
            cairo_rotate (cr, arc)
        end

        cairo_scale (cr, w/w_img, h/h_img)
        cairo_set_source_surface (cr, img, -w_img/2, -h_img/2)
        cairo_paint (cr)
        cairo_destroy(cr)
        cairo_surface_destroy (img)
    end
    fDrawImage(path,x,y,w,h,arc)
    cairo_surface_destroy(cs)
    return ""
end


--Informations sur le lua
function conky_Version()
    return Version
end

function conky_Meteo_fichier_init()
    return fichier_init
end

function conky_Meteo_etat_MAJ()
    return MAJ
end


--Sauvegarde des données
function sauvegarde()

--[[sauvegarde lunaison
    local file = assert(io.open(repsauv.."/lunaison", "w+"))
    file:write ("\n", ephemerides, "\n")
    file:write (ephemerides1, "\n")
    file:write (ephemerides2, "\n")
    file:write (Visibilite, "\n")
    file:write (Phases, "\n")
    file:write (Phases1, "\n")
    file:write (Phases2, "\n")
    file:write (Noeud_lunaire, "\n")
    file:write (Apogee, "\n")
    file:write (Perigee, "\n")
    file:write (Distance, "\n")
    file:write (Age, "\n")
    file:write (Lever_LuneHeure, "\n")
    file:write (Lever_LuneMinute, "\n")
    file:write (Coucher_LuneHeure, "\n")
    file:write (Coucher_LuneMinute, "\n")
    file:write (Eclipse_total, "\n")
    io.close(file)
]]--
--modification des droits utilisateur
--    os.execute('chmod o+rw- '..r..'/*lun*')
    os.execute('chmod -R o+rw- '..repsauv)
    os.execute('chmod -R o+rw- '..Rep)
end

recmeteo.py

#! /usr/bin/python3
# -*- coding: utf-8 -*-
# Par Didier-T Forum Ubuntu.fr
# Ajout notification par jpdipsy Forum Ubuntu.fr
# Ajout notification via DBus par ti_tux Forum Ubuntu.fr
# Ajout création repsauv si inexistant par jpdipsy Forum Ubuntu.fr
# Repris par Daniel38100 Forum Ubuntu.fr a partir de 2.00a en 01/1017


from socket import timeout
from urllib.request import Request, urlopen, URLError
from os import path, makedirs, system
from time import time, sleep, strftime, localtime
from re import search, compile, findall
from sys import argv
from gc import collect
from bs4 import BeautifulSoup, Tag, NavigableString
from datetime import date, datetime


Version='2.00a'

homedir=path.expanduser('~')

#### initialisation des variables
adressWeb="http://www.accuweather.com/fr/fr/belfort/133341/daily-weather-forecast/133341"
repsauv="~/essais"
huitHeures="oui"
nbFoisHuit=1
matin="oui"
apresmidi="oui"
soiree="oui"
nuit="oui"
nbJour=1
interval=30
notifi="oui"
externe=None
Id="sans"
demon="non"
fullnotify="non"
MAJP="oui"
lune="oui"

for a in argv:
    if search("adressWeb=", a) is not None:
        adressWeb=compile("adressWeb=(.*)").search(a).group(1)
    if search("repsauv=", a) is not None:
        repsauv=compile("repsauv=(.*)").search(a).group(1)
    if search("huitHeures=", a) is not None:
        huitHeures=compile("huitHeures=(.*)").search(a).group(1)
    if search("nbJour=", a) is not None:
        nbJour=compile("nbJour=(.*)").search(a).group(1)
    if search("interval=", a) is not None:
        interval=compile("interval=(.*)").search(a).group(1)
    if search("notify=", a) is not None:
        notifi=compile("notify=(.*)").search(a).group(1)
    if search("notifyPartielle=", a) is not None:
        fullnotify=compile("notifyPartielle=(.*)").search(a).group(1)
    if search("matin=", a) is not None:
        matin=compile("matin=(.*)").search(a).group(1)
    if search("apresmidi=", a) is not None:
        apresmidi=compile("apresmidi=(.*)").search(a).group(1)
    if search("soiree=", a) is not None:
        soiree=compile("soiree=(.*)").search(a).group(1)
    if search("nuit=", a) is not None:
        nuit=compile("nuit=(.*)").search(a).group(1)
    if search("externe=", a) is not None:
        externe=compile("externe=(.*)").search(a).group(1)
    if search("nbFoisHuit=", a) is not None:
        nbFoisHuit=compile("nbFoisHuit=(.*)").search(a).group(1)
    if search("id=", a) is not None:
        Id=compile("id=(.*)").search(a).group(1)
    if search("demon=", a) is not None:
        demon=compile("demon=(.*)").search(a).group(1)
    if search("MAJP=", a) is not None:
        MAJP=compile("MAJP=(.*)").search(a).group(1)

nbJour=int(nbJour)
interval=int(interval)
repsauv=repsauv.replace("~", homedir)
notifi=str.lower(notifi)
fullnotify==str.lower(fullnotify)
huitHeures=str.lower(huitHeures)
nbFoisHuit=int(nbFoisHuit)
MAJP=str(MAJP)

#### fin initialisation des variables

#### Fonction de traitement des fichiers
def traitement(adress, fichier, repsauv):
    current_balise=None
    x=1
    user_agent='Mozilla/5.0 (X11; Linux x86_64)'
    headers={ 'User-Agent' : user_agent }
    while current_balise is None:
        response=None
        while response is None:
            try:
                html_page=urlopen(adress, timeout=10)
            except (URLError) as error:
                print("[\033[31mFAIL\033[0m] HTML ", error)
            except timeout:
                print("[\033[31mFAIL\033[0m] erreur timeout acces HTML")
            else:
                try:
                    currentCond=html_page.read()
                except (URLError) as error:
                    print("[\033[31mFAIL\033[0m] Lecture page ", error)
                except timeout:
                    print("[\033[31mFAIL\033[0m] erreur timeout lecture page")
                else:
#                    print("[\033[32m OK \033[0m] "+adress)
                    response="ok"
            if response is None:
                sleep(10)
        current_balise=1
    soup=BeautifulSoup(currentCond, "lxml")
    resultat='\n'
    inter=[]
#  Huit Heures -----------------------------------------------------
    if 'hourly-weather-forecast' in adress :
        page=soup.select("[class~=overview-hourly]")[0].find_all('td')+soup.select("[class~=precip-hourly]")[0].find_all('td')+soup.select("[class~=sky-hourly]")[0].find_all('td')
        info=BeautifulSoup(str(page), "lxml").find_all('div')+BeautifulSoup(str(page), "lxml").find_all('span')
        suppr='<div class='
        detail=['Heure','','','Temp°','RealFeel®','Vent (km/h)','Pluie','Neige','Verglas','Indice UV','Couverture nuageuse','Humidité','Point de rosée','Icone']
        for i in info :
            if suppr in str(i) :
                result=str(i).replace(str(i),'')
            else :
                result=str(i).replace('</span>','').replace('<span>','').replace('</div>','').replace('<div>','')
                inter.append(result)
        ico=BeautifulSoup(str(page), "lxml").select("[class~=icon]")
        x=1
        for i in ico:
            icone=str(i).replace('<div class="icon-weather icon i-','').replace('"></div>','')
            x=x+1
            inter.append(icone)
        y=0
        for i in detail:
            x=1
            while x<9 :
                if i == '' :
                    x=x+1
                    y=y+1
                else :
                    resultat=resultat+str(i)+str(x)+': '+inter[y]+'\n'
                    y=y+1
                    x=x+1
# Jour ---------------------------------------------------------
    if 'daily-weather-forecast' in adress :
        page=soup.select("[class~=detail-tab-panel]")[0]
        page=str(page).replace('<span class="setting">Mx</span>','').replace('<span class="setting">Mi</span>','')
        info=BeautifulSoup(str(page), "lxml").find_all('strong')
        inter0=[]
        for i in info:
            soup1=BeautifulSoup(str(i), "lxml")
            comment=soup1.strong.string
            inter0.append(comment)
        inter.append('VentD jour: '+inter0[0].split(' ')[0].replace('W','O'))
        inter.append('VentF jour: '+inter0[0].split(' ')[1]+'km/h')
        inter.append('VentD nuit: '+inter0[10].split(' ')[0])
        inter.append('VentF nuit: '+inter0[10].split(' ')[1]+'km/h')
        inter.append('Rafale jour:'+inter0[1])
        inter.append('Rafale nuit:'+inter0[11])
        inter.append('UV jour: '+inter0[2])
        inter.append('UV nuit: '+inter0[12])
        inter.append('Prob orage jour: '+inter0[3])
        inter.append('Prob orage nuit: '+inter0[13])
        inter.append('Précipitations jour: '+inter0[4])
        inter.append('Précipitations nuit: '+inter0[14])
        inter.append('Pluie jour: '+inter0[5])
        inter.append('Pluie nuit: '+inter0[15])
        inter.append('Neige jour: '+inter0[6])
        inter.append('Neige nuit: '+inter0[16])
        inter.append('Verglas jour: '+inter0[7])
        inter.append('Verglas nuit: '+inter0[17])
        inter.append('Heures de précipitations jour: '+inter0[8])
        inter.append('Heures de précipitations nuit: '+inter0[18])
        inter.append('Heures de pluie jour: '+inter0[9])
        inter.append('Heures de pluie nuit: '+inter0[19])
        info=BeautifulSoup(str(page), "lxml").find_all('span')
        inter0=[]
        for i in info:
            soup1=BeautifulSoup(str(i), "lxml")
            comment=soup1.span.string
            inter0.append(comment)
        inter.append('Temp jour: '+inter0[0])
        inter.append('Temp nuit: '+inter0[3])
        inter.append('Temp ress jour:'+inter0[1].replace('RealFeel®',''))
        inter.append('Temp ress nuit:'+inter0[4].replace('RealFeel®',''))
        inter.append('Prob précipitations jour:'+inter0[2].replace('Précipitations',''))
        inter.append('Prob précipitations nuit:'+inter0[5].replace('Précipitations',''))
        con=BeautifulSoup(str(page), "lxml").select("[class~=cond]")
        inter0=[]
        for i in con:
            cond=str(i).replace('<div class="cond">','').replace('</div>','').replace('  ','').replace('\n','').replace('\r','')
            inter0.append(cond)
        inter.append('Cond_jour: '+inter0[0])
        inter.append('Cond_nuit: '+inter0[1])
        ico=BeautifulSoup(str(page), "lxml").select("[class~=icon]")
        inter0=[]
        for i in ico:
            icone=str(i).replace('<div class="icon i-','').replace('"></div>','')
            inter0.append(icone)
        inter.append('Icone jour: '+inter0[0])
        inter.append('Icone nuit: '+inter0[1])
        page=soup.select("[id~=feature-history]")[0]
        info=BeautifulSoup(str(page), "lxml").find_all('td')
        inter0=[]
        for i in info:
            soup1=BeautifulSoup(str(i), "lxml")
            comment=soup1.td.string
            inter0.append(comment)
        inter.append('Maxjour: '+inter0[0])
        inter.append('Maxnormal: '+inter0[1])
        inter.append('Maxrecord: '+inter0[2])
        inter.append('Max1ans: '+inter0[3])
        inter.append('Minjour: '+inter0[4])
        inter.append('Minnormal: '+inter0[5])
        inter.append('Minrecord: '+inter0[6])
        inter.append('Min1ans: '+inter0[7])
        page=soup.select("[class~=time-period]")
        info=BeautifulSoup(str(page), "lxml").find_all('li')
        inter0=[]
        for i in info:
            soup1=BeautifulSoup(str(i).replace('<span>','').replace('</span>',''), "lxml")
            comment=soup1.li.string
            inter0.append(comment)
        inter.append(inter0[0])
        inter.append(inter0[1])
        inter.append('Duree soleil'+inter0[2].replace('Durée',''))
        inter.append(inter0[3])
        inter.append(inter0[4])
        inter.append('Duree lune'+inter0[5].replace('Durée',''))
        histo=soup.find(id="feature-history")
        date=histo.find_all('th')
        jour=compile("(.*)/(.*)/(.*)").search(date[4].get_text())
        inter.append("jour: "+jour.group(1))
        inter.append("mois: "+jour.group(2))
        inter.append("année: "+str(int(jour.group(3))+1))
        for i in inter:
            resultat=resultat+i+'\n'

# quart --------------------------------------------------------
    if 'morning-weather-forecast' in adress or 'afternoon-weather-forecast' in adress or 'evening-weather-forecast' in adress or 'overnight-weather-forecast' in adress :
        page=soup.select("[class~=detail-tab-panel]")[0]
        con=BeautifulSoup(str(page), "lxml").select("[class~=cond]")
        for i in con:
            cond=str(i).replace('<span class="cond">','').replace('</span>','').replace('  ','').replace('\n','').replace('\r','')
        ico=BeautifulSoup(str(page), "lxml").select("[class~=icon]")
        for i in ico:
            icone=str(i).replace('<div class="icon i-','').replace('"></div>','')
        tem=str(BeautifulSoup(str(page), "lxml").select("[class~=large-temp]")[0].select("[class~=small-temp]")[0])
        temmax=str(BeautifulSoup(str(page), "lxml").select("[class~=large-temp]")[0]).replace(str(tem),'').split('>')[1].split('<')[0]
        temmin=tem.split('/')[1].split('<')[0]
        realfeet=str(BeautifulSoup(str(page), "lxml").select("[class~=small-temp]")[1]).replace('<span class="small-temp"><em>RealFeel®</em>','').replace('</span>','').split('/')
        realfeetmin=realfeet[1]
        realfeetmax=realfeet[0]
        ventd=str(BeautifulSoup(str(page), "lxml").select("[class~=wind-point]")[0]).replace('<div class="wind-point ','').replace('"></div>','')
        stat=BeautifulSoup(str(page), "lxml").select("[class~=stats]")
        ventf=str(BeautifulSoup(str(stat), "lxml").select("[class~=wind]")[0]).replace('<li class="wind">','').replace('</li>','')
        inter.append('Cond: '+cond)
        inter.append('Icone: '+icone)
        inter.append('TempMin: '+temmin)
        inter.append('TempMax: '+temmax)
        inter.append('RealFeelMin: '+realfeetmin)
        inter.append('RealFeelMax:'+realfeetmax)
        inter.append('VentD: '+ventd)
        inter.append('VentF: '+ventf)
        stat=BeautifulSoup(str(page), "lxml").find_all('strong')
        detail=['Précipitations: ','Pluie: ','Neige: ','Humidité: ','Couverture nuageuse: ','Point de rosée: ','Visibilité: ']
        x=0
        for i in stat:
            soup1=BeautifulSoup(str(i), "lxml")
            comment=soup1.strong.string
            inter.append(detail[x]+str(comment))
            x=x+1
        for i in inter:
            resultat=resultat+i+'\n'

# CC -----------------------------------------------------------
    if 'current-weather' in adress :
        page=soup.find_all('script')
        soup1=BeautifulSoup(str(page), "lxml")
        ville=compile(" city: '(.*)',").search(str(soup1)).group(1)
        longi=compile("lon: '(.*)',").search(str(soup1)).group(1)
        lat=compile("lat: '(.*)',").search(str(soup1)).group(1)
        inter.append("Ville: "+ville)
        inter.append("Lat: "+lat)
        inter.append("Long: "+longi)
        page=soup.select("[class~=detail-tab-panel]")[0]
        cond=str(BeautifulSoup(str(page), "lxml").select("[class~=cond]")[0]).split('>')[1].split('<')[0]
        icone=str(BeautifulSoup(str(page), "lxml").select("[class~=icon]")[0]).replace('<div class="icon i-','').replace('"></div>','')
        temp=str(BeautifulSoup(str(page), "lxml").select("[class~=large-temp]")[0]).split('>')[1].split('<')[0]
        realfeel=str(BeautifulSoup(str(page), "lxml").select("[class~=small-temp]")[0]).split('>')[3].split('<')[0]
        ventd=str(BeautifulSoup(str(page), "lxml").select("[class~=wind-point]")[0]).replace('<div class="wind-point ','').replace('"></div>','')
        inter.append('Cond: '+cond)
        inter.append('Icone: '+icone)
        inter.append('Temp: '+temp)
        inter.append('RealFeel:'+realfeel)
        inter.append('VentD: '+ventd)
        stat=BeautifulSoup(str(page), "lxml").find_all('strong')
        detail=['VentF: ','Humidité: ','Pression: ','Indice UV: ','Couverture nuageuse: ','Plafond: ','Point de rosée: ','Visibilité: ']
        x=0
        for i in stat:
            soup1=BeautifulSoup(str(i), "lxml")
            comment=soup1.strong.string
            inter.append(detail[x]+str(comment))
            x=x+1
        inter.append("Alerte: RAS")
        page=soup.select("[id~=feature-history]")[0]
        info=BeautifulSoup(str(page), "lxml").find_all('td')
        inter0=[]
        for i in info:
            soup1=BeautifulSoup(str(i), "lxml")
            comment=soup1.td.string
            inter0.append(comment)
        inter.append('Maxjour: '+inter0[0])
        inter.append('Maxnormal: '+inter0[1])
        inter.append('Maxrecord: '+inter0[2])
        inter.append('Max1ans: '+inter0[3])
        inter.append('Minjour: '+inter0[4])
        inter.append('Minnormal: '+inter0[5])
        inter.append('Minrecord: '+inter0[6])
        inter.append('Min1ans: '+inter0[7])
        histo=soup.find(id="feature-history")
        date=histo.find_all('th')
        jour=compile("(.*)/(.*)/(.*)").search(date[4].get_text())
        inter.append("jour: "+jour.group(1))
        inter.append("mois: "+jour.group(2))
        inter.append("année: "+str(int(jour.group(3))+1))
        date=str(datetime.now()).split(' ')[1].split(':')
        inter.append("heure: "+date[0])
        inter.append("minute: "+date[1])
        inter.append("seconde: "+date[2].split('.')[0])
        inter.append(str(int(time())))
        for i in inter:
            resultat=resultat+i+'\n'
# Lunaison -----------------------------------------------------
    if 'http://www.calendrier-lunaire.net/' in adress :
        page=soup.select("[class~=TBdoubleColTD8]")[0]
        soup1=BeautifulSoup(str(page), 'lxml')
        resultat=str(soup1.ul['content']).replace('\t','')

# --------------------------------------------------------------
    fiche=open(fichier, "w")
    fiche.write(resultat)
    fiche.close()
    collect()
#### fin Fonction de traitement des fichiers

#### Mise en tache de fond
def demonise(ent, id1, id2, huitHeures, nbJour, interval, nbFoisHuit, Id, demon):
    dem=time()-(60*60)
    misajour=1
    while 1 :
        date=str(datetime.now()).split(' ')[1].split(':')
        heure=time()
        if heure-dem >= 60*60 and MAJP=="oui":
            x=0
            while x<nbJour:
                x=x+1
                traitement(ent+nb1+'/daily-weather-forecast/'+nb2+"?day="+str(x), repsauv+"/Jour"+str(x), repsauv)
                print("[\033[32m OK \033[0m] Jour "+str(x))
                if matin=="oui":
                    traitement(ent+nb1+'/morning-weather-forecast/'+nb2+"?day="+str(x), repsauv+"/Matin"+str(x), repsauv)
                    print("[\033[32m OK \033[0m] Matin "+str(x))
                if apresmidi=="oui":
                    traitement(ent+nb1+'/afternoon-weather-forecast/'+nb2+"?day="+str(x), repsauv+"/AM"+str(x), repsauv)
                    print("[\033[32m OK \033[0m] AM "+str(x))
                if soiree=="oui":
                    traitement(ent+nb1+'/evening-weather-forecast/'+nb2+"?day="+str(x), repsauv+"/Soiree"+str(x), repsauv)
                    print("[\033[32m OK \033[0m] Soiree "+str(x))
                if nuit=="oui":
                    traitement(ent+nb1+'/overnight-weather-forecast/'+nb2+"?day="+str(x), repsauv+"/Nuit"+str(x), repsauv)
                    print("[\033[32m OK \033[0m] Nuit "+str(x))
            if lune == "oui":
                traitement('http://www.calendrier-lunaire.net/', repsauv+"/lunaison", repsauv)
                print("[\033[32m OK \033[0m] Lunaison")
            dem=heure
        if huitHeures=="oui":
            x=0
            while x<nbFoisHuit:
                h=(x*8)+int(strftime('%H', localtime()))
                x=x+1
                traitement(ent+nb1+'/hourly-weather-forecast/'+nb2+'?hour='+str(h), repsauv+"/huitHeures"+str(x), repsauv)
                print("[\033[32m OK \033[0m] huitHeures "+str(x))
        traitement(ent+nb1+'/current-weather/'+nb2, repsauv+"/CC", repsauv)
        print("[\033[32m OK \033[0m] CC")
        if externe is not None:
                 system(externe)
        fin=time()
        duree=fin-heure
        if notifi == "oui":
            notify2.init('Recmeteo.py')
            if heure-dem == 0:
                mess=notify2.Notification('Accuweather', "Mise a jour complete à "+str(date[0])+":"+str(date[1])+":"+str(date[2]).split('.')[0]+" en "+str(round(duree,2)).replace('.','s')+" sec", '/opt/Accuweather/icones/accuweather-logo1.png')
                mess.show()
                print("[\033[32m OK \033[0m] Mise a jour complete à "+str(date[0])+":"+str(date[1])+":"+str(date[2]).split('.')[0]+" en "+str(round(duree,2)).replace('.','s'))
            else:
                if fullnotify == "oui" :
                    mess=notify2.Notification('Accuweather', "Mise a jour partiel à "+str(date[0])+":"+str(date[1])+":"+str(date[2]).split('.')[0]+" en "+str(round(duree,2)).replace('.','s'), '/opt/Accuweather/icones/accuweather-logo1.png')
                    mess.show()
                print("[\033[32m OK \033[0m] Mise a jour partiel à "+str(date[0])+":"+str(date[1])+":"+str(date[2]).split('.')[0]+" en "+str(round(duree,2)).replace('.','s'))
        start=heure
        pause=60*interval-int(duree)
        if pause < 0:
            pause=interval
        if demon == "non":
            print("[\033[33mINFO\033[0m] Mode démon non utilisé fin de recmeteo.py")
            exit()
        collect()
        sleep(pause)
        if Id != "sans":
            if not path.exists("/proc/"+Id):
                exit()


### Initialiation de DBus pour les notifications
if notifi == "oui":
    import notify2
### Vérification répertoire
if not path.exists(repsauv):
    makedirs(repsauv)
#### Lancement du script et initialisation de la tache de fond
nb1=findall('\d+', adressWeb)[0]
nb2=findall('\d+', adressWeb)[1]
ent=adressWeb[:adressWeb.find(nb1)]
fin=adressWeb.replace(ent+nb1, "")
fin=fin.replace(fin[:fin.find(nb2)]+nb2, "")
nb2=nb2+fin
#print("[\033[33mINFO\033[0m] Recmeteo Version =", Version)
demonise(ent, nb1, nb2, huitHeures, nbJour, interval, nbFoisHuit, Id, demon)

1485004993.png

avec le météo fond d'écran accuweather-3.deb v3.10 MAJ:18/01/2017

Dernière modification par daniel38100 (Le 21/01/2017, à 20:48)

Hors ligne

#1334 Le 21/01/2017, à 23:56

daniel38100

Re : [Conky] Alternative à weather.com (3)

A tous

Correction lunaison MAJ v1.21météo.lua meteo-lua-2.deb v1.21 MAJ:21/01/17

1485039564.png

Et passage à v3.11 pour météo fond d'écran accuweather-3.deb v3.11 MAJ:22/01/2017

Dernière modification par daniel38100 (Le 22/01/2017, à 00:53)

Hors ligne

#1335 Le 23/01/2017, à 13:59

ragamatrix

Re : [Conky] Alternative à weather.com (3)

salut daniel38100,
depuis le temps que je ne pouvais plus utliser ces scripts, je m'en était fait un "artisanal" avec xplanet...
peut-t-on toujours utiliser un script xplanet plus celui-ci ?
Pourrais-je l'utiliser avec debian jessie ?
je ne me rappelle plus si c'est possible.
mon script affiche la terre plus une carte sat actualisée le conky meteo vient de teo (bunsenlabs)
Merci de t'être repenché sur tous ces scripts, bravo pour ton boulot wink
1485176319.png

Hors ligne

#1336 Le 23/01/2017, à 20:56

daniel38100

Re : [Conky] Alternative à weather.com (3)

@ ragamatrix

le météo fond d’écran s'utilise toujours avec xplanet il faut apres la fin de ton script rafraîchir la compo
il fonctionne tres bien sur jessie en principe

/chemin/vers/ta/compo rafraichir

Quel genre de script pour xplanet ? je ne connais pas assez

Merci

Hors ligne

#1337 Le 24/01/2017, à 08:32

ragamatrix

Re : [Conky] Alternative à weather.com (3)

Salut,
j'ai voulu tester le pack mais on dirait qu'il manque des scripts (meteo2.lua et recmeteo.py) Je crois aussi que la doc n'est plus à jour ? Je ne me rappelle plus comment lancer tout ça... dsl merci quand-même d'y avoir regardé
J'ai retrouvé pour lancer en terminal et j'ai une erreur:

 #########################################
############# CONFIGURATION #############
#########################################
[ OK ] ViPa="Horgen, Zurich, CH "
[ OK ] adressWeb="http://www.accuweather.com/fr/ch/horgen/316407/weather-forecast/316407"
[ OK ] Ville="Horgen"
[ OK ] nbJour="6"
[ OK ] matin="oui"
[ OK ] apresmidi="oui"
[ OK ] soiree="oui"
[ OK ] nuit="oui"
[ OK ] notifi="oui"
[ OK ] notifyPartielle="non"
[ OK ] interval="15"
[ OK ] nbHuit="2"
[ OK ] externe="/opt/Accuweather/scripts/compo/macompo.sh"
[ OK ] fond_aleatoire="non"
[ OK ] rep_fond="/home/raphix/Pictures/wallpapers/minimals"
sh: 1: kill: No such process

sh: 1: kill: Usage: kill [-s sigspec | -signum | -sigspec] [pid | job]... or
kill -l [exitstatus]
Désolé pas pris en charge actuellement
cat: /home/raphix/.config/: est un dossier
●[raphix@debian]●[09:31:27]● 

Dernière modification par ragamatrix (Le 24/01/2017, à 09:43)

Hors ligne

#1338 Le 24/01/2017, à 10:50

daniel38100

Re : [Conky] Alternative à weather.com (3)

c'est un détail ton interface graphique n'est pas pris en charge
quel interface graphique utilise tu sur ta debian
je regarderai ça dans la soirée

Dernière modification par daniel38100 (Le 24/01/2017, à 10:50)

Hors ligne

#1339 Le 24/01/2017, à 11:20

ragamatrix

Re : [Conky] Alternative à weather.com (3)

ah... je comprends, j'ai une session compiz et utilise feh pour le fond d'ecran (je peux aussi utiliser nitrogen)... merci pour ta réponse
si ça ne fonctionne pas avec compiz-standalone j'ai un session openbox que je peux utiliser, ma distribution c'est Bunsenlabs:
1485262875.png
Mon script xplanet qui tourne actuellement (si tu veux un aperçu, j'ai installé xplanet et utilise des carte HD pour que le rendu soit comme sur le screenshot)
XPBGHD:

#!/bin/bash
#========================================================#
#        				               _        _        #
#_ __ __ _  __ _  __ _ _ __ ___   __ _| |_ _ __(_)_  __  #
#| '__/ _` |/ _` |/ _` | '_ ` _ \ / _` | __| '__| \ \/ / #
#| | | (_| | (_| | (_| | | | | | | (_| | |_| |  | |>  <  #
#|_|  \__,_|\__, |\__,_|_| |_| |_|\__,_|\__|_|  |_/_/\_\ #
#           |___/                                        #
#========================================================#
export DISPLAY=:0
PREFIX=/home/raphix/.xplanet/images/Earth_HD/
#Background # Fond
BG=${PREFIX}starsmilky_way5400x2700.jpg
#Images Montage
#MOON=${PREFIX}moonxpbg.png
EARTH=${PREFIX}earthxpbg.png
#EARTH2=${PREFIX}earth2xpbg.png
IMGXP=${PREFIX}montage-xpbg2.png
ORIGINE=moon
LOOK_AT=earth
OUTPUT=xplanetesting.jpg
##-Sat-config-##################
RSAT=radarxp
tailleRSAT=100
tailledecoupe=365x365
################################
wget -q -O  ${PREFIX}$RSAT.jpg "http://www.meteo-mc.fr/dedie/Images/sat/satireu1.gif"

convert ${PREFIX}$RSAT.jpg -resize 400x400\! ${PREFIX}$RSAT.png
convert ${PREFIX}$RSAT.png -filter Lanczos -crop  $tailledecoupe+10+15\! ${PREFIX}$RSAT.png
convert  ${PREFIX}$RSAT.png \
\( +clone  -alpha extract \
       -draw 'fill black polygon 0,0 0,5 5,0 fill white circle 5,5 5,0' \
        \( +clone -flip \) -compose Multiply -composite \
        \( +clone -flop \) -compose Multiply -composite \
     \) -alpha off -compose CopyOpacity -composite  ${PREFIX}$RSAT.png

convert ${PREFIX}$RSAT.png  -background  black  \( +clone -shadow 60x4+2+2 \) +swap -background none -flatten ${PREFIX}$RSAT.png
###rm ${PREFIX}$RSAT.jpg
#Taille des objets à régler suivant la résolution du bureau
##GEOMETRYEARTH2=450x450
GEOMETRY=5400x2700
#GEOMETRYMOON=300x300
# 
#LONGITUDE=55
#LATITUDE=7
#when_clouds
LONGITUDE=50
LATITUDE=25
#
# Par rapport au Soleil, la Terre fait une rotation complète (360°) en 24 heures, soit 1° toutes les 4 minutes.
# Calculons quelle longitude est face au Soleil (LONGITUDE2)
declare -i HEURES=`date -u "+%X" | awk -F ":" '{print $1}' | sed s/"^0"/""/`
declare -i MINUTES=`date -u "+%X" | awk -F ":" '{print $2}' | sed s/"^0"/""/`
declare -i SECONDES=`date -u "+%X" | awk -F ":" '{print $3}' | sed s/"^0"/""/`
declare -i SEC=$((${HEURES}*3600+${MINUTES}*60+${SECONDES}))
declare -i LONGITUDE2=$(((43200-${SEC})*360/86400+$LONGITUDE))
 
#Annotation pour vérifier si l'image est actualisée
jour=`date +%d/%m/%y`; heuremodif=`date +%H`; minmodif=`date +%M`
fonte=Zero-Twos
libelle=""
#pour le fichier .xml copie l'image de fond->2xplanetesting.jpg
APPEND=2
# ************************************************
# Dans les lignes comprises entre "if" et "fi" ci-après, vous pouvez modifier le paramètre -longitude :
# mettez ${LONGITUDE} si vous désirez avoir une vue de la Terre centrée chez vous ;
# mettez ${LONGITUDE2} si vous désirez avoir une vue de la Terre centrée sur la longitude du zénith (Soleil), et votre latitude.

#earth2
##xplanet -conf ${PREFIX}xplanet.conf -transpng ${EARTH2} -body earth -longitude -99.17 -latitude 19.25 -geometry ${GEOMETRYEARTH2} &
#Terre
xplanet -conf ${PREFIX}xplanethd.conf -num_times 1 -transpng ${EARTH} -radius 80 -body earth -geometry ${GEOMETRY} -origin ${ORIGINE}  -longitude ${LONGITUDE2} -latitude ${LATITUDE} -center +3800+2350 &
# LUNE
#xplanet -conf ${PREFIX}xplanethd.conf -transpng ${MOON} -body moon -geometry ${GEOMETRYMOON} &

# création cartouche earth2
#convert -size 455x455 xc:transparent ${PREFIX}cartearth2.png
#composite -geometry  +5+5 ${EARTH2} ${PREFIX}cartearth2.png ${PREFIX}cartearth2.png
#-fontsize 8 -color DodgerBlue3 -labelpos +45+90
convert -size 5400x2700 xc:transparent ${IMGXP}
#convert -size 1920x1080 xc:transparent ${IMGXP}
composite -geometry  +0-0 ${EARTH} ${IMGXP} ${IMGXP}
#composite -geometry  +250+450 ${MOON} ${IMGXP} ${IMGXP}
#composite -geometry  250x250+25+760 ${PREFIX}cartouche.png ${IMGXP} ${IMGXP}
composite -geometry +0+0 "$IMGXP" "$BG" \
${PREFIX}${OUTPUT}

convert ${PREFIX}${OUTPUT} -resize 2700x1350 ${PREFIX}${OUTPUT}

convert ${PREFIX}${OUTPUT} -gravity southwest -density 150 \
-fill DodgerBlue3 -font $fonte  -pointsize 13 -annotate 0x10+270+90 "$libelle $jour : $heuremodif h $minmodif" ${PREFIX}${OUTPUT}
#placement carte sat
composite -geometry +250+200 ${PREFIX}radarxp.png ${PREFIX}${OUTPUT} ${PREFIX}${OUTPUT}
#placement earth2
##composite -geometry  +450+460 ${PREFIX}cartearth2.png ${PREFIX}${OUTPUT} ${PREFIX}${OUTPUT}
cp ${PREFIX}${OUTPUT} ${PREFIX}${APPEND}${OUTPUT}

#rm ${IMGXP}  
# met à jour le fond d'écran de Gnome ou openbox avec feh ou gconftool
feh --bg-fill ${PREFIX}${OUTPUT} 

Dans certains de mes scripts, pour l'affichage sur compiz, ou en général j'ai remarqué cette commande:

export DISPLAY=:0

Par exemple pour afficher une image toutes les deux heures avec crontab:

#afficher images différentes toutes les deux h
0 */2 * * * /bin/sh -c "export DISPLAY=:0 && /usr/bin/feh --bg-scale $HOME/.xplanet/images/Earth_HD/earth-hd/HPH-MAPS/$(date +%H).jpg 2>/dev/null"

Sinon si tu ne trouves pas j'aimerais utiliser ton calendrier, mais j'en aurai besoin sans la syntaxe du script "meteo"  Si tu avais rédigé ce script auparavant sans cette syntaxe je te remercie d'avance pour le partage.
bonne soirée

Dernière modification par ragamatrix (Le 24/01/2017, à 14:40)

Hors ligne

#1340 Le 24/01/2017, à 15:33

daniel38100

Re : [Conky] Alternative à weather.com (3)

Pack mis a jour pour la prise en charge de compiz-session (feh)météo fond d'écran accuweather-3.deb v3.12 MAJ:24/01/2017

ou juste le fichier meteo dans /opt/Accuweather/scripts/

#!/bin/bash

#Fonctions traitements info recmeteo 
#Prend partiellement en charge KDE
meteo_rep=/opt/Accuweather
meteo_config=config.cfg
rep_ref=$meteo_rep
Ver_meteo="2.11"
######################################################################
#1.6 ajout module lunaison + alertes méteo --> recmeteo 1.17
#1.7 corr bug + ajout infos sur thermo --> recmeteo 1.20
#1.71 améliorationstraductions alertes
#1.72 correct lunaison
#1.73 ajout cond-cart alerte_cart +correct temp,uv
#1.74 ajout retour du nom des modules + template CC
#1.75 amelioration de la francisation des alertes
#1.8 ajout nouvelles fonctions pour les compositions
#1.81 corrections ico +8
#1.82 corrections icone nuit prev_huit et 16
#1.83 ajout crea_texte_multi +thermo une seule aiguille+crea_graph
#1.84 modification icones
#1.85 suppression paradite alerte + alerte 
#1.86 correction rotation multiples + recmeteo 1.22
#1.87 ajout fonction crea_cercle_repart
#1.88 modification fonction crea_cercle_repart
#1.89 forcage signe crea_cercle_repart
#1.90 correction empechement ajout sur image tournée quad,ellipse,triangle
#1.91 ajout rotation crea_cercle_repart
#1.92 utilisation srt pour les rotations
#1.93 modif durée avec ou sans accent + ajout test resultat
#1.94 integration thermo classique
#1.95 ajout icône rafales
#1.96 ajout couleur de fond, taille des bordure, et arrondi des angle dans crea_graph
#1.97 prise en charge gnome-panel (debian kali-linux)
#1.98 ajout de fond aléatoir
#1.99 ajout du graph pression et temperature ~$ barograph "nom" "couleurtemp°" "couleurpression"
#2.01 prise en charge de XFCE a partir de 4.10 et correction de l'icone rafale
#2.11 prise en charge de compiz-session
######################################################################
repfont=/usr/share/fonts/accuweather_fonts
arg="$2"
accuweather=`dpkg -l | grep accuweather | awk '{print $3}'`
init()
{   
     
    while [ ! -e "$repsauv/CC" ];do sleep 1;cpt=$((cpt+1));if [ "$cpt" -gt "30" ];then start="non" ;fi ;done 
 
    maint=$(grep heure $repsauv/CC | sed 's/heure: //g')"h"$(grep minute $repsauv/CC | sed 's/minute: //g')"m"$(grep seconde $repsauv/CC | sed 's/seconde: //g')"s";heure_maint=$(grep heure $repsauv/CC | sed 's/heure: //g');min_maint=$(grep minute $repsauv/CC | sed 's/minute: //g');sec_maint=$(grep seconde $repsauv/CC | sed 's/seconde: //g')
    # proch maj
    heure=$heure_maint
    if (( `echo ${heure:0:1}` == 0 ));then  heure=`echo ${heure:1:1}` ; fi
        update=$((interval * 60))
        mins=$min_maint
    if (( `echo ${mins:0:1}` == 0 ));then  mins=`echo ${mins:1:1}` ; fi
    secact=$(($heure*3600+$mins*60))
    proch=$(($update+$secact))
    proch_maj=`printf "%02dh%02dm%02ds" $(($proch/3600))  $(($proch/60%60)) $sec_maint`
    #####################
    repville=`echo $adressWeb | cut -d / -f6-7`; ville="$(echo $adressWeb| cut -d / -f6)"
    repertimages=$TempShell/$ville-$USER
    if [ ! -d "$repertimages" ]; then mkdir -p "$repertimages"; fi
    vrecmete=$(fgrep  Version= /usr/bin/recmeteo1.py |cut -d = -f2-)
    vrecmeteo=$(echo $vrecmete | sed 's/.\{1\}//' | sed '$ s/.$//')
    reptemp=$repertimages
    imagetemp=$repertimages/temp.png
    imagetemp1=$repertimages/temp1.png
    fondbase="$repsauv/fond-base.png"
    echo "$destination"
    if [ -z "$destination" ];then
        imagefinale=$rep_ref/fonds/$ville-meteo.png
    else
        imagefinale="$destination"
    fi
    ecran=$(xrandr --verbose | grep -F *current |cut -d " " -f3)
    if [ -z "$IconesRep" ];then IconesRep=$rep_ref/icones;fi
    if [ -z "$Rose" ];then Rose=$IconesRep/Themes/JPDipsy/Metal/Rose-des-vents;fi
    if [ -z "$Therm" ];then Therm=$IconesRep/Themes/JPDipsy/Classique/Thermo;fi
    if [ -z "$ThermRond" ];then ThermRond=$IconesRep/Themes/JPDipsy/Metal/Thermometre;fi
    if [ -z "$Lune" ];then Lune=$IconesRep/Themes/JPDipsy/Metal/Lune-new;fi
    if [ -z "$Barometre" ];then Barometre=$IconesRep/Themes/JPDipsy/Metal/Barometre;fi
   
}

gestion_fond()
{
     
    if [ -z "$environnement" ];then
        #------------------- environnement ---------------------------------------------
        if [[ `ps aux | grep -e "[x]fce4-session"` ]] ; then environnement="xfce";fondactuel=`xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/workspace0/last-image`;fondori=xfce-fondori
        elif [[ `ps aux | grep -e "[c]ompiz-session"` ]] ; then environnement="compiz";fondactuel=`cat ~/.fehbg | grep feh | cut -d "'" -f2 `;fondactuel=`echo $fondactuel`;fondori=compiz-fondori
        elif [[ `ps aux | grep -e "[s]tartfluxbox"` ]] ; then   environnement="fluxbox";fondactuel=`tail -1 $dest/lastwallpaper | cut -d "|" -f2`;fondori=flux-fondori
        elif [[ `ps aux | grep -e "[o]penbox --startup"` ]] ; then environnement="openbox";fondactuel=`cat ~/.fehbg | grep feh | cut -d "'" -f2 `;fondactuel=`echo $fondactuel`;fondori=obox-fondori
        elif [[ `ps aux | grep -e "[k]deinit4 Running..."` ]] ; then kquitapp plasma-desktop && sleep 1 && plasma-desktop; environnement="kde"; fondactuel=`grep 'wallpaper=' ~/.kde/share/config/plasma-desktop-appletsrc | tail --bytes=+11 `;fondori=kde-fondori
        elif [[ `ps aux | grep -e "[g]nome-shell"` ]] ; then environnement="gnomeshell"; fondactuel=`gsettings get org.gnome.desktop.background picture-uri |sed s/.$// | cut -c9- `;fondori=gs-fondori
	elif [[ `ps aux | grep -e "[g]nome-panel"` ]] ; then environnement="gnomepanel"; fondactuel=`gsettings get org.gnome.desktop.background picture-uri |sed s/.$// | cut -c9- `;fondori=gp-fondori
	        elif [[ `ps aux | grep -e "[g]nome-session" | grep  -v "/usr/*"` ]] ; then
            # gnome version
            environnement="gnome" ; gnomeversion=`gnome-session --version | cut -c15-15`
            if [ $gnomeversion = 2 ]; then fondactuel=`gconftool -g  /desktop/gnome/background/picture_filename `;fondori=g2-fondori
            elif [ $gnomeversion = 3 ]; then fondactuel=`gsettings get org.gnome.desktop.background picture-uri |sed s/.$// | cut -c9- `;fondori=g3-fondori
            fi
        else 
            echo "Désolé pas pris en charge actuellement "  
            start="non"
        fi
    fi
    if [[ $fond_aleatoire = "oui" ]];then fondactuel=$(find $rep_fond -type f -name '*.jpg' -o -name '*.png' | shuf -n 1);fondori=aleatoire-fondori ;fi

case $1 in
    "refresh")
  
        case $environnement in
            xfce ) xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/workspace0/last-image -s $imagefinale;;
            compiz ) feh  --bg-scale $imagefinale ;;
            fluxbox ) fbsetbg $imagefinale  ;;
            openbox ) feh  --bg-scale $imagefinale ;;
            kde ) sed -i "s#^wallpaper=.*#wallpaper=$imagefinale#" ~/.kde/share/config/plasma-desktop-appletsrc && kquitapp plasma-desktop && sleep 1 && plasma-desktop ;;
            gnomeshell ) if [ -d ~/.cache/wallpaper ];then  rm -f ~/.cache/wallpaper/* ;fi
                        gsettings set org.gnome.desktop.background picture-uri file://"$imagefinale";;
	    gnomepanel ) if [ -d ~/.cache/wallpaper ];then  rm -f ~/.cache/wallpaper/* ;fi
                        gsettings set org.gnome.desktop.background picture-uri file://"$imagefinale";;
            gnome ) if [ -d ~/.cache/wallpaper ];then  rm -f ~/.cache/wallpaper/* ;fi
                    if [ $gnomeversion = 2 ]; then
                        gconftool -s -t string /desktop/gnome/background/picture_filename "$imagefinale"
                    else                                   
                        gsettings set org.gnome.desktop.background picture-uri file://"$imagefinale" 
                    fi
            ;;
        esac
    ;;
    
    "restaure")
        if [ -e ~/.config/$fondori ];then
            fond=$(cat ~/.config/$fondori)
            case $environnement in
                gnome) if [ -d ~/.cache/wallpaper ];then  rm -f ~/.cache/wallpaper/* ;fi
                    if [ $gnomeversion = 2 ]; then gconftool -s -t string /desktop/gnome/background/picture_filename $fond
                    elif [ $gnomeversion = 3 ]; then gsettings set org.gnome.desktop.background picture-uri  file://$fond
                    fi
                ;;
                gnomeshell) if [ -d ~/.cache/wallpaper ];then  rm -f ~/.cache/wallpaper/* ;fi
                            gsettings set org.gnome.desktop.background picture-uri  file://$fond;;
                xfce) xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/workspace0/last-image -s $fond ;;
                compiz ) feh  --bg-scale $fond ;;
                fluxbox) fbsetbg "$fond";;
                openbox) feh  --bg-scale "$fond";;
                kde ) sed -i "s#^wallpaper=.*#wallpaper=$fond#" ~/.kde/share/config/plasma-desktop-appletsrc && kquitapp plasma-desktop && sleep 1 && plasma-desktop ;;
            esac
        fi
        exit
    ;;    
           
    "verif")   
        echo "$fondactuel" | grep "\-meteo.png"  -q ; retval=$?  
        if [ "$retval" != "0" ] ;then
            echo "$fondactuel" > ~/.config/$fondori
            convert "$fondactuel" "$fondbase" && cp  "$fondbase" "$imagefinale"
        else
            fond=$(cat ~/.config/$fondori)
            convert "$fond" "$fondbase"  
        fi
    ;;    
esac    

}

affichage()
{
    if [ -z "$destination" ];then gestion_fond refresh ;fi
}

case $1 in
    "restaure")gestion_fond restaure ;;
     "refresh")source $rep_ref/configs/$meteo_config
                init
                if [ -z "$destination" ];then
                    gestion_fond refresh 
                fi;;
esac

externe() 
{   
    if [ "$arg" != "rafraichir" ];then
        for i in $meteo_rep/scripts/extra/[0-9][0-9]-*.sh; do
            "$i" "$reptemp" "$repsauv"
        done
    fi
}
source $rep_ref/configs/$meteo_config
init 
externe
if [ -z "$destination" ];then
    gestion_fond verif
fi


ico_lune()
{
    ico_Lune=$IconesRep/moons;fich="$repsauv/lunaison"
    visi="$(sed -n "5p" "$fich"|cut -d " " -f6|cut -d "J" -f1)"
    ico=$ico_Lune/$visi".png"
    echo $ico

}


lune()
{

    visi=6;PL=16;NL=22;age=43;ephe=2;traj=50;ico=$(ico_lune)
    if [[ $1 != "ico" ]];then
        ref=$1;fich="$repsauv/lunaison";ligne="$[ref]"
        resultat="$(sed -n ""$ligne"p" "$fich"|sed 's/.*: //g')"
        case $ref in
            visi) resultat=$(echo $resultat*100|bc -l |sed 's/.\{10\}$//g');;

        esac
        echo "$resultat"
    else
        resultat=$ico
        echo "$resultat"
    fi       
}

form_vent()
{
    if [ "$resultat" = "N" ];then resultat="Nord"
    elif  [ "$resultat" = "E" ];then resultat="Est"
    elif  [ "$resultat" = "S" ];then resultat="Sud"
    elif  [ "$resultat" = "O" ]|| [ "$resultat" = "W" ];then resultat="Ouest"
    fi
}

ico_vent()
{
    if [ "$force" = "CLM" ]; then force="Calme";fi

    Calme=0;N=10;NNE=11;NE=12;ENE=13;E=14;ESE=15;SE=16;SSE=17;S=2;SSO=3;SO=4;OSO=5;W=6;O=6;WNW=7;ONO=7;NO=8;NNO=9;dir="$[direction]"

    #palier
    if (( "$force" <= "$palier" ));then icone=$dir
    elif (( "$force" <= "$(( $palier * 2 ))" ));then icone=$(( $dir + 17 ))
    elif (( "$force" <= "$(( $palier * 3 ))" ));then icone=$(( $dir + 34 ))
    elif (( "$force" >= "$(( $(( $palier * 3 )) +1 ))"  ));then icone=$(( $dir + 51 ))
    fi

    if (( "$icone" <= "9" )); then  resultat=$IconesRep/vent/0$icone.png
    else  resultat=$IconesRep/vent/$icone.png
    fi
}

ico_rafales()
{
#echo $force
if (( "$force" < 9 ));then 
	resultat="$IconesRep/vent/raf0.png"
elif (( $force < 22 ));then
	resultat="$IconesRep/vent/raf1.png"
elif (( $force < 45 ));then
	resultat="$IconesRep/vent/raf2.png"
else 
	resultat="$IconesRep/vent/raf3.png"
fi

}

verif_cond()
{
resultat="$(fgrep -w "$ref1:" "$fich"|cut -d " " -f2-)";
case "$1" in
"cond")
    if [ ! -z "$(echo $resultat|grep -F Poudreries)" ];then  resultat="Légères chutes de neige";fi
    ;;
"alerte")  
    while echo $resultat|fgrep -q -w "Détails >"; do resultat=$(echo ${resultat/Détails \>/ }); done 
    
    if echo $resultat|egrep  -w "attendue|attendues"|fgrep -q -w "entre" ;then
        mot_attendu=$(echo $resultat|egrep -o -w "attendue|attendues")
        resultat=$(echo ${resultat/entre/et})
        resultat=$(echo ${resultat/$mot_attendu/$mot_attendu entre})
    fi

    if echo $resultat|fgrep "On s'attend à de la"|fgrep -q -w "entre";then       
        resultat=$(echo ${resultat/entre/jusqu\'à})
    fi   

    if echo $resultat|fgrep -w "depuis"|fgrep -q -w "dans";then
        resultat=$(echo ${resultat/depuis/à partir de}) 
        resultat=$(echo ${resultat/dans/jusqu\'à})  
    fi
               
    while echo $resultat|fgrep -q -w "depuis"; do resultat=$(echo ${resultat/depuis/à partir de}); done   
   
    while echo $resultat|fgrep -q "tard la"; do resultat=$(echo ${resultat/tard la/tard dans la}); done
           
    while echo $resultat|fgrep -q "lorsqu'elle deviendra de la"; do resultat=$(echo ${resultat/lorsqu\'elle deviendra de la/se transformant en}); done
    
    while echo $resultat|fgrep -q -w "et s'accumulera de" ; do resultat=$(echo ${resultat/et s\'accumulera de/de}); done
        
    while echo $resultat|fgrep -q -w "avant de finir"; do resultat=$(echo ${resultat/avant de finir/jusqu\'à}); done

    while echo $resultat|fgrep -q -w "la nuit du"; do resultat=$(echo ${resultat/la nuit du/dans la nuit de}); done

    while echo $resultat|fgrep -q -w "pluie mélangées"; do resultat=$(echo ${resultat/pluie mélangées/pluie mélées}); done
   
    while echo $resultat|fgrep -q -w "sur le secteur"; do resultat=$(echo ${resultat/sur le secteur/sur la région}); done
   
    while echo $resultat|fgrep -q "lorsqu'elle se mélangera à"; do resultat=$(echo ${resultat/lorsqu\'elle se mélangera à/se  mélangeant à}); done
    
    while echo $resultat|fgrep -q "On s'attend à des averses"; do resultat=$(echo ${resultat/On s\attend à des averses/Averses probables}); done
    
    ;;
esac
}

dec_cond()
{
    #coupure conditions à moitié
    coupure="$((carac/2))"
    if [ "$coupure"  -le "28" ];then coupure="28";fi
    #echo "$resultat"|fold -s -w "$coupure" > $reptemp/$libell.txt
    echo "$resultat"|fmt -w "$coupure" > $reptemp/$libell.txt
}

sec_cond_1()
{   
    verif_cond  "$libell"
    carac="$(echo "$resultat"|wc -m)"
    if [ "$carac" -gt "26" ];then 
    dec_cond "$carac";resultat="$(sed -n "1p" $reptemp/$libell.txt)"
   fi  
}

sec_cond_2()
{    
    verif_cond "$libell"
    carac="$(echo "$resultat"|wc -m)"
    
    if [ "$carac" -gt "26" ];then  
        dec_cond "$carac" ;
        sec2="$(sed -n "2p" $reptemp/$libell.txt)"
        sec3="$(sed -n "3p" $reptemp/$libell.txt)"
        if [ ! -z "$sec3" ];then    
            resultat="$sec2\n  $sec3"
        else
            resultat="$sec2"
        fi
    
    else resultat=""
    fi
    
}

CC()
{
    
    # appel CC vent
    vent="VentD";vent_force="VentF";ico="Icone";jour="jour";mois="mois";annee="année";tmpmax="maxjour";tmpmaxlast="max1ans";tmpmin="minjour";tmpminlast="min1ans"
    ville="Ville";lat="Lat";long="Long";cond="Cond";sec1_cond="Cond";sec2_cond="Cond";temp="Temp";ressent="RealFeel";humid="Humidité";pression="Pression";tendpression="Pression"
    uv="Indice UV";couv="Couverture nuageuse";plafond="Plafond";rosee="Point de rosée";visib="Visibilité";alerte="Alerte";sec1_alerte="Alerte";sec2_alerte="Alerte"
    #refer indirecte
    ref="$1";eval ref1=\$$1;fich="$repsauv/CC"

    case "$ref" in
    "cond"|"alerte") verif_cond "$ref";;
    "sec1_cond"|"sec1_alerte") libell=$(echo "$ref"|cut -d "_" -f2);sec_cond_1 "$libell";;
    "sec2_cond"|"sec2_alerte") libell=$(echo "$ref"|cut -d "_" -f2);sec_cond_2 "$libell";;
    "pression")result="$(fgrep -w "$ref1:" "$fich"|cut -d " " -f2)";resultat=${result%???};;
    "temp"|"tmpmax"|"tmpmaxlast"|"tmpmin"|"tmpminlast"|"ressent"|"rosee")
    resultat="$(fgrep -w "$ref1:" "$fich"|cut -d ":" -f2|egrep -o '[[:digit:]]*')"
    sign="$(fgrep -w "$ref1:" "$fich"|cut -d ":" -f2|fgrep -o "-")"
    if [ ! -z "$sign" ];then resultat="$sign$resultat" ;fi
    ;;   
    "tendpression")result="$(fgrep -w "$ref1:" "$fich"|cut -d " " -f4)"
            if [ "$result" = "↑" ];then resultat="hausse"
            elif [ "$result" = "↓" ];then resultat="baisse"
            else resultat="stable"
            fi
            ;;
    "vent")resultat="$(fgrep -w "$ref1:" "$fich"|cut -d " " -f2-)" ;form_vent;;
    "icovent") force="$(fgrep -w "vitesse1:" "$fich"|cut -d ":" -f2 |egrep -o '[[:digit:]]*')";direction="$(fgrep -w "direction1:" "$fich"|cut -d " " -f2)";ico_vent;;
    "ville"|"lat"|"long") resultat="$(fgrep -w "$ref1:" "$fich"|cut -d " " -f2-)";;
    "ico")icon="$(fgrep -w "$ref1:" "$fich"|cut -d ":" -f2|egrep -o '[[:digit:]]*')"; resultat="$IconesRep/icone_meteo/$icon.png";;
    *)resultat="$(fgrep -w "$ref1:" "$fich"|cut -d ":" -f2|egrep -o '[[:digit:]]*')";;    
    esac
    if [ ! "$resultat" ];then resultat="NA" ;fi
    echo "$resultat"
}

prev_jour()
{
   
    #appel prev_jour 1 vent
    vent="VentD jour";vent_force="VentF jour";nuit_vent="VentD nuit";nuit_vent_force="VentF nuit";ico="Icone jour";nuit_ico="Icone nuit";jour="jour";mois="mois";annee="année";tmpmax="Maxjour"
    tmpmaxlast="Max1ans";tmpmin="Minjour";tmpminlast="Min1ans";temp="Temp jour";ressent="RealFeeljour";precip="Précipitations jour";nuit_temp="Temp nuit";nuit_ressent="RealFeelnuit"
    nuit_precip="Précipitations nuit";sollever="Lever du soleil";solduree="Duree soleil";solcouch="Coucher de soleil";lunelever="Lune lever";luneduree="Lune dur";lunecouch="Lune coucher"
    cond="Cond_jour";sec1_cond="Cond_jour";sec2_cond="Cond_jour";nuit_cond="Cond_nuit";sec1_nuit_cond="Cond_nuit";sec2_nuit_cond="Cond_nuit";rafale="Rafale jour";uv="Indice UV maximal jour"
    orage="Orages jour";preciptot="Précipitations jour";pluie="Pluie jour";neige="Neige jour";verglas="Verglas jour";nuit_rafale="Rafale nuit";nuit_uv="Indice UV maximal nuit"
    nuit_orage="Orages nuit";nuit_preciptot="Précipitations nuit";nuit_pluie="Pluie nuit";nuit_neige="Neige nuit";nuit_verglas="Verglas nuit"   

    #refer indirecte
    ref="$2"; eval ref1=\$$2; fich="$repsauv/Jour$1"   

    case "$ref" in
    "cond"|"nuit_cond") verif_cond "$ref";;
    "sec1_cond"|"sec1_nuit_cond")libell=$(echo "$ref"|cut -d "_" -f2-); sec_cond_1 "$libell";;
    "sec2_cond"|"sec2_nuit_cond")libell=$(echo "$ref"|cut -d "_" -f2-); sec_cond_2 "$libell";;
    "preciptot"|"pluie"|"neige"|"verglas"|"nuit_preciptot"|"nuit_pluie"|"nuit_neige"|"nuit_verglas"|"sollever"|"solcouch"|"lunelever"|"lunecouch")
        resultat="$(fgrep -w "$ref1:" "$fich"|cut -d ":" -f2- |cut -d " " -f2)";;
    "solduree"|"luneduree") resultat="$(grep  -w "$ref1:" "$fich"|cut -d ":" -f2- |cut -d " " -f2)";;
    "vent"|"nuit_vent") resultat="$(fgrep -w "$ref1:" "$fich"|cut -d " " -f3)";form_vent;;
    "icovent")force="$(fgrep -w "VentF jour:" "$fich"|cut -d ":" -f2 |egrep -o '[[:digit:]]*')";direction="$(fgrep -w "VentD jour:" "$fich"|cut -d " " -f3)";ico_vent;;
    "nuit_icovent")force="$(fgrep -w "VentF nuit:" "$fich"|cut -d ":" -f2 |egrep -o '[[:digit:]]*')";direction="$(fgrep -w "VentD nuit:" "$fich"|cut -d " " -f3)";ico_vent;;
    "ico"|"nuit_ico")icon="$(fgrep -w "$ref1:" "$fich"|cut -d ":" -f2|egrep -o '[[:digit:]]*')";resultat="$IconesRep/icone_meteo/$icon.png";;
        "temp"|"tmpmax"|"tmpmaxlast"|"tmpmin"|"tmpminlast"|"ressent"|"nuit_temp"|"nuit_ressent")
        resultat="$(fgrep -w "$ref1:" "$fich"|cut -d ":" -f2|egrep -o '[[:digit:]]*')"
        sign="$(fgrep -w "$ref1:" "$fich"|cut -d ":" -f2|fgrep -o "-")"
        if [ ! -z "$sign" ];then resultat="$sign$resultat" ;fi
    ;;   
    "ico_rafales"|"ico_nuit_rafales")
		if [ "$ref" = "ico_nuit_rafales" ];then 
			force="$(fgrep -w "Rafale nuit:" "$fich"|cut -d ":" -f2|egrep -o '[[:digit:]]*')"
		else
			force="$(fgrep -w "Rafale jour:" "$fich"|cut -d ":" -f2|egrep -o '[[:digit:]]*')"
		fi
		ico_rafales
	;;
    *)resultat="$(fgrep -w "$ref1:" "$fich"|cut -d ":" -f2|egrep -o '[[:digit:]]*')";;
    esac
    if [ ! "$resultat" ];then resultat="NA" ;fi
    echo "$resultat"
}

prev_quart()
{
    # AM-Soiree-Matin-Nuit
    #appel prev_quart AM 1 vent - Soiree 2 tmpmax etc
    vent="direction1";vent_force="vitesse1";ico="icone1";cond="cond";sec1_cond="cond";sec2_cond="cond";tmpmax="max";tmpmin="min";ressentmax="RealFeelmax";
    ressentmin="RealFeelmin";precip="Précipitations";pluie="Pluie";neige="Neige";humid="Humidité";couv="Couverture nuageuse";rosee="Point de rosée";visib="Visibilité"

    type=$1; ref=$3; eval ref1=\$$3; fich="$repsauv/$type$2" 
    case "$ref" in
    "cond") verif_cond "$ref";;
    "sec1_cond") libell=$(echo "$ref"|cut -d "_" -f2);sec_cond_1 "$libell";;
    "sec2_cond") libell=$(echo "$ref"|cut -d "_" -f2);sec_cond_2 "$libell";;
    "vent") resultat="$(fgrep -w "$ref1:" "$fich"|cut -d " " -f2)";form_vent;;
    "icovent")force="$(fgrep -w "vitesse1:" "$fich"|cut -d ":" -f2 |egrep -o '[[:digit:]]*')";direction="$(fgrep -w "direction1:" "$fich"|cut -d " " -f2)";ico_vent;;
    "vent_force")resultat="$(fgrep -w "vitesse1:" "$fich"|cut -d ":" -f2 |egrep -o '[[:digit:]]*')";;
    "ico")icon="$(fgrep -w "$ref1:" "$fich"|cut -d ":" -f2|egrep -o '[[:digit:]]*')";resultat="$IconesRep/icone_meteo/$icon.png" ;;
    "tmpmax"|"tmpmin"|"ressentmax"|"ressentmin"|"rosee")
    resultat="$(fgrep -w "$ref1:" "$fich"|cut -d ":" -f2|egrep -o '[[:digit:]]*')"
    sign="$(fgrep -w "$ref1:" "$fich"|cut -d ":" -f2|fgrep -o "-")"
    if [ ! -z "$sign" ];then resultat="$sign$resultat" ;fi
    ;;   
    "pluie"|"neige") resultat="$(grep "$ref1:" "$fich"|cut -d ":" -f2-|cut -d " " -f2)" ;;
    *)resultat="$(fgrep -w "$ref1:" "$fich"|egrep -o '[[:digit:]]*')";;   
    esac
    if [ ! "$resultat" ];then resultat="NA" ;fi
    echo "$resultat"
}

prev_huit()
{
    hre=$1;ref=$2;hreori=$hre
    #appel prev_huit 1 vent
    heure="Heure";temp="Temp°";ressent="RealFeel®";humid="Humidité";pluie="Pluie";neige="Neige";verglas="Verglas"
    vent="Vent (km/h)";vent_force="Vent (km/h)";uv="Indice UV";couv="Couverture nuageuse";rosee="Point de rosée";ico="Icone"
    #refer indirecte
    ref="$2";eval ref1=\$$2

    if (( "$hre" > "8" ));then
        fich="$repsauv/huitHeures2"; pos=$(($hre-8));ref1="$ref1$pos";hre=$((hre-8)) 
    else
        fich="$repsauv/huitHeures1"; ref1="$ref1$hre"
    fi    
   
    if [ "$ref" = "vent" ];then resultat="$(fgrep -w "$ref1:" "$fich"|cut -d ":" -f2 |cut -d " " -f3)";form_vent
    elif [ "$ref" = "icovent" ];then
        force="$(fgrep -w "Vent (km/h)$hre:" "$fich"|cut -d ":" -f2 |egrep -o '[[:digit:]]*')";direction="$(fgrep -w "Vent (km/h)$hre:" "$fich"|cut -d ":" -f2 |cut -d " " -f3)";ico_vent
    elif [ "$ref" = "ico" ]; then 
        icon="$(fgrep -w "$ref1:" "$fich"|cut -d ":" -f2|egrep -o '[[:digit:]]*')";resultat="$IconesRep/icone_meteo/$icon.png"
    elif [[ "$ref" = "temp" || "$ref" = "ressent" || "rosee" ]] ;then
    resultat="$(fgrep -w "$ref1:" "$fich"|cut -d ":" -f2|egrep -o '[[:digit:]]*')"
    sign="$(fgrep -w "$ref1:" "$fich"|cut -d ":" -f2|fgrep -o "-")"
    if [ ! -z "$sign" ];then resultat="$sign$resultat" ;fi
    else resultat="$(fgrep -w "$ref1:" "$fich"|cut -d ":" -f2|egrep -o '[[:digit:]]*')"
    fi
    if [ ! "$resultat" ];then resultat="NA" ;fi
    echo "$resultat"
    }

alerte_cart()
{
    
#appel  $(alerte_cart long "$fonte2" centre yellow)
long="$1";justif=$3;coul=$4;icone="$IconesRep/divers/alerte.png";ico=$5;nom="$reptemp/alerte.png";echo "$nom"

if [ -z "$long" ]; then long="600" ;fi
if [ ! -z "$2" ];then fonte="$2" ;fi
if [  -z "$4" ]; then coul="red" ;fi

case "$3" in
gauche)justif="West";;
centre)justif="Center";;
droite)justif="East";;
*)justif="Center";;
esac
    
texte=$(echo -e $(CC alerte))
if [ "$texte" = "RAS" ] ;then texte="Pas d'alerte.";long=200;coul=springgreen; fi 
if [ "$coul" = "degra" ];then
ddd=`echo -e "\n$texte"`
convert -background  none   -font "$fonte" -pointsize 36 -size "$long"x100 -gravity "$justif"  caption:"$ddd" \( +clone -sparse-color barycentric '0,%h gold %w,0 red' +clone \) +swap  -layers merge $nom
else
ddd=`echo -e "\n$texte"`
convert -background  none  -fill "$coul" -font "$fonte" -pointsize 36 -size "$long"x100 -gravity "$justif"  caption:"$ddd" $nom
fi

if [ "$texte" != "Pas d'alerte." ] ;then
    if [ ! -z "$ico" ];then
        long1=$(($long + 95))
        convert  -size "$long1"x100 xc:transparent $icone -gravity west -geometry 100x100+6+0  -composite $nom -gravity East -composite $nom
    fi
fi 
}

cond_cart()
{

type="$1"

case "$type" in
CC)long="$2";fonte="$3";just="$4";coul="$5";texte=$(echo -e $(CC cond));nom="$reptemp/CC-cond.png";echo "$nom";;
prev_jour)jour="$2";condition="$3";long="$4";fonte="$5";just="$6";coul="$7";texte=$(echo -e $(prev_jour "$jour" "$condition"));nom="$reptemp/prev-j$jour-$condition.png";echo "$nom";;
prev_quart)moment="$2";jour="$3";long="$4";fonte="$5";just="$6";coul="$7";texte=$(echo -e $(prev_quart "$moment" "$jour" cond));nom="$reptemp/$moment-j$jour-cond.png";echo "$nom";;
esac    

case "$just" in
gauche)justif="West";;
centre)justif="Center";;
droite)justif="East";;
*)justif="Center";;
esac
ddd=`echo -e "$texte"`
convert -background  none  -fill "$coul" -font "$fonte" -pointsize 32 -size "$long"x90 -gravity "$justif"  label:"$ddd" -trim \
\( +clone -background grey19  -shadow 100x1 -channel A -level 0,5% +channel \) +swap +repage -gravity center -composite $nom

}

############# modules graphiques ##############
rose()
{
    # recup dir et force
    if (( "$#" == "4" )); then  direction=$($1 $2);force=$($1 $2_force);taille="$3";opacite="$4";nom=Rose-"$1"
    elif (( "$#" == "5" )); then direction=$($1 $2 $3);force=$($1 $2 $3_force);taille="$4";opacite="$5";nom=Rose-"$1-$2"
    elif (( "$#" == "6" )); then direction=$($1 $2 $3 $4);force=$($1 $2 $3 $4_force);taille="$5";opacite="$6";nom=Rose-"$2-$3"
    else exit
    fi
     echo "$reptemp/$nom.png" 
     
     #couleurs
    if (( "$force" <= "$palier" ));then couleur=$palier1;couleurfont=$palier1coulfont
    elif (( "$force" <= "$(( $palier * 2 ))" ));then couleur=$palier2;couleurfont=$palier2coulfont
    elif (( "$force" <= "$(( $palier * 3 ))" ));then couleur=$palier3;couleurfont=$palier3coulfont
    elif (( "$force" >= "$(( $(( $palier * 3 )) +1 ))"  ));then couleur=$palier4;couleurfont=$palier4coulfont
    fi
    
    #def angle
    if [ "$direction" = "Calme" ];then angle="vide"
    elif [ "$direction" = "Nord" ];then angle="0"
    elif [ "$direction" = "NNE" ];then angle="22.5"
    elif [ "$direction" = "NE" ];then angle="45"
    elif [ "$direction" = "ENE" ];then angle="67.5"
    elif [ "$direction" = "Est" ];then angle="90"
    elif [ "$direction" = "ESE" ];then angle="112.5"
    elif [ "$direction" = "SE" ];then angle="135"
    elif [ "$direction" = "SSE" ];then angle="157,5"
    elif [ "$direction" = "Sud" ];then angle="180"
    elif [ "$direction" = "SSO" ];then angle="202.5"
    elif [ "$direction" = "SO" ];then angle="225"
    elif [ "$direction" = "OSO" ];then angle="247.5"
    elif [ "$direction" = "Ouest" ];then angle="270"
    elif [ "$direction" = "ONO" ];then angle="292.5"
    elif [ "$direction" = "NO" ];then angle="315"
    elif [ "$direction" = "NNO" ];then angle="337.5"
    else angle="vide"
    fi
    
    if [ "$angle" != "vide" ];then
        convert -background transparent $Rose/$couleur  -rotate "$angle" $reptemp/dir_rot.png
        composite -compose Over  -gravity Center $reptemp/dir_rot.png $Rose/base.png $reptemp/$nom.png
    else
        composite -compose Over  -gravity Center $Rose/Calme.png $Rose/base.png $reptemp/$nom.png
    fi
    
    convert $reptemp/$nom.png -font /usr/share/fonts/accuweather_fonts/AlteHaasGroteskBold.ttf   \
    -fill "$couleurfont" -pointsize 62 -gravity center -annotate +0-22 "$force"  \
    -fill "$couleurfont" -pointsize 42 -gravity center -annotate +0+22 "km/h" $reptemp/$nom.png

    if [ "$taille" != "0x0" ];then
        mogrify -resize $taille!  $reptemp/$nom.png
    fi
    if [ "$opacite" != "100" ];then
        composite -blend 0x$opacite null: $reptemp/$nom.png -matte  $reptemp/$nom.png
    fi
}

barograph()
{
#####
bord=315 ;pos1=40 ;pos2=305 ;posdepart=42 ;ecart=28
$meteo_rep/scripts/extra/barognuplot.sh &&

nom="$reptemp/$1.png";coultemp="$2";coulpress="$3";cadre="$4";coulfond="$5";coulbord="$6";taillebord="$7"
if [ -z "$cadre" ];then
    convert -size 352x190 xc:none $nom
else
    convert -size 352x190 xc:none  -fill $coulfond -strokewidth $taillebord -stroke $coulbord -draw "roundrectangle 1,1 351,189 5,5" $nom
fi
convert -background none -fill $coulpress -font $fonte1 -pointsize 20 -gravity center label:"Pression" \
\( +clone -background black  -shadow 100x1 -channel A -level 0,6% +channel \) +swap +repage -gravity center -composite $imagetemp
composite  -gravity North -background transparent -geometry +54+0 -dissolve 65% $imagetemp   $nom $nom
convert -background none -fill $coultemp -font $fonte1 -pointsize 20 -gravity center label:"Température" \
\( +clone -background black  -shadow 100x1 -channel A -level 0,6% +channel \) +swap +repage -gravity center -composite $imagetemp
composite  -gravity North -background transparent -geometry -52+0 -dissolve 65% $imagetemp   $nom $nom



convert $nom -background transparent \
$meteo_rep/images/graph2.png -background transparent -gravity North -geometry -5+18 -composite \
-font $fonte -pointsize 11 \
-fill $coultemp -gravity Northeast -annotate +$bord+$posdepart "40C°-"  -fill $coulpress -gravity Northwest -annotate +$pos2+$posdepart "-1040mb" \
-fill $coultemp -gravity Northeast -annotate +$bord+$(((ecart*1)+posdepart)) "20C°-" -fill $coulpress -gravity Northwest -annotate +$pos2+$(((ecart*1)+posdepart)) "-1020mb" \
-fill $coultemp -gravity Northeast -annotate +$bord+$(((ecart*2)+posdepart)) "0C°-" -fill $coulpress -gravity Northwest -annotate +$pos2+$(((ecart*2)+posdepart)) "-1000mb" \
-fill $coultemp -gravity Northeast -annotate +$bord+$(((ecart*3)+posdepart)) "-20C°-" -fill $coulpress -gravity Northwest -annotate +$pos2+$(((ecart*3)+posdepart)) "-980mb" \
-fill $coultemp -gravity Northeast -annotate +$bord+$(((ecart*4)+posdepart)) "-40C°-" -fill $coulpress -gravity Northwest -annotate +$pos2+$(((ecart*4)+posdepart)) "-960mb" \
$nom



}

barometre()
{
    # appel barometre taille opacité affich_hr
    HR=$(CC humid)
    taille="$1";opacite="$2";aff_hr="$3"
    pression=$(CC pression)
    tend=$(CC tendpression)
    angle=$(echo "$((pression -980))*4.5-135"|bc)
    if [ "$tend" == "hausse" ];then aiguille=$Barometre/aiguille-bleue.png
    elif [ "$tend" == "baisse" ];then aiguille=$Barometre/aiguille-rouge.png
    else aiguille=$Barometre/aiguille.png
    fi
    
    convert -background transparent $aiguille -rotate "$angle" $reptemp/aiguille_rot.png
    
    if [  "$aff_hr" == "hr" ];then
        nom="Barometre_hr.png";echo "$reptemp/$nom"
        convert $Barometre/base.png -background transparent  -font $fonte -pointsize 45  -gravity South  \
        -stroke white -strokewidth 2  -annotate +0+110 "H.R: $HR %" \
        -stroke  none   -fill blue    -annotate +0+110 "H.R: $HR %" \
        $reptemp/$nom
        composite -compose Over  -gravity Center  $reptemp/aiguille_rot.png $reptemp/$nom  $reptemp/$nom
    else
        nom="Barometre.png";echo "$reptemp/$nom"
        composite -compose Over  -gravity Center  $reptemp/aiguille_rot.png $Barometre/base.png  $reptemp/$nom
    fi
    if [ "$taille" != "0x0" ];then
    mogrify -resize $taille!  $reptemp/$nom
    fi
     if [ "$opacite" != "100" ];then
    composite -blend 0x$opacite null: $reptemp/$nom  -matte  $reptemp/$nom
    fi

}

thermo()
{
# appel thermo CC taille opacite base coul_lib couleur_max couleur_min
# la taille en %
# si base=masque doit exister la variable $thermo_masque ex: thermo_masque="/tmp/weather.png"

    # recup valeur
    cond=$1

	assemble_thermo()
	{
	hcol=$((t1*5+150)) 
    
	echo "$nom_dest"
	if [ "$base" = "masque" ] && [ ! -z "$thermo_masque" ]; then
		composite "$thermo_masque"  $Therm/base.png $Therm/masque.png "$nom_dest"
	elif [ "$base" = "vide" ];then
		convert  -size "196x592" xc:none "$nom_dest"
	else
		composite -compose Over  $Therm/$base.png  $Therm/base.png "$nom_dest"
	fi
	
    convert $Therm/0.png -resize 20x$hcol! $reptemp/colonne.png
    composite -compose Over -geometry -0+108 -gravity South  $reptemp/colonne.png $Therm/alcool.png $reptemp/colonne.png 
    composite -compose Over $reptemp/colonne.png 	"$nom_dest" "$nom_dest"
    if [ "$coul_lib" = "blanc" ];then 
       composite -compose Over "$Therm/lib_blanc.png"	"$nom_dest" "$nom_dest"
    else
        composite -compose Over "$Therm/lib_noir.png"	"$nom_dest" "$nom_dest"
    fi
    if [ ! -z "$coul_max" ];then 
    positiont2=$((t2*5+258))
    composite -compose Over  -geometry -0+"$positiont2"  -gravity South $Therm/$coul_max.png "$nom_dest" "$nom_dest"
	fi
	if [ ! -z "$coul_min" ];then 
	positiont3=$((t3*5+258))
    composite -compose Over  -geometry -0+"$positiont3"  -gravity South $Therm/$coul_min.png "$nom_dest" "$nom_dest"
	fi

    if [ "$taille" != "100" ];then  mogrify -resize $taille%  $nom_dest;fi
    if [ "$opacite" != "100" ];then composite -blend 0x$opacite null: $nom_dest -matte  $nom_dest ;fi
    rm  $reptemp/colonne.png
	}

 case $1 in 
    "CC")
    taille="$2";opacite="$3";base="$4";coul_lib="$5";coul_max="$6";coul_min="$7"
    nom_dest=$reptemp/"$cond"_alcootherm.png
    t1=$(CC temp)
    t2=$(CC tmpmax)
    t3=$(CC tmpmin)
    assemble_thermo
    ;;
	"prev_jour")	
	jour="$2";taille="$3";opacite="$4";base="$5";coul_lib="$6";coul_max="$7";coul_min="$8"
	nom_dest="$reptemp/"$cond""$jour"_alcootherm.png"
	t1=$(prev_jour "$jour" temp)
	t2=$(prev_jour "$jour" tmpmax)
	t3=$(prev_jour "$jour" tmpmin)
	assemble_thermo
	;;
	"prev_quart")
	# temp = tempjour
	moment="$2";jour="$3";taille="$4";opacite="$5";base="$6";coul_lib="$7";coul_max="$8";coul_min="$9"
	nom_dest="$reptemp/"$cond""$moment""$jour"_alcootherm.png"
	t1=$(prev_jour $jour temp)
	t2=$(prev_quart $moment "$jour" tmpmax)
	t3=$(prev_quart $moment "$jour" tmpmin)
	assemble_thermo
	;;
	"prev_huit")
	
	heure="$2";taille="$3";opacite="$4";base="$5";coul_lib="$6";coul_max="$7";coul_min="$8"
	nom_dest="$reptemp/"$cond""$heure""$jour"_alcootherm.png"
	t1=$(prev_huit "$heure" temp)
	t2=$(CC tmpmax)
	t3=$(CC tmpmin)
	assemble_thermo
	;;
 esac   
    
}

thermorond()
{
    
    # appel thermorond CC taille opacite couleur
    #                  prev_jour n° taille opacite couleur
    #                  prev_quart moment  n° taille opacite couleur
    #                  prev_huit heure taille opacite couleur
    blc=1;ble=2;jau=3;rou=4;ver=5;nul=0;aig[1]="ind-blanc.png";aig[2]="ind-bleu.png";aig[3]="ind-jaune.png";aig[4]="ind-rouge.png"; aig[5]="ind-vert.png";aig[0]="null" 
    # recup valeur
    cond=$1
    rotaiguille()
    {
        angle=$(echo "$(($1*4))-40"|bc)
        convert -background transparent $ThermRond/"$2" -rotate "$angle" $reptemp/"$2"
    }

    finalisation()
{
    echo "$nom_dest"
    if [ "$taille" != "0x0" ];then  mogrify -resize $taille!  $nom_dest;fi
    if [ "$opacite" != "100" ];then composite -blend 0x$opacite null: $nom_dest  -matte  $nom_dest ; fi
    rm $reptemp/$indic  
    }
   
    case $1 in 
    "CC")
        taille="$2";opacite="$3";coul="$4";info="$5";t2=$(CC ressent);indic="$[coul]";
        
        if [ "$coul" != "nul" ];then
            nom_dest="$reptemp/"$cond"_therm"$coul".png"
            else
            nom_dest="$reptemp/"$cond"_therm.png"
        fi
 
        if [ ! -z "$info" ];then
            date_jour=$(date +%d" "%b);base="$nom_dest";libell="$date_jour"
            convert $ThermRond/base.png   -gravity South -font $fonte -pointsize 40 \
            -annotate +4+147  "$libell"  \
            -fill white -annotate +0+150 "$libell" \
            $nom_dest
        else
            base=$ThermRond/base.png 
        fi
        
        if [ "$coul" != "nul" ];then
             rotaiguille "$t2" "${aig[indic]}"
             composite -compose Over  -gravity Center $reptemp/"${aig[indic]}" $base  $nom_dest;rm -f $reptemp/"${aig[indic]}"
             t1=$(CC temp);indic="aiguille.png";rotaiguille $t1 $indic   
            composite -compose Over  -gravity Center $reptemp/$indic  $nom_dest $nom_dest       
        else
            t1=$(CC temp);indic="aiguille.png";rotaiguille $t1 $indic
            composite -compose Over  -gravity Center $reptemp/$indic $base $nom_dest
        fi
        finalisation $1
    ;;

    "prev_jour")
        jour="$2";taille="$3";opacite="$4";coul="$5";info="$6";t2=$(prev_jour "$jour" ressent);indic="$[coul]";
        
        if [ "$coul" != "nul" ];then
            nom_dest="$reptemp/"$cond""$jour"_therm"$coul".png"
        else
            nom_dest="$reptemp/"$cond""$jour"_therm.png"
        fi    
    
        if [ ! -z "$info" ];then
            date_jour="$(date --date "$(($2- 1)) day" +%d" "%b)";base="$nom_dest";libell="Prévu\nLe\n$date_jour"
            convert $ThermRond/base.png   -gravity South -font $fonte -pointsize 40 \
            -annotate +4+139  "$libell"  \
            -fill white -annotate +0+142 "$libell" \
            $base
        else
            base=$ThermRond/base.png 
        fi
        if [ "$coul" != "nul" ];then
            rotaiguille "$t2" "${aig[indic]}" 
            composite -compose Over  -gravity Center $reptemp/"${aig[indic]}" $base $nom_dest;rm -f $reptemp/"${aig[indic]}"
            t1=$(prev_jour "$jour" temp);indic="aiguille.png";rotaiguille $t1 $indic 
            composite -compose Over  -gravity Center $reptemp/$indic  $nom_dest  $nom_dest
        else
            t1=$(prev_jour "$jour" temp);indic="aiguille.png";rotaiguille $t1 $indic 
            composite -compose Over  -gravity Center $reptemp/$indic $base $nom_dest   
        fi    
        finalisation $1-$jour
    ;;

    "prev_quart")
        moment="$2";jour="$3";taille="$4";opacite="$5";coul="$6";info="$7";t2=$(prev_quart $moment $jour tmpmax);indic="$[coul]";

        if [ "$coul" != "nul" ];then
            nom_dest="$reptemp/"$cond""$moment""$jour"_therm"$coul".png"
        else
            nom_dest="$reptemp/"$cond""$moment""$jour"_therm.png"
        fi  

        if [ ! -z "$info" ];then
            date_jour=$(date --date "$(($3-1)) day" +%d" "%b);base="$nom_dest";libell="$moment\ndu\n$date_jour"
            convert $ThermRond/base.png   -gravity South -font $fonte -pointsize 40 \
            -annotate +4+139  "$libell"  \
            -fill white -annotate +0+142 "$libell" \
            $base
        else
            base=$ThermRond/base.png 
        fi

        if [ "$coul" != "nul" ];then                
        rotaiguille "$t2" "${aig[indic]}"
        composite -compose Over  -gravity Center $reptemp/"${aig[indic]}" "$base"  "$nom_dest" 
         rm $reptemp/"${aig[indic]}"
        t1=$(prev_quart $moment $jour tmpmin);indic="aiguille.png";rotaiguille $t1 $indic     
        composite -compose Over  -gravity Center "$reptemp/$indic"  "$nom_dest" "$nom_dest" 
        else
            t1=$(prev_quart $moment $jour tmpmin);indic="aiguille.png";rotaiguille $t1 $indic 
            composite -compose Over  -gravity Center "$reptemp/$indic"  "$base"  "$nom_dest" 
        fi

        finalisation $1-$moment$jour
    ;;
    
    "prev_huit")
        heure="$2";taille="$3";opacite="$4";coul="$5";info="$6";t2=$(prev_huit $heure ressent);indic="$[coul]"; 
        if [ "$coul" != "nul" ];then
            nom_dest="$reptemp/"$cond""$heure"_therm"$coul".png"
        else
            nom_dest="$reptemp/"$cond""$heure"_therm.png"
        fi  

        if [ ! -z "$info" ];then
            date_jour="$(($heure_maint+$2)) h";base="$nom_dest";libell="Aujourd'hui\nvers\n$date_jour"
            convert $ThermRond/base.png   -gravity South -font $fonte -pointsize 40 \
            -annotate +4+139  "$libell"  \
            -fill white -annotate +0+142 "$libell" \
            $base
        else
            base=$ThermRond/base.png 
        fi

        if [ "$coul" != "nul" ];then
            rotaiguille "$t2" "${aig[indic]}"
            composite -compose Over  -gravity Center $reptemp/"${aig[indic]}" $base  $nom_dest;rm $reptemp/"${aig[indic]}"
            t1=$(prev_huit $heure temp);indic="aiguille.png";rotaiguille $t1 $indic 
            composite -compose Over  -gravity Center $reptemp/$indic  $nom_dest  $nom_dest
        else
            t1=$(prev_huit $heure temp);indic="aiguille.png";rotaiguille $t1 $indic 
            composite -compose Over  -gravity Center $reptemp/$indic  $base  $nom_dest
        fi
        finalisation $1-$heure
    ;;
    esac
}

lunaison()
{   
    taille="$1";opacite="$2";fich="$repsauv/lunaison";nom="$reptemp/lunaison.png";echo "$nom" 
 
test_j=$(sed -n "43p" "$fich"|fgrep   "J")

if [ -z  "$test_j" ];then
      
    j="0"
    h="$(sed -n "43p" "$fich"|cut -d " " -f4|cut -d "H" -f1)"
    m="$(sed -n "43p" "$fich"|cut -d " " -f5|cut -d "M" -f1)" 
    else
    j="$(sed -n "43p" "$fich"|cut -d " " -f2|cut -d "J" -f1)"
    h="$(sed -n "43p" "$fich"|cut -d " " -f3|cut -d "H" -f1)"
    m="$(sed -n "43p" "$fich"|cut -d " " -f4|cut -d "M" -f1)" 
    fi

    angle=$(echo "((360/42524)* $(((((((($j*24))+$h))*60))+$m)))+180"|bc -l)
   
    convert -background transparent $Lune/indicateur.png -rotate  ${angle/.*} $reptemp/indicateur_rot.png 
    composite -compose Over  -gravity Center $reptemp/indicateur_rot.png $Lune/lune-base.png "$nom" 
    if [ "$taille" != "0x0" ];then
        mogrify -resize $taille! "$nom"
    fi 
    if [ "$opacite" != "100" ];then
        composite -blend 0x$opacite null: -matte "$nom" "$nom"
    fi
}



############# modules compo ##############
crea_cart()
{    
nom="$reptemp/$1.png" ;export image_"$1"="$nom" ;taille="$2";cadre="$3";couleur="$4";bordure="$5";couleurfond=$6;arrondi=$7

if [ -z "$cadre" ];then
convert  -size "$taille" xc:none $nom
else
# rectangle 1px de moins sur la taille
L=$(echo $taille|cut -d x -f1);L=$((L - 1))
H=$(echo $taille|cut -d x -f2);H=$((H - 1))
convert -size $taille xc:none  -fill $couleurfond -strokewidth "$bordure" -stroke "$couleur" -draw "roundrectangle 1,1 $L,$H $arrondi,$arrondi" $nom
fi

}

crea_texte()
{
nom="$reptemp/$1.png" ;export image_"$1"="$nom";taille="$2";texte="$3";couleur="$4";fnt="$5";t_font="$6";stro="$7";coul_stro="$8"


if [ -z "$stro" ];then

convert -background transparent -gravity Center -size $taille -font "$fnt" -pointsize $t_font -fill $couleur  label:"$texte" $nom 
else
convert -background transparent  -gravity Center -size $taille -strokewidth $stro -stroke $coul_stro -font "$fnt" -pointsize $t_font -fill $couleur label:"$texte" $nom 
fi
}

crea_texte_vert()
{
nom="$reptemp/$1.png" ;export image_"$1"="$nom";texte="$2";couleur="$3";fnt="$4";t_font="$5";stro="$6";coul_stro="$7"


if [ -z "$stro" ];then
ddd=`echo -n "$texte" | sed 's/./&\n/g; s/@$//'`

convert -background none -fill $couleur -font $fnt -pointsize $t_font -gravity center label:"$ddd" $nom
else
ddd=`echo -n "$texte"| sed 's/./&\n/g; s/@$//'`
convert -background none -fill $couleur -font $fnt -pointsize $t_font  -strokewidth $stro -stroke $coul_stro -gravity center label:"$ddd | tr '@' '\012'"  $nom
fi
}

crea_texte_multi()
{
    #appel crea_texte_multi "nom" "fonte" "t_font" "stroke_with" "stroke" "coul" "texte1" "coul2" "texte2" etc..

    nom="$reptemp/$1.png" ;echo "$nom";fnt="$2";t_font="$3";stro="$4";coul_stro="$5"
    #nombre arg
    args="$#";result=""
   
    boucle=$(((args-5)/2))
    
    for (( x=1 ; x<=$boucle ; x++ ));do
        numarg="$((((x*2)+5)-1))"
        coul[x]="${!numarg}"
        numarg1=$((numarg+1));texte[x]="${!numarg1}";result="$result -fill ${coul[x]} label:\"${texte[x]}\""
       
    done
    if [ "$stro" = "0" ];then
     echo -e "#!/bin/bash\nconvert -background transparent  -font "$fnt" -pointsize "$t_font" $result +append \"$nom\"" > "$reptemp/multi.txt"
    else
    echo -e "#!/bin/bash\nconvert -background transparent -strokewidth "$stro" -stroke "$coul_stro" -font "$fnt" -pointsize "$t_font" $result +append \"$nom\"" > "$reptemp/multi.txt"
    fi
    chmod +x $reptemp/multi.txt;$reptemp/multi.txt;rm $reptemp/multi.txt

}

crea_tend()
{
tendance=$1;taille=$2;coul=$3;
if [ "$tendance" == "hausse" ];then tend="c";convert  -background none  -font $repfont/Arrows.ttf  -fill $coul -size x"$taille"  -gravity center label:"$tend"  $reptemp/tend.png
elif [ "$tendance" == "baisse" ];then tend="d";convert  -background none -font $repfont/Arrows.ttf  -fill $coul  -size x"$taille"  -gravity center label:"$tend"  $reptemp/tend.png
else
tend="~\n~";convert -interline-spacing -13 -background none  -fill $coul -size x"$taille" -gravity North label:"$tend"  $reptemp/tend.png
fi
}

crea_finale()
{
nom="$reptemp/$1.png" ;echo "$nom";taille="$2";image="$3";export image_"$1"="$nom"
}

crea_graph()
{
nom="$reptemp/$1.png" ;echo "$nom"    

case "$2" in

ligne)
rot="$5"
if [ -z "$rot" ];then rot=0;fi
convert  -size "$3" xc:"$4" -background none -rotate "$rot" "$nom"
;;

quad)
lg="$3";lar="$4";arron="$5";coul="$6";rot="$7";stro="$8";strokewi="$9";bord=10;lgim=$((bord+lg));larim=$((bord+lar))
if [ -z "$stro" ];then stro="$coul";strokewi=0;fi

convert -size "$lgim"x"$larim" xc:none -background transparent  -fill "$coul" -stroke "$stro" -strokewidth  "$strokewi" -draw "roundrectangle $bord,$bord $lg,$lar $arron,$arron"  "$nom"
if [ "$rot" != "0" ]; then convert  "$nom"  -distort SRT "$rot" "$nom";fi

;;

triangle)
coul="$7";rot="$8";stro="$9";
if [ -z "$stro" ];then stro="$coul";fi
convert -size "$6"x"$4" xc:none -background none -fill "$coul" -stroke "$stro"  -draw "polygon  0,0 $3,$4 $6,$5 " -rotate "$rot" "$nom"
if [ "$rot" != "0" ]; then convert  "$nom"  -distort SRT "0" "$nom";fi
;;

cercle)
rayon="$3";coul="$4";stro="$5"; strokewi="$6";bord=$((rayon+5));taille=$((bord*2));
if [ -z "$stro" ];then stro="$coul";strokewi=0;fi
convert -size "$taille"x"$taille" xc:none -fill "$coul" -background none  -stroke "$stro"  -strokewidth  "$strokewi" -draw "ellipse $bord,$bord $rayon,$rayon 0,360" "$nom"

;;

ellipse)
rayon="$3";ht="$4";coul="$5";rot="$6"; stro="$7"; strokewi="$8";bord=$((rayon+5));ht=$((ht*2));taille=$((bord*2));
if [ -z "$stro" ];then stro="$coul";strokewi=0;fi
convert -size "$taille"x"$taille" xc:none -fill "$coul" -background none  -stroke "$stro"  -strokewidth  "$strokewi" -draw "ellipse $bord,$bord $rayon,$ht 0,360"   "$nom"
if [ "$rot" != "0" ]; then
convert  "$nom"  -distort SRT "$rot" "$nom"
    #Dimension=$(identify  -format '%G' "$nom")
    #convert  -size "$Dimension" xc:none $reptemp/base.png
    #composite  -gravity center -background transparent  -geometry  +0+0 "$nom" "$reptemp/base.png"  "$nom"
    #rm -f $reptemp/base.png
fi

;;

esac

}


ajout_cart()
{
nom="$reptemp/$1.png" ;export image_"$1"="$nom" ;ref="$2";rot="$3";pos_bord="$4";pos_haut="$5";texte="$6";couleur="$7";fnt="$8";t_font="$9"
#convert -background transparent -font "$fnt" -pointsize "$t_font" -fill "$couleur" label:"$texte" "/$reptemp/tmp.png"
convert "$nom" -background transparent -gravity "$ref" -font "$fnt" -pointsize "$t_font" -fill "$couleur"  -annotate "$rot"x"$rot"$pos_bord$pos_haut "$texte" $nom

}

ajout_ima_cart()
{
   
nom="$reptemp/$1.png" ;export image_"$1"="$nom" ;ref="$2";taille="$3";rot="$4";pos_bord="$5";pos_haut="$6";image="$7";opa="$8"
if [ -z "$opa" ];then opa=100 ;fi
im_temp="$image"

# rotation
if [ "$rot" != "0" ]; then
im_temp="$reptemp/tmp.png"
convert  "$image"  -distort SRT "$rot" "$im_temp"
fi
composite  -gravity "$ref" -background transparent  -geometry  "$taille"%x"$pos_bord$pos_haut" -dissolve "$opa"% "$im_temp" "$nom" "$nom"
rm -f $reptemp/tmp.png
}

crea_ombre()
{
if [ -z "$(echo $1|fgrep ".png")" ];then            
    nom="$reptemp/$1.png"
    dest="$reptemp/$1.png"
    export image_"$1"="$nom"
else
    nom="$1"
    fich=$(basename $1)
    dest="$reptemp/$fich"
    fich1=$(echo ${fich%%.png}) 
    echo  $dest
fi    

force="$2"   
convert $nom -bordercolor None -border 10x10 \( +clone -background black -shadow 100x$force \) -compose DstOver -composite -compose Over $dest
}

crea_cercle_repart()
{
nom="$1" ; rayongabarit=$2;tableau=$3;nbdiv=$4;nb_decal=$5 ;rot_im=$6;rot2=0

# recupération tableau
new_tableau=($(eval echo $(echo \${$tableau[@]})))
angl=$(echo "360/$nbdiv" |bc -l)
pi=$(echo "scale=10; 4*a(1)" | bc -l) 
decal=$(echo "$angl*$nb_decal"|bc -l)

Larg=$(identify  -format '%w' "${new_tableau[0]}")
Dim=$((Larg+(rayongabarit*2)+20))

crea_cart "cart_tempo" "$((Dim))x$((Dim))"  # creation cart final

for (( x=0; x<$nbdiv; x++ )); do
rot=$(echo "($x*$angl)-90+$decal" | bc -l)
rot1=$(echo "($x*$angl)+$decal" | bc -l)
cx=$(echo "$rayongabarit*c($rot/180*$pi)" | bc -l)
if [ "$(echo $cx|cut -c1)" != "-" ];then cx=$(echo "+$cx");fi
cy=$(echo "$rayongabarit*s($rot/180*$pi)" | bc -l)
if [ "$(echo $cy|cut -c1)" != "-" ];then cy=$(echo "+$cy");fi

if [ "$rot_im" = "oui" ]; then rot2=$(echo $rot1 |cut -d "." -f1); fi
ajout_ima_cart "cart_tempo" "center" "100" "$rot2" "$cx" "$cy" "${new_tableau[x]}" 
done    

mv "$reptemp/cart_tempo.png" "$reptemp/$1.png"
nom="$reptemp/$1.png";echo "$nom";
}

pour ton xplanet il faut que tu lance la compo a la fin de ton script

Dernière modification par daniel38100 (Le 24/01/2017, à 16:03)

Hors ligne

#1341 Le 24/01/2017, à 16:12

ragamatrix

Re : [Conky] Alternative à weather.com (3)

Merci !
ça fonctionne, sur compiz avec feh, mais le calendrier est bizarre :
1485270623.png

Hors ligne

#1342 Le 24/01/2017, à 16:23

daniel38100

Re : [Conky] Alternative à weather.com (3)

ragamatrix a écrit :

Merci !
ça fonctionne, sur compiz avec feh, mais le calendrier est bizarre :

bizarre que te renvoi

date --date "1 day" +%^a.%d%^b

sinon remplace

eee=`echo ${calen[x]} | sed 's/é/E/g' | cut -c6-7`

par

eee=`echo ${calen[x]} | sed 's/é/E/g' | cut -c5-6`

Dernière modification par daniel38100 (Le 24/01/2017, à 16:24)

Hors ligne

#1343 Le 24/01/2017, à 16:25

ragamatrix

Re : [Conky] Alternative à weather.com (3)

daniel38100 a écrit :
ragamatrix a écrit :

Merci !
ça fonctionne, sur compiz avec feh, mais le calendrier est bizarre :

bizarre que te renvoi

date --date "1 day" +%^a.%d%^b

ça a l'air pourtant bon ?

●[raphix@debian]●[16:24:42]● 
●───>(/home/raphix) $ date --date "1 day" +%^a.%d%^b
MER.25JAN
●[raphix@debian]●[16:24:45]● 
●───>(/home/raphix) $ 

Edit:
J'ai modifié comme ça:

●───>(/home/raphix) $ date --date "1 day" +%^a.%d
MER.25

mais dans macompo ça n'affiche pas la dizaine... que les unités de chaque date

Dernière modification par ragamatrix (Le 24/01/2017, à 16:31)

Hors ligne

#1344 Le 24/01/2017, à 16:35

ragamatrix

Re : [Conky] Alternative à weather.com (3)

on s'est croisé...
cette modif a fonctionné:

eee=`echo ${calen[x]} | sed 's/é/E/g' | cut -c5-6`

Merci wink

Dernière modification par ragamatrix (Le 24/01/2017, à 16:35)

Hors ligne

#1345 Le 24/01/2017, à 16:46

daniel38100

Re : [Conky] Alternative à weather.com (3)

Impeccable
Je pense que je vais le mettre dans un fichier a part sans passer par le script meteo ce calendar

Hors ligne

#1346 Le 24/01/2017, à 17:42

ragamatrix

Re : [Conky] Alternative à weather.com (3)

cool ça fera des heureux, pour les conky bidouilleurs ou ça pourra aller dans d'autres scripts...

Hors ligne

#1347 Le 24/01/2017, à 18:11

daniel38100

Re : [Conky] Alternative à weather.com (3)

voici le calendar

03-calendar.sh

#!/bin/bash
###############################################################################
#                                                                             #
#------------ Calendrier cree par Daniel38100 Furum Ubuntu.fr ----------------#
#                                                                             #
###############################################################################
fonte="monaco"
nom="calendar.png"
destination=~/$nom
### couleurs ###
# cadre
coulfond="transparent"
coulcadre="orangered"
# aujourd'hui
coul="red"
coul1="gold"
# samedi
coulsam="yellow"
coulsam1="#00003F"
# dimanche
couldim="orange"
couldim1="#00003F"
# les autres jours
couljour="blue"
couljour1="black"
###############################################################################
samedi="SAM"
dimanche="DIM"
function calendar
{
if [[ $cale1 = `date +%^a@%d%^b` ]] ; then 
coulcal=$coul;fonts1=18;pos13=1;coulcal1=$coul1
elif [[ `echo $cale1 | cut -c1-3`  = `echo $dimanche` ]] ; then 
coulcal=$couldim;fonts1=16;pos13=0;coulcal1=$couldim1
elif [[ `echo $cale1 | cut -c1-3`  = `echo $samedi` ]] ; then 
coulcal=$coulsam;fonts1=16;pos13=0;coulcal1=$coulsam1
else coulcal=$couljour;fonts1=16;pos13=0;coulcal1=$couljour1
fi
}
L_ecran=$(xrandr --verbose | grep -F *current |cut -d " " -f3 | cut -d "x" -f1)
H_ecran=$(xrandr --verbose | grep -F *current |cut -d " " -f3 | cut -d "x" -f2)
H_calendar=44
T_calendar=$L_ecran"x"$H_calendar
L=$(echo $T_calendar|cut -d x -f1);L=$((L - 1))
H=$(echo $T_calendar|cut -d x -f2);H=$((H - 1))
decalagecalendar=$((H_ecran-54))
nbJ=$((L_ecran/22))
date=$(date +%-d)
if [[ -f $reptemp/calendar.png ]] ; then
date_cal=$(ls -l $reptemp/calendar.png | sed 's/.*  //g' | sed 's/ .*//g');else
date_cal=$((date+1));fi
if [[ "$date" != "$date_cal" ]] ; then
bordure=1;arrondi=5
convert -size $T_calendar xc:none  -fill $coulfond -strokewidth $bordure -stroke $coulcadre -draw "roundrectangle 1,1 $L,$H $arrondi,$arrondi" /tmp/tmp.png
ecart=22 ; posdepart=3 ; pos=1
for (( x=0 ; x<87 ; x++ ));do
calen[x]=`date --date "$((x-15)) day" +%^a@%d%^b`
done
for (( x=0 ; x<$nbJ ; x++ ));do
cale1=`echo ${calen[x]}`;calendar
DC=`echo ${calen[x]} | tr "@" "\n" | cut -c1-2`
convert -background none -fill $coulcal -font $fonte -pointsize $fonts1 -gravity center label:"$DC" -trim \
\( +clone -background $coulcal1 -shadow 100x1 -channel A -level 0,7% +channel \) +swap +repage -gravity center -composite /tmp/tmp1.png
composite  -gravity west -background transparent -geometry +$(((ecart*x-pos13)+posdepart))-0 -dissolve 65% /tmp/tmp1.png   /tmp/tmp.png /tmp/tmp.png
done
# ombre -------------
convert /tmp/tmp.png -bordercolor None -border 10x10 \( +clone -background black -shadow 100x2 \) -compose DstOver -composite -compose Over $destination
fi
exit 0

1485277516.png

EDIT: correction couleur jour J
1485280214.png

Dernière modification par daniel38100 (Le 24/01/2017, à 18:51)

Hors ligne

#1348 Le 25/01/2017, à 11:01

ragamatrix

Re : [Conky] Alternative à weather.com (3)

Merci encore !
Bon je vais essayer en m'inspirant du script de jpdipsy (couvnuage) d'en faire un, affichant une image avec deux cartes sat... c'est pas gagné et ça va me prendre un petit moment...
Je pense que ces adresses sont pas mal pour avoir les nuages et les masses d'air (chaudes-froides)
http://oiswww.eumetsat.org/IPPS/html/la … Europe.jpg
http://oiswww.eumetsat.org/IPPS/html/la … Europe.jpg
Là je ne me rappelle plus dans un script comment appliquer le même effet convert sur deux image différentes...

Dernière modification par ragamatrix (Le 25/01/2017, à 11:32)

Hors ligne

#1349 Le 25/01/2017, à 13:19

daniel38100

Re : [Conky] Alternative à weather.com (3)

mise a jour des packs pour l'extraction des alertes
météo fond d’écran v3.13
|-- météo fond d'écran accuweather-3.deb v3.13 MAJ:25/01/2017 --|
météo lua v1.22
|-- meteo lua de Didier-T meteo-lua-2.deb v1.22 MAJ:25/01/17 --|

1485346668.png

ragamatrix

Tu veut les 2 images dans la même image ou 2 images à part ?

Dernière modification par daniel38100 (Le 25/01/2017, à 13:21)

Hors ligne

#1350 Le 25/01/2017, à 13:39

ragamatrix

Re : [Conky] Alternative à weather.com (3)

daniel38100 les deux images dans la même...
EDIT:
J'ai commencé mais c'est pas très glorieux:-->j'ai un peu avancé, manque plus que l'anotation et l'ombre script modifié:


#!/bin/bash
#========================================================#
#        				               _        _        #
#_ __ __ _  __ _  __ _ _ __ ___   __ _| |_ _ __(_)_  __  #
#| '__/ _` |/ _` |/ _` | '_ ` _ \ / _` | __| '__| \ \/ / #
#| | | (_| | (_| | (_| | | | | | | (_| | |_| |  | |>  <  #
#|_|  \__,_|\__, |\__,_|_| |_| |_|\__,_|\__|_|  |_/_/\_\ #
#           |___/                                        #
#========================================================#

PREFIX=/home/raphix/tmp/

#Images Montage
ARMS=${PREFIX}airmass1.png
NRGB=${PREFIX}nat_rgb2.png
#EARTH2=${PREFIX}earth2xpbg.png
MONT=${PREFIX}montage.png
OUTPUT=${PREFIX}composat.png
taille=100
tailledecoupe=507x249.5
################################
#Annotation pour vérifier si l'image est actualisée
#jour=`date +%d/%m/%y`; heuremodif=`date +%H`; minmodif=`date +%M`
#fonte=Zero-Twos
#libelle=""
################################

wget -q -O  ${NRGB} "http://oiswww.eumetsat.org/IPPS/html/latestImages/EUMETSAT_MSG_RGBNatColour_CentralEurope.jpg"
wget -q -O  ${ARMS} "http://oiswww.eumetsat.org/IPPS/html/latestImages/EUMETSAT_MSG_RGBAirmass_CentralEurope.jpg"
##-images sat 1-2##################

convert ${ARMS} -resize 527x372.5\! ${ARMS}
convert ${ARMS} -filter Lanczos -crop  $tailledecoupe+10-15\! ${ARMS}
convert  ${ARMS} \
\( +clone  -alpha extract \
       -draw 'fill black polygon 0,0 0,5 5,0 fill white circle 5,5 5,0' \
        \( +clone -flip \) -compose Multiply -composite \
        \( +clone -flop \) -compose Multiply -composite \
     \) -alpha off -compose CopyOpacity -composite  ${ARMS}



convert ${NRGB} -resize 527x372.5\! ${NRGB}
convert ${NRGB} -filter Lanczos -crop  $tailledecoupe+10-15\! ${NRGB}
convert ${NRGB} \
\( +clone  -alpha extract \
        -draw 'fill black polygon 0,0 0,5 5,0 fill white circle 5,5 5,0' \
       \( +clone -flip \) -compose Multiply -composite \
        \( +clone -flop \) -compose Multiply -composite \
    \) -alpha off -compose CopyOpacity -composite ${NRGB}

# création cartouche bg
convert -size 512x472 xc:transparent ${MONT}
composite -geometry  +3+0 ${ARMS} ${MONT} ${MONT}
composite -geometry  +3+235 ${NRGB} ${MONT} ${MONT}
composite -geometry  +2+0 ${ARMS} ${NRGB} ${MONT} \  
${OUTPUT}
#

#function ombre {
#convert ${OUTPUT}  -background  black  \( +clone -shadow 60x4+2+2 \) +swap -background none -flatten ${OUTPUT}
#}

1485360279.png

Dernière modification par ragamatrix (Le 25/01/2017, à 17:05)

Hors ligne