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.

#1026 Le 10/05/2014, à 06:20

daniel38100

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

ragamatrix a écrit :

Tiens ça faisais longtemps que j'étais pas venu par ici ! hop un ptit screen ça roule toujours la météo avec l'interface merci daniel38100 et Didier-T. Par contre pour faire des tests et voir si on a des erreurs avec le terminal quel est la commande pour lancer accuweather ? hmm
http://pix.tdct.org/upload/thumb/1396531712.png

mieux vaut tard que jamais pour lancer dans un terminal et voir les erreur utilise

~$ accuweather_gtk.py

Hors ligne

#1027 Le 10/05/2014, à 06:25

daniel38100

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

ragamatrix a écrit :

@daniel38100
Saurais-tu comment utiliser le rafraichissement du script avec xplanetfx?
j'ai ajouté ceci :

 /usr/bin/accuweather_gtk.py

dans la section Appeler un script après le rendu, mais je ne suis pas sur qu'il s'agisse de la bonne maniere pour executer seulement le rafraichissement ?

j'ai pas étudier la question encore

Hors ligne

#1028 Le 12/05/2014, à 08:12

ragamatrix

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

daniel38100 a écrit :
ragamatrix a écrit :

@daniel38100
Saurais-tu comment utiliser le rafraichissement du script avec xplanetfx?
j'ai ajouté ceci :

 /usr/bin/accuweather_gtk.py

dans la section Appeler un script après le rendu, mais je ne suis pas sur qu'il s'agisse de la bonne maniere pour executer seulement le rafraichissement ?

j'ai pas étudier la question encore

Je pense qu'il faudrait appeler le script start-recmeteo.sh en modifiant quelques paramètres car celui-ci ne tourne plus correctement depuis les récentes mises à jour...
argument à entrer dans xplanetfx:

 start-recmeteo.sh fichier.cfg  rafraichir

Je regarde ça mais ne suis pas sur de réussir à modifier le script start-recmeteo.sh correctement.
start-recmeteo.sh:

 #!/bin/bash

# Autheur JPDipsy #
# pour utilisation recmeteo et affichage en fond ecran
# v 1.10
# 1.10 ajout relance, nettoyage, guy-recmeteo, secu cfg
# 1.20 ajout status pour relancer via cron en cas de plantage
# ex crontab
# * * * * * /home/user/Accuweather/start-recmeteo.sh defaut.cfg status

###### changez pour votre config ###
rep_base=~/Accuweather             #   le rep ou se trouvent les fichiers
config=defaut.cfg                  #   le fichier de cfg par défaut
attente=20                      #   attente avant de lancer recmeteo
####################################
# utilisation :
    #      démarrage :   "start-recmeteo.sh fichier.cfg"
    #      rafraichir:   "start-recmeteo.sh fichier.cfg  rafraichir"   force le recalcul de l'image
    #         relance:   "start-recmeteo.sh fichier.cfg  relance"  restaure fond et relance
    #       nettoyage:   "start-recmeteo.sh fichier.cfg  nettoy"   nettoyage fichiers inutile repsauv
    #      arrêter   :   "start-recmeteo.sh stop"        tue recmeteo
    #   restaure fond:   "start-recmeteo.sh restaure"    tue recmeteo et restaure fond-original
    #          status:   "start-recmeteo.sh defaut.cfg status" via cron 
    #                       ex crontab
    #                       USER=nom_utilisateur
    #                       * * * * * export DISPLAY=:0;/home/nom_utilisateur/Accuweather/start-recmeteo.sh defaut.cfg status

debug=""

export  meteo_rep=$rep_base

nettoyage()
{
   
    max=$(echo $((nbJour+1)))
    
    maximum()
    {
    max=$(echo $((nbJour+1)))  
    for ((max;max<16;max++));do
    find  $repsauv/ -maxdepth 1 -type f -name "$1$max" -exec rm {} \;
    done 
    }
   
    if [ "$huitHeures" != "oui" ];then
    find  $repsauv/ -maxdepth 1 -type f -name "huitHeures1" -exec rm {} \;
    find  $repsauv/ -maxdepth 1 -type f -name "huitHeures2" -exec rm {} \;
    fi 

    if [ "$nbFoisHuit" != "2" ];then
  
     find  $repsauv/ -maxdepth 1 -type f -name "huitHeures2" -exec rm {} \;
    fi
        
    maximum Jour
    
    if [ "$matin" != "oui" ];then
    find  $repsauv/ -maxdepth 1 -type f -name "Matin*" -exec rm {} \;
    else
    maximum Matin
    fi
    
    if [ "$apresmidi" != "oui" ];then
    find  $repsauv/ -maxdepth 1 -type f -name "AM*" -exec rm {} \;
    else
    maximum AM
    fi
    
    if [ "$soiree" != "oui" ];then
    find  $repsauv/ -maxdepth 1 -type f -name "Soiree*" -exec rm {} \;
    else
    maximum Soiree
    fi
    
    if [ "$nuit" != "oui" ];then
    find  $repsauv/ -maxdepth 1 -type f -name "Nuit*" -exec rm {} \;
    else
    maximum Nuit
    fi  
}

start()
{
pid=$(ps x|grep "[r]ecmeteo.py" |cut -d ? -f1)
if [ ! -z "$pid" ];then
    kill -9 $(ps x|grep "[r]ecmeteo.py" |cut -d ? -f1) > /dev/null 2>&1
fi

sleep $attente
if [ ! -z  "$debug" ];then
    notify-send  --expire-time=2000   "Démarrage de recmeteo"
fi

python3 $meteo_rep/scripts/recmeteo.py adressWeb="$adressWeb" repsauv="$repsauv" huitHeures="$huitHeures" matin="$matin" apresmidi="$apresmidi" soiree="$soiree" nuit="$nuit" nbJour="$nbJour" interval="$interval" notify="$notifi" externe="$externe" nbFoisHuit="$nbFoisHuit" &
pid=$(ps x|grep "[r]ecmeteo.py" |cut -d ? -f1)

if [ ! -z  "$debug" ];then
    sleep $attente
    if [ ! -z "$pid" ];then
        notify-send  --expire-time=2000   "Démarrage de recmeteo réussie"  
    else
        notify-send  --expire-time=5000   "Le démarrage de recmeteo à échoué" 
    fi
fi

exit
}

case "$1" in
"stop")
    kill -9 $(ps x|grep "[r]ecmeteo.py" |cut -d ? -f1) > /dev/null 2>&1
    exit
;;

"restaure")
    kill -9 $(ps x|grep "[r]ecmeteo.py" |cut -d ? -f1) > /dev/null 2>&1
    echo "arrêt et restauration du fond"
    $meteo_rep/scripts/meteo restaure
    exit
;;



*)

# Démarrage de recmeteo
    if [ -z "$1" ];then
        config="defaut.cfg"
    else 
        config="$1"
        if [ ! -e $meteo_rep/configs/$1 ];then echo "Désolé se fichier n'existe pas";exit;fi
    fi
    
    export meteo_config=$config
    source $meteo_rep/configs/$meteo_config
    
    case "$2" in
        "rafraichir")$meteo_rep/scripts/$composition $meteo_config rafraichir;exit;;
        "relance")echo "relance";$meteo_rep/scripts/meteo restaure  && nettoyage && start;exit;;
        "nettoy") nettoyage;exit;;
        "status")
            pid=$(ps x|grep "[r]ecmeteo.py" |cut -d ? -f1)
        if [ ! -z "$pid" ];then 
        
        exit 
        else        
        notify-send  --expire-time=5000   " Redémarrage de recmeteo" 
         fi 
        ;;
    esac
       
    #demarrage
    nettoyage
    start
;;
esac
exit
 

Dernière modification par ragamatrix (Le 12/05/2014, à 08:14)

Hors ligne

#1029 Le 12/05/2014, à 08:35

ragamatrix

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

Bon en fait j'ai modifié start-recmeteo.sh fais un test et cela à l'air de fonctionner... yikes
retour terminal:

 raphix@crunchbang:~$ cd /opt/Accuweather/scripts
raphix@crunchbang:/opt/Accuweather/scripts$ ./start-recmeteo.sh config.cfg
raphix@crunchbang:/opt/Accuweather/scripts$ non
Version = 1.31b
huitHeures 1 Ok
Jour 1 Ok
Matin 1 Ok
Nuit 1 Ok
Jour 2 Ok
Matin 2 Ok
Nuit 2 Ok
Jour 3 Ok
Matin 3 Ok
Nuit 3 Ok
Jour 4 Ok
Matin 4 Ok
Nuit 4 Ok
Jour 5 Ok
Matin 5 Ok
Nuit 5 Ok
Jour 6 Ok
Matin 6 Ok
Nuit 6 Ok
CC Ok
mise a jour en : 54.01405596733093
 

start-recmeteo.sh à placer dans /opt/Accuweather/scripts (version modifiée pour tourner avec la version du deb:)

 #!/bin/bash

# Autheur JPDipsy #
# pour utilisation recmeteo et affichage en fond ecran
# v 1.10
# 1.10 ajout relance, nettoyage, guy-recmeteo, secu cfg
# 1.20 ajout status pour relancer via cron en cas de plantage
# ex crontab
# * * * * * /home/user/Accuweather/start-recmeteo.sh defaut.cfg status

###### changez pour votre config ###
rep_base=/opt/Accuweather             #   le rep ou se trouvent les fichiers
config=config.cfg                  #   le fichier de cfg par défaut
attente=20                      #   attente avant de lancer recmeteo
####################################
# utilisation :
    #      démarrage :   "start-recmeteo.sh fichier.cfg"
    #      rafraichir:   "start-recmeteo.sh fichier.cfg  rafraichir"   force le recalcul de l'image
    #         relance:   "start-recmeteo.sh fichier.cfg  relance"  restaure fond et relance
    #       nettoyage:   "start-recmeteo.sh fichier.cfg  nettoy"   nettoyage fichiers inutile repsauv
    #      arrêter   :   "start-recmeteo.sh stop"        tue recmeteo
    #   restaure fond:   "start-recmeteo.sh restaure"    tue recmeteo et restaure fond-original
    #          status:   "start-recmeteo.sh defaut.cfg status" via cron 
    #                       ex crontab
    #                       USER=nom_utilisateur
    #                       * * * * * export DISPLAY=:0;/home/nom_utilisateur/Accuweather/start-recmeteo.sh defaut.cfg status

debug=""

export  meteo_rep=$rep_base

nettoyage()
{
   
    max=$(echo $((nbJour+1)))
    
    maximum()
    {
    max=$(echo $((nbJour+1)))  
    for ((max;max<16;max++));do
    find  $repsauv/ -maxdepth 1 -type f -name "$1$max" -exec rm {} \;
    done 
    }
   
    if [ "$huitHeures" != "oui" ];then
    find  $repsauv/ -maxdepth 1 -type f -name "huitHeures1" -exec rm {} \;
    find  $repsauv/ -maxdepth 1 -type f -name "huitHeures2" -exec rm {} \;
    fi 

    if [ "$nbFoisHuit" != "2" ];then
  
     find  $repsauv/ -maxdepth 1 -type f -name "huitHeures2" -exec rm {} \;
    fi
        
    maximum Jour
    
    if [ "$matin" != "oui" ];then
    find  $repsauv/ -maxdepth 1 -type f -name "Matin*" -exec rm {} \;
    else
    maximum Matin
    fi
    
    if [ "$apresmidi" != "oui" ];then
    find  $repsauv/ -maxdepth 1 -type f -name "AM*" -exec rm {} \;
    else
    maximum AM
    fi
    
    if [ "$soiree" != "oui" ];then
    find  $repsauv/ -maxdepth 1 -type f -name "Soiree*" -exec rm {} \;
    else
    maximum Soiree
    fi
    
    if [ "$nuit" != "oui" ];then
    find  $repsauv/ -maxdepth 1 -type f -name "Nuit*" -exec rm {} \;
    else
    maximum Nuit
    fi  
}

start()
{
pid=$(ps x|grep "[r]ecmeteo1.py" |cut -d ? -f1)
if [ ! -z "$pid" ];then
    kill -9 $(ps x|grep "[r]ecmeteo1.py" |cut -d ? -f1) > /dev/null 2>&1
fi

sleep $attente
if [ ! -z  "$debug" ];then
    notify-send  --expire-time=2000   "Démarrage de recmeteo"
fi

python3 /usr/bin/recmeteo1.py adressWeb="$adressWeb" repsauv="$repsauv" huitHeures="$huitHeures" matin="$matin" apresmidi="$apresmidi" soiree="$soiree" nuit="$nuit" nbJour="$nbJour" interval="$interval" notify="$notifi" externe="$externe" nbFoisHuit="$nbFoisHuit" &
pid=$(ps x|grep "[r]ecmeteo1.py" |cut -d ? -f1)

if [ ! -z  "$debug" ];then
    sleep $attente
    if [ ! -z "$pid" ];then
        notify-send  --expire-time=2000   "Démarrage de recmeteo réussie"  
    else
        notify-send  --expire-time=5000   "Le démarrage de recmeteo à échoué" 
    fi
fi

exit
}

case "$1" in
"stop")
    kill -9 $(ps x|grep "[r]ecmeteo1.py" |cut -d ? -f1) > /dev/null 2>&1
    exit
;;

"restaure")
    kill -9 $(ps x|grep "[r]ecmeteo1.py" |cut -d ? -f1) > /dev/null 2>&1
    echo "arrêt et restauration du fond"
    $meteo_rep/scripts/meteo restaure
    exit
;;



*)

# Démarrage de recmeteo
    if [ -z "$1" ];then
        config="config.cfg"
    else 
        config="$1"
        if [ ! -e $meteo_rep/configs/$1 ];then echo "Désolé se fichier n'existe pas";exit;fi
    fi
    
    export meteo_config=$config
    source $meteo_rep/configs/$meteo_config
    
    case "$2" in
        "rafraichir")$meteo_rep/scripts/$composition $meteo_config rafraichir;exit;;
        "relance")echo "relance";$meteo_rep/scripts/meteo restaure  && nettoyage && start;exit;;
        "nettoy") nettoyage;exit;;
        "status")
            pid=$(ps x|grep "[r]ecmeteo1.py" |cut -d ? -f1)
        if [ ! -z "$pid" ];then 
        
        exit 
        else        
        notify-send  --expire-time=5000   " Redémarrage de recmeteo" 
         fi 
        ;;
    esac
       
    #demarrage
    nettoyage
    start
;;
esac
exit
 

Je vais maintenant faire un test avec xplanetfx... à suivre...

Dernière modification par ragamatrix (Le 12/05/2014, à 08:36)

Hors ligne

#1030 Le 12/05/2014, à 09:06

ragamatrix

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

xplanetFX-start-recmeteo.sh
Nikel !! \o/

Hors ligne

#1031 Le 17/05/2014, à 14:30

daniel38100

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

@ ragamatrix
dans xplanelfx tu met juste le chemin vers ta compo
tu utilise quel version d'accuweather?

Dernière modification par daniel38100 (Le 17/05/2014, à 14:48)

Hors ligne

#1032 Le 20/05/2014, à 15:28

ragamatrix

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

daniel38100 a écrit :

@ ragamatrix
dans xplanelfx tu met juste le chemin vers ta compo
tu utilise quel version d'accuweather?

Salut;
Aujourd'hui j'ai eu ça comme erreur:

 raphix@crunchbang:~$ accuweather_gtk.py
sh: 1: kill: No such process

sh: 1: kill: Usage: kill [-s sigspec | -signum | -sigspec] [pid | job]... or
kill -l [exitstatus]
non
Version = 1.31b
huitHeures 1 Ok
Jour 1 Ok
Matin 1 Ok
Nuit 1 Ok
Jour 2 Ok
Matin 2 Ok
Nuit 2 Ok
Jour 3 Ok
Matin 3 Ok
Nuit 3 Ok
Jour 4 Ok
Matin 4 Ok
Nuit 4 Ok
Jour 5 Ok
Matin 5 Ok
Nuit 5 Ok
Jour 6 Ok
Matin 6 Ok
Nuit 6 Ok
CC Ok
Désolé pas pris en charge actuellement
/opt/Accuweather/scripts/meteo: ligne148: /home/raphix/.config/: est un dossier
convert.im6: no decode delegate for this image format `/tmp/magick-SQUgh1Nx' @ error/constitute.c/ReadImage/544.
convert.im6: no images defined `/opt/Accuweather/sauvegardes/fond-base.png' @ error/convert.c/ConvertImageCommand/3044.
mise a jour en : 29.532153129577637
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
/opt/Accuweather/scripts/meteo: ligne 101 : [: = : opérateur unaire attendu
cat: /home/raphix/.config/: est un dossier
raphix@crunchbang:~$ 
 

Sinon pour xplanetfx c'est comme ça (c'est la dernière version d'accuweather):
1400596115.png

Dernière modification par ragamatrix (Le 20/05/2014, à 15:31)

Hors ligne

#1033 Le 21/05/2014, à 15:54

ragamatrix

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

ça ne fonctionne plus aujourd'hui; même bug du script meteo avec convert... J'ai essayé aussi avec une autre compo et ça plante aussi.

Hors ligne

#1034 Le 29/05/2014, à 21:43

loutch

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

smilies%20(204).gif

Voila ma petite station-météo: (rien n'est de moi personnellement j'ai pris des scripts trouvé en faisant un peu d'archéologie sur le forum et les ais modifié .)
Merci à JPDipdsy , Didier-t , ragamatrix , mrpeachy et tous les autres (désolé pour les noms oubliés).

1401395344.png

en haut le conky meteo6jours

background yes
use_xft yes
xftfont URW Chancery L:style=Bold:size=12
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
#own_window_color 000000
own_window_argb_visual yes
#own_window_argb_value 0
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_pager
double_buffer yes
minimum_size 470 
maximum_width 470
text_buffer_size 2048
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color white
default_outline_color white
alignment top_left
gap_x 565
gap_y 150
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
# Fonctionne uniquement avec les polices Fixes
#use_spacer yes

 uppercase no

 default_color 000000
 color0     6495ee
 

 # -- Déclaration template -- #
 template0 ${lua fDrawImage ~/.conky/conky-meteo/meteo6jours/fon/\1 \2 \3 \4 \5} # -- images fond -- #
 template1 ${lua Meteo_\1 \2 \3 \4 \5 \6} # -- gestion météo --#
 template2 ${lua Meteo_\1 \2 \3 \4 \5 \6 \7} # -- icônes météo -- \2=répertoire icônes \3=position \4=taille \5=jour (pour les prévisions) #
 template3 ${lua Lune_\1} 
 template4 ${lua_parse Images_\1 \2 \3 60 \4} # -- Appelle image -- \2=position \3=taille \4=jour (pour les prévisions) #

 lua_load ~/.conky/conky-meteo/meteo_lua_2/scripts/meteo2.lua

 lua_startup_hook init ~/.conky/conky-meteo/meteo6jours/meteo.cfg
 
 TEXT
 
 ${template2 IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 180 235 132 70}
 ${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 1 380 75 45 2}
 ${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 80 380 75 45 3}
 ${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 160 380 75 45 4}
 ${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 240 380 75 45 5}
 ${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 320 380 75 45 6}
 ${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 400 380 75 45 7} 
 
 ${template1 Maj}${alignc}Dernière mise à jour : ${template1 Heure} h ${template1 Minute}
 ${voffset 20}${font URW Chancery L:style=Bold:size=10}${goto 300}Vent : ${template1 VentDirP} 
 ${font URW Chancery L :style=Bold:size=10}${goto 300}Vitesse : ${template1 VentForce} km/h   max: ${template1 Jour_VentRafales 1} Km/h
 ${goto 300}Pression: ${template1 Pression 1} mb   Pluie : ${template1 Jour_NivPrec 1} mm
 ${voffset -36}${goto 55}${font URW Chancery L :size=12 style:bold}${template1 Ville} :   ${font URW Chancery L :size=10}${template1 TempAct}°C
 ${alignc 100}${template1 CondMeteo} 
 Soleil: Lever ${template1 HLeverSoleil 1}:${template1 MLeverSoleil 1} Coucher ${template1 HCoucherSoleil 1}:${template1 MCoucherSoleil 1} ${goto 210} Durée ensoleillement :${template1 HDureeJour 1}h ${template1 MDureeJour 1} ${goto 380} Indice UV: ${template1  Uv 1}
 Couverture nuageuse: ${template1  CouvNuage 1}% ${goto 300} Visibilité: ${template1  Visibilite 1} km     
 ${alignc 115}${template1 Jour %a_%d 2}${alignc 50}${template1 Jour %a_%d 3}${alignc -12}${template1 Jour %a_%d 4}${alignc -72}${template1 Jour %a_%d 5}${alignc -135}${template1 Jour %a_%d 6}${alignc -200}${template1 Jour %a_%d 7}
 ${alignc 205}${font Sans :size=8:style=bold}${color red}${template1 Jour_Temp 2}°${color black} / ${color cornflowerblue}${template1 Nuit_Temp 2}°
 ${alignc 120}${voffset -13}${color red}${template1 Jour_Temp 3}°${color black} / ${color cornflowerblue}${template1 Nuit_Temp 3}°
 ${alignc 40}${voffset -13}${color red}${template1 Jour_Temp 4}°${color black} / ${color cornflowerblue}${template1 Nuit_Temp 4}°
 ${alignc -40}${voffset -13}${color red}${template1 Jour_Temp 5}°${color black} / ${color cornflowerblue}${template1 Nuit_Temp 5}°
 ${alignc -118}${voffset -13}${color red}${template1 Jour_Temp 6}°${color black} / ${color cornflowerblue}${template1 Nuit_Temp 6}°
 ${alignc -202}${voffset -13}${color red}${template1 Jour_Temp 7}°${color black} / ${color cornflowerblue}${template1 Nuit_Temp 7}°  
 ${alignc 80}${font URW Chancery L :size=10:style=bold}${color black}${template1 Jour_VentForce 2}km/h ${alignc 42}${template1 Jour_VentForce 3} km/h ${alignc -15}${template1 Jour_VentForce 4} km/h${alignc -80}${template1 Jour_VentForce 5} km/h ${alignc -135}${template1 Jour_VentForce 6} km/h${alignc -200}${template1 Jour_VentForce 7} km/h 

en dessous un conky termometer

 
 ##############################################
#  Settings
##############################################
max_specials 10000
max_user_text 1500000
background yes
use_xft yes
#xftfont Sans:size=12
#xftalpha 1
font Arial Rounded MT:size=7
total_run_times 0
own_window yes
own_window_argb_visual yes
own_window_transparent yes
own_window_type normal
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 500 325
maximum_width 500
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
default_color white
default_shade_color black
default_outline_color white
alignment top_left
gap_x 550
gap_y 570
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
color1 86acad #darker blue
color2 b1c9c9 #lighter blue
text_buffer_size 100000
top_name_width 10
update_interval 1

# -- Déclaration template -- #
	
	lua_load ~/.conky/conky-meteo/meteo_lua_2/scripts/meteo2.lua
	lua_startup_hook init ~/.conky/conky-meteo/meteo6jours/meteo.cfg


lua_load ~/.conky/thermo/thermo.lua


TEXT

${lua conky_weather}

avec son lua

 
 --[[weather display by mrpeachy nov 2011
version 4
-cleaned up a bit
-temp scale changing
-set mid point temp for color change
-added forecast display
-added wind speed guage
-added hi lo thermometers
]]
--#########################################################################################################
--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP
secs=300--set update interval
web="http://www.intellicast.com/Local/Forecast.aspx?unit=C&location=FRXX2585"--insert unit=C& after? for C
--get web address by going to the intellicast site and entering your location in the box
--for version 3 you must get click on "Extended Forecast" to get the necessary address
units="C"--set units for C or F
mid=75--this is the temp at which temp scale is yellow, ie mid point in color change scale
----###weathericons="~/v9000/additional_files/weathericons/"
--#########################################################################################################

require 'cairo'
------------------------------------------------------------------------------
function string:split(delimiter)
local result = { }
local from  = 1
local delim_from, delim_to = string.find( self, delimiter, from  )
while delim_from do
table.insert( result, string.sub( self, from , delim_from-1 ) )
from  = delim_to + 1
delim_from, delim_to = string.find( self, delimiter, from  )
end
table.insert( result, string.sub( self, from  ) )
return result
end
--------------------------------------------------------------------------------

function conky_weather()
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
cr = cairo_create(cs)
local updates=tonumber(conky_parse('${updates}'))
if updates>5 then
local timer=(updates %secs)+1
if timer==1 or updates==6 then
local f=io.popen("curl '"..web.."' | grep -A62 'As of ' | gawk -F'>' -v RS='</' 'RT{print $NF}' | sed -e 's/^[ \t]*//' -e '/^$/d' -e 's/&deg;//g' -e 's/%//g' -e 's/  / /g' -e 's/Thunderstorms/T.Storms/g'")
local data1=f:read("*a")
f:close()
local data2=string.split(data1,"\n")
local data={}
for i,v in pairs(data2) do
if string.find(v,"[%a%d]")~=nil then
table.insert(data,data2[i])
end
end
--##############################################
--current
local wdr=string.split(data[25]," ")
now={con=string.gsub(data[2],"[\r\n]",""),tmp=string.gsub(data[4],units,""),flk=string.gsub(data[5],"Feels Like: ",""),wch=data[7],cel=data[10],hid=data[12],vis=string.gsub(data[15],"[ %a]",""),dpt=data[17],wsp=string.gsub(data[20],"[ %a]",""),wdg=(wdr[1]),wdi=string.gsub(wdr[2],"[%(%)\n\r]",""),wgs=string.gsub(data[30],"[ %a]",""),hum=data[22],prs=string.gsub(data[27],"\"","")}
--############################################
--forecast
local f=io.popen("curl '"..web.."' | grep -A554 'View the Calendar Forecast' | gawk -F'>' -v RS='<' 'RT{print $NF}' | sed -e 's/^[ \t]*//' -e 's/&deg;//g' -e 's/  / /g' -e 's/%//g' -e 's/&deg//g' -e 's/Thunderstorms/T.Storms/g'")
local fdata1=f:read("*a")
f:close()
local fdata=string.split(fdata1,"\n")
local fdata2={}
for i,v in pairs(fdata) do
if string.find(v,"[%a%d]")~=nil then
table.insert(fdata2,fdata[i])
end
end
local uvi=string.split(fdata2[20]," ")
local wsp=string.split(fdata2[32]," ")
local wdr=string.split(fdata2[34]," ")
day1={day=fdata2[2],con=fdata2[3],hih=fdata2[4],low=fdata2[5],sri=fdata2[8],sst=fdata2[10],mri=fdata2[12],mst=fdata2[14],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[22],ppt=fdata2[24],snw=fdata2[26],cld=fdata2[28],mph=fdata2[30],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]","")}
--day2
local uvi=string.split(fdata2[53]," ")
local wsp=string.split(fdata2[65]," ")
local wdr=string.split(fdata2[67]," ")
day2={day=fdata2[35],con=fdata2[36],hih=fdata2[37],low=fdata2[38],sri=fdata2[41],sst=fdata2[43],mri=fdata2[45],mst=fdata2[47],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[55],ppt=fdata2[57],snw=fdata2[59],cld=fdata2[61],mph=fdata2[63],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]","")}
--day3
local start=68
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day3={day=fdata2[start],con=fdata2[start+1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]","")}
--day4
local start=start+29
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day4={day=fdata2[start],con=fdata2[start+1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]","")}
--day5
local start=start+29
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day5={day=fdata2[start],con=fdata2[start+1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]","")}
--day6
local start=start+29
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day6={day=fdata2[start],con=fdata2[start+1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]","")}
--day7
local start=start+29
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day7={day=fdata2[start],con=fdata2[start+1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=wmh,wkm=wkm,wkt=wkt,wdg=wdg,wdi=wdi}
--day8
local start=start+29
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day8={day=fdata2[start],con=fdata2[start+1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]","")}
--day9
local start=start+29
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day9={day=fdata2[start],con=fdata2[start+1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]","")}
--day10
local start=start+29
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day10={day=fdata2[start],con=fdata2[start+1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]","")}
end--timer section
display(now,day1,day2,day3,day4,day5,day6,day7,day8,day9,day10)
--################################################################3
end-- if updates>5
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return ""
end-- end main function

function display(now,day1,day2,day3,day4,day5,day6,day7,day8,day9,day10)
--print (now.con,now.tmp,now.flk,now.wch,now.cel,now.hid,now.vis,now.dpt,now.wsp,now.wdg,now.wgi,now.wgs,now.hum,now.prs)
--[[
--forecast information, 10 day, options
--use like this  dayX.option (where X=day number (1=today,2=tomorrow))
--eg day1.day
day=forecast day and date
con=conditions summary
hih=high temp
low=low temp
sri=sunrise
sst=sunset
mri=moon rise
mst=moon set
uvi=ultraviolet index
hum=humidity
ppt=chance of precipitation
snw=chance of snow
cld=cloud cover
mph=moon phase
wmh=wind speed in mph
wkm=wind speed in km/h
wkt=wind speed in knots
wdg=wind direction in degrees
wdi=wind direction in nesw
]]
--#####################################
--setup text type and color
local font="Mono"
local fsize=10
local red,green,blue,alpha=1,1,1,1
local xpos=430
local ypos=30--first line
local gap1=fsize+2
--TEST
--ypos=490--first line
--xpos=200
--gap1=fsize+2
--gap=0
--text=day2.day;txt(text,xpos,ypos,font,10,red,green,blue,alpha)
--text="    Conditions: "..day2.con;gap=gap1+4;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)
--text="      Temp Max: "..day2.hih.."°"..units;gap=gap+gap1;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)
--text="      Temp Min: "..day2.low.."°"..units;gap=gap+gap1;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)
--text="     Indice UV: "..day2.uvn.." ("..day1.uvt..")";gap=gap+gap1;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)
--text="      Humidité: "..day2.hum.."%";gap=gap+gap1;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)
--text="    Prob pluie: "..day2.ppt.."%";gap=gap+gap1;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)
--text="    Prob Neige: "..day2.snw.."%";gap=gap+gap1;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)
--text=" Couv.Nuageuse: "..day2.cld.."%";gap=gap+gap1;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)
--text="  Vent vitesse: "..day2.wmh.."kmh";gap=gap+gap1;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)
--text="Vent direction: "..day2.wdg.."° ("..day2.wdi..")";gap=gap+gap1;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)

--#############################################
--wind direction compass
compass(250,80,60,tonumber(now.wdg),now.wsp,now.wgs)
--windspeed dial
wspeed_dial(now.wsp,380,220)
--################################################################3
--pressure barometer
barometer(tonumber(now.prs),130,220)
--#########################################
--humidity bar
humidity(600.0,0.0,tonumber(now.hum))
--#########################################
--current conditions display
--text="Conditions:";txt(text,240,430,"Mono",12,1,1,1,1)
--text="Température: "..now.tmp.."°, Plafond: "..now.cel;txt(text,240,445,"Mono",10,1,1,1,1)
--text=now.con;txt(text,270,465,"Mono",15,1,1,1,1)

end--display
--#############################################################################################################################################################
function wspeed_dial(ws,px,py)
--0 to 60 mph
--draw circle
cairo_set_line_width (cr,1)
local router=110
cairo_set_source_rgba (cr,0.1,0.1,0.1,0.5)
cairo_arc (cr,px,py,router,(math.pi/180),0)
cairo_fill (cr)
cairo_set_source_rgba (cr,1,1,1,1)
cairo_arc (cr,px,py,router,(math.pi/180),0)
cairo_stroke (cr)
-------------------------------------------
--mph scale
local rout1=80
local rin1=rout1-10
for i=0,60 do
if i==5 or i==15 or i==25 or i==35 or i==45 then
rin=rin1--set line length for 5s
cairo_set_line_width (cr,1)
elseif i==0 or i==10 or i==20 or i==30 or i==40 or i==50 or i==60 then
rin=rin1+7--set line length for 10's
cairo_set_line_width (cr,3)
else
rin=rin1+5--set other lines
cairo_set_line_width (cr,1)
end--if i==
arc=(math.pi/180)*(210+(i*(300/60)))
ppx=0+rout1*(math.sin(arc))
ppy=0-rout1*(math.cos(arc))
arc=(math.pi/180)*(210+(i*300/60))
pix=0+rin*(math.sin(arc))
piy=0-rin*(math.cos(arc))
cairo_move_to (cr,px+ppx,py+ppy)
cairo_line_to (cr,px+pix,py+piy)
cairo_stroke (cr)
end--for i=
--mph reading
mph={0,10,20,30,40,50,60}
local rin=rin1-2
for i=1,#mph do
arc=(math.pi/180)*(210+((i-1)*(300/6)))
ppx=0+rin*(math.sin(arc))
ppy=0-rin*(math.cos(arc))
text=mph[i]
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
width=extents.width
height=extents.height
cairo_move_to (cr,px+ppx-(width/2),py+ppy+(height/2))
cairo_show_text (cr,text)
cairo_stroke (cr)
end--for i= print inches
--kmh lines and numbers
--60kmh=96.5606
cairo_set_line_width (cr,1)
local m1=300/96.5606
local rout2=60
local rin2=rout2-5
local num=95
--print lines---------------
for i=0,num do
if i==0 or i==10 or i==20 or i==30 or i==40 or i==50 or i==60 or i==70 or i==80 or i==90 then
rin=rin2-5--set length for 10s
elseif i==5 or i==15 or i==25 or i==35 or i==45 or i==55 or i==65 or 1==75 or i==85 or i==95 then
rin=rin2-2--set length for 5's
else
rin=rin2
end--if i=
---------------------------------------------------
arc=(math.pi/180)*(210+(i*m1))
ppx=0+rout2*(math.sin(arc))
ppy=0-rout2*(math.cos(arc))
arc=(math.pi/180)*(210+(i*m1))
pix=0+rin*(math.sin(arc))
piy=0-rin*(math.cos(arc))
cairo_move_to (cr,px+ppx,py+ppy)
cairo_line_to (cr,px+pix,py+piy)
cairo_stroke (cr)
end--for i --line drawing
--kmh reading
kmh={0,10,20,30,40,50,60,70,80,90}
local rout=rin2-18
for i=1,#kmh do
arc=(math.pi/180)*(210+((i-1)*(m1*10)))
ppx=0+rout*(math.sin(arc))
ppy=0-rout*(math.cos(arc))
text=kmh[i]
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
width=extents.width
height=extents.height
cairo_move_to (cr,px+ppx-(width/2),py+ppy+(height/2))
cairo_show_text (cr,text)
cairo_stroke (cr)
end--kmh lines and numbers
--knots
--60kmh=52.1386
cairo_set_line_width (cr,1)
local m1=300/52.1386
local rout3=90
local rin3=rout3-5
local num=50
--print lines---------------
for i=0,num do
if i==0 or i==10 or i==20 or i==30 or i==40 or i==50 then
rout=rout3-1--set length for 10s
cairo_set_line_width (cr,3)
elseif i==5 or i==15 or i==25 or i==35 or i==45 then
rout=rout3+4--set length for 5's
cairo_set_line_width (cr,1)
else
rout=rout3
cairo_set_line_width (cr,1)
end--if i=
---------------------------------------------------
arc=(math.pi/180)*(210+(i*m1))
ppx=0+rout*(math.sin(arc))
ppy=0-rout*(math.cos(arc))
arc=(math.pi/180)*(210+(i*m1))
pix=0+rin3*(math.sin(arc))
piy=0-rin3*(math.cos(arc))
cairo_move_to (cr,px+pix,py+piy)
cairo_line_to (cr,px+ppx,py+ppy)
cairo_stroke (cr)
end--for i --line drawing
--kmh reading
knot={0,10,20,30,40,50}
local rout=rin3+15
for i=1,#kmh do
arc=(math.pi/180)*(210+((i-1)*(m1*10)))
ppx=0+rout*(math.sin(arc))
ppy=0-rout*(math.cos(arc))
text=knot[i]
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
width=extents.width
height=extents.height
cairo_move_to (cr,px+ppx-(width/2),py+ppy+(height/2))
cairo_show_text (cr,text)
cairo_stroke (cr)
end
--scale labels
local text="mph"
local extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to (cr,px-(width/2),py+rin1)
cairo_show_text (cr,text)
cairo_stroke (cr)
local text="kmh"
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to (cr,px-(width/2),py+rin2)
cairo_show_text (cr,text)
cairo_stroke (cr)
local text="Noeuds"
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to (cr,px-(width/2),py+rin3)
cairo_show_text (cr,text)
cairo_stroke (cr)
local text="Mesures Vent"
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to (cr,px-(width/2),py+rin3+12)
cairo_show_text (cr,text)
cairo_stroke (cr)
--pointer
if ws==nil then ws=0 end
local wspd=ws
local m1=300/60
local m2=wspd*m1
local rout1=rout3
local arc=(math.pi/180)*(210+m2)
local ppx=0+rout1*(math.sin(arc))
local ppy=0-rout1*(math.cos(arc))
------------------------------
local arc=(math.pi/180)*(210+m2+180)
local ppox=0+rout1*(math.sin(arc))
local ppoy=0-rout1*(math.cos(arc))
-------------------------------
local rin3=7
local arc=(math.pi/180)*(210+m2-90)
local pilx=0+rin3*(math.sin(arc))
local pily=0-rin3*(math.cos(arc))
local arc=(math.pi/180)*(210+m2+90)
local pirx=0+rin3*(math.sin(arc))
local piry=0-rin3*(math.cos(arc))
--------------------------------
cairo_move_to (cr,px+pilx,py+pily)
cairo_line_to (cr,px+ppx,py+ppy)
cairo_line_to (cr,px+pirx,py+piry)
cairo_line_to (cr,px+pilx,py+pily)
cairo_set_source_rgba (cr,1,0,0,1)
cairo_fill (cr)
cairo_arc (cr,px,py,rin3,(math.pi/180),0)
cairo_fill (cr)
---------------------------------
cairo_move_to (cr,px+pilx,py+pily)
cairo_line_to (cr,px+ppox,py+ppoy)
cairo_line_to (cr,px+pirx,py+piry)
cairo_line_to (cr,px+pilx,py+pily)
cairo_set_source_rgba (cr,1,1,1,1)
cairo_fill (cr)
cairo_set_source_rgba (cr,1,0,0,1)
cairo_arc (cr,px,py,rin3,(math.pi/180),0)
cairo_fill (cr)
-----------------------------------
cairo_set_source_rgba (cr,0,0,0,1)
cairo_arc (cr,px,py,rin3-1,(math.pi/180),0)
cairo_fill (cr)
end--wspeed dial function
--#############################################################################################################################################################
function circlewriting(text, font, fsize, radi, horiz, verti, start, finish)
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize)
cairo_set_source_rgba (cr,1,1,1,1);
local inum=string.len(text)
local deg=(finish-start)/(inum-1)
local degrads=(math.pi/180)
local textcut=string.gsub(text, ".", "%1|")
texttable=string.split(textcut, "|")
for i=1,inum do
interval=(degrads*(start+(deg*(i-1))))
txs=0+radi*(math.sin(interval))
tys=0-radi*(math.cos(interval))
cairo_move_to (cr, txs+horiz, tys+verti);
cairo_rotate (cr, interval)
cairo_show_text (cr, (texttable[i]))
cairo_stroke (cr)
cairo_rotate (cr, -interval)
end
end--circlewriting
--#############################################################################################################################################################
--#############################################################################################################################################################
function humidity(x,y,hval1)
hval=hval1*1.5
yt=y-1
rh=200
rw=30
local pat = cairo_pattern_create_linear (0,yt,0,yt+rh);
cairo_pattern_add_color_stop_rgba (pat, 1, 0, 0, 1, 0);
cairo_pattern_add_color_stop_rgba (pat, 0, 0, 0, 1, 1);
cairo_rectangle (cr,x,yt,rw, rh);
cairo_set_source (cr, pat);
cairo_fill (cr);
cairo_pattern_destroy (pat);
----------
for i=1,11 do
lwid=-1
cairo_set_source_rgba (cr,1,1,1,1)
cairo_move_to (cr,x+rw,(y+150)-((i-1)*15))
cairo_rel_line_to (cr,lwid,0)
cairo_stroke(cr)
end
----------
cairo_set_source_rgba (cr,0,0,0,1)
hh=5
hw1=19
hw2=hw1+10
if hval==nil then hval=0 end
tx,ty=x+hw1,(y+150)-(hval+hh)
ix,iy=x+hw2,(y+150)-hval
bx,by=x+hw1,(y+150)-(hval-hh)
cairo_move_to (cr,tx,ty)
cairo_line_to (cr,ix,iy)
cairo_line_to (cr,bx,by)
cairo_line_to (cr,tx,ty)
cairo_fill (cr)
cairo_set_source_rgba (cr,0,0,0,1)
font="URW Chancery L"
fsize=16
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize)
cairo_move_to (cr,x+hw2+3,(y+150)-(hval-hh))
cairo_show_text (cr,hval1.."%")
cairo_stroke (cr)
label="Taux d'humidité"
cairo_move_to (cr,x+12,y+150)
cairo_rotate (cr,(math.pi/180)*(-90))
cairo_show_text (cr,label)
cairo_stroke (cr)
cairo_rotate (cr,(math.pi/180)*(90))
end--humidity
--#############################################################################################################################################################
--#############################################################################################################################################################
function txt(text,xpos,ypos,font,fsize,red,green,blue,alpha)
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,xpos,ypos)
cairo_show_text (cr,text)
cairo_stroke (cr)
end--function txt
--#############################################################################################################################################################
--#############################################################################################################################################################
function barometer(pr,px,py)
--baromeer 27 inches to 32 inches = 5 inches
cairo_set_line_width (cr,1)
local router=110
cairo_set_source_rgba (cr,0.1,0.1,0.1,0.5)
cairo_arc (cr,px,py,router,(math.pi/180),0)
cairo_fill (cr)
cairo_set_source_rgba (cr,1,1,1,1)
cairo_arc (cr,px,py,router,(math.pi/180),0)
cairo_stroke (cr)
local rout1=75
local rin1=rout1-10
for i=0,40 do
if i==5 or i==15 or i==25 or i==35 then
rout=rout1-7
cairo_set_line_width (cr,3)
elseif i==0 or i==10 or i==20 or i==30 or i==40 then
rout=rout1
cairo_set_line_width (cr,1)
else
rout=rout1-5
cairo_set_line_width (cr,1)
end
arc=(math.pi/180)*(210+(i*(300/40)))
ppx=0+rout*(math.sin(arc))
ppy=0-rout*(math.cos(arc))
arc=(math.pi/180)*(210+(i*300/40))
pix=0+rin1*(math.sin(arc))
piy=0-rin1*(math.cos(arc))
cairo_move_to (cr,px+ppx,py+ppy)
cairo_line_to (cr,px+pix,py+piy)
cairo_stroke (cr)
end
--inches reading
inch={28,29,30,31}
local rout=rout1+2
for i=1,4 do
arc=(math.pi/180)*(210+(300/8)+((i-1)*(300/4)))
ppx=0+rout*(math.sin(arc))
ppy=0-rout*(math.cos(arc))
text=inch[i]
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
width=extents.width
height=extents.height
cairo_move_to (cr,px+ppx-(width/2),py+ppy+(height/2))
cairo_show_text (cr,text)
cairo_stroke (cr)
end
--942 to 1056
--27.5=931.25
--31.5=1066.70
cairo_set_line_width (cr,1)
local m1=300/135.45
local m2=m1*8.75--931.25+8.75=940
local rout2=60
local rin2=rout2-5
local num=60
for i=0,num do
if i==0 or i==5 or i==10 or i==15 or i==20 or i==25 or i==30 or i==35 or i==40 or i==45 or i==50 or i==55 or i==60 or i==65 then
rin=rin2-5
else
rin=rin2
end
arc=(math.pi/180)*(210+m2+(i*((m1*(num*2))/num)))
ppx=0+rout2*(math.sin(arc))
ppy=0-rout2*(math.cos(arc))
arc=(math.pi/180)*(210+m2+(i*((m1*(num*2))/num)))
pix=0+rin*(math.sin(arc))
piy=0-rin*(math.cos(arc))
cairo_move_to (cr,px+ppx,py+ppy)
cairo_line_to (cr,px+pix,py+piy)
cairo_stroke (cr)
end
--millibars reading
inch={940,960,980,1000,1020,1040,1060}
local rout=rin2-18
for i=1,7 do
arc=(math.pi/180)*(210+m2+((i-1)*(m1*20)))
ppx=0+rout*(math.sin(arc))
ppy=0-rout*(math.cos(arc))
text=inch[i]
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
width=extents.width
height=extents.height
cairo_move_to (cr,px+ppx-(width/2),py+ppy+(height/2))
cairo_show_text (cr,text)
cairo_stroke (cr)
end
--scale labels
local text="inches hg"
local extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to (cr,px-(width/2),py+rin1)
cairo_show_text (cr,text)
cairo_stroke (cr)
local text="millibars"
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to (cr,px-(width/2),py+rin2-height)
cairo_show_text (cr,text)
cairo_stroke (cr)
local text="Pression"
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to (cr,px-(width/2),py+rin2+35)
cairo_show_text (cr,text)
cairo_stroke (cr)
--pointer
if pr==nil then pr=27.5 end
local pres=pr-27.5
local m1=300/4
local m2=pres*m1
local rout1=rout1
local arc=(math.pi/180)*(210+m2)
local ppx=0+rout1*(math.sin(arc))
local ppy=0-rout1*(math.cos(arc))
------------------------------
local arc=(math.pi/180)*(210+m2+180)
local ppox=0+rout1*(math.sin(arc))
local ppoy=0-rout1*(math.cos(arc))
-------------------------------
local rin3=7
local arc=(math.pi/180)*(210+m2-90)
local pilx=0+rin3*(math.sin(arc))
local pily=0-rin3*(math.cos(arc))
local arc=(math.pi/180)*(210+m2+90)
local pirx=0+rin3*(math.sin(arc))
local piry=0-rin3*(math.cos(arc))
--------------------------------
cairo_move_to (cr,px+pilx,py+pily)
cairo_line_to (cr,px+ppx,py+ppy)
cairo_line_to (cr,px+pirx,py+piry)
cairo_line_to (cr,px+pilx,py+pily)
cairo_set_source_rgba (cr,1,0,0,1)
cairo_fill (cr)
cairo_arc (cr,px,py,rin3,(math.pi/180),0)
cairo_fill (cr)
---------------------------------
cairo_move_to (cr,px+pilx,py+pily)
cairo_line_to (cr,px+ppox,py+ppoy)
cairo_line_to (cr,px+pirx,py+piry)
cairo_line_to (cr,px+pilx,py+pily)
cairo_set_source_rgba (cr,1,1,1,1)
cairo_fill (cr)
cairo_set_source_rgba (cr,1,0,0,1)
cairo_arc (cr,px,py,rin3,(math.pi/180),0)
cairo_fill (cr)
-----------------------------------
cairo_set_source_rgba (cr,0,0,0,1)
cairo_arc (cr,px,py,rin3-1,(math.pi/180),0)
cairo_fill (cr)
----text
local horiz=px
local verti=py
local radi=87
local text="Tempete"
local font="URW Chancery L"
local fsize=16
local start=240
local finish=start+((string.len(text))*5)
circlewriting(text, font, fsize, radi, horiz, verti, start, finish)
local text="Pluie"
local start=300
local finish=start+((string.len(text))*5)
circlewriting(text, font, fsize, radi, horiz, verti, start, finish)
local text="Variable"
local start=340
local finish=start+((string.len(text))*5)
circlewriting(text, font, fsize, radi, horiz, verti, start, finish)
local text="Beau"
local start=395
local finish=start+((string.len(text))*5)
circlewriting(text, font, fsize, radi, horiz, verti, start, finish)
local text="Tres Sec"
local start=435
local finish=start+((string.len(text))*5)
circlewriting(text, font, fsize, radi, horiz, verti, start, finish)
end--barometer
--#############################################################################################################################################################
--#############################################################################################################################################################
function compass(wx,wy,rout,wdeg,w,wg)
local rin=rout-((rout/100)*10)
cairo_set_source_rgba (cr,0.1,0.1,0.1,0.5)
cairo_arc (cr,wx,wy,rout,(math.pi/180),0)
cairo_fill (cr)
cairo_set_source_rgba (cr,1,1,1,1)
cairo_arc (cr,wx,wy,rout,(math.pi/180),0)
cairo_stroke (cr)
for i=1,36 do
arc=(math.pi/180)*(i*10)
wpx=0+rout*(math.sin(arc))
wpy=0-rout*(math.cos(arc))
arc=(math.pi/180)*(i*10)
wix=0+rin*(math.sin(arc))
wiy=0-rin*(math.cos(arc))
cairo_move_to (cr,wx+wpx,wy+wpy)
cairo_line_to (cr,wx+wix,wy+wiy)
cairo_stroke (cr)
end
--print directions
local font="URW Chancery L"
local fsize=14
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize)
dirs={"N","NE","E","SE","S","SO","O","NO"}
local rdir=rout-((rout/100)*25)
for i=1,8 do
arc=(math.pi/180)*((i-1)*(360/8))
wdx=0+rdir*(math.sin(arc))
wdy=0-rdir*(math.cos(arc))
text=dirs[i]
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
width=extents.width
height=extents.height
cairo_move_to (cr,wx+wdx-(width/2),wy+wdy+(height/2))
cairo_show_text (cr,text)
cairo_stroke (cr)
end
--indicator
local npr=rout-((rout/100)*15)
if wdeg==nil then wdeg=0 end
local arc=(math.pi/180)*(wdeg)
local npx=0+npr*(math.sin(arc))
local npy=0-npr*(math.cos(arc))
cairo_move_to (cr,wx+npx,wy+npy)
local nprm=rout-((rout/100)*88)
local arc=(math.pi/180)*(wdeg+90)
local npmrx=0+nprm*(math.sin(arc))
local npmry=0-nprm*(math.cos(arc))
local arc=(math.pi/180)*(wdeg-90)
local npmlx=0+nprm*(math.sin(arc))
local npmly=0-nprm*(math.cos(arc))
cairo_line_to (cr,wx+npmrx,wy+npmry)
cairo_line_to (cr,wx+npmlx,wy+npmly)
cairo_line_to (cr,wx+npx,wy+npy)
cairo_set_source_rgba (cr,1,0,0,1)
cairo_fill (cr)
cairo_set_source_rgba (cr,1,1,1,1)
---------------------------------
local arc=(math.pi/180)*(wdeg-180)
local spx=0+npr*(math.sin(arc))
local spy=0-npr*(math.cos(arc))
cairo_move_to (cr,wx+spx,wy+spy)
local sprm=nprm
local arc=(math.pi/180)*(wdeg+90-180)
local spmrx=0+sprm*(math.sin(arc))
local spmry=0-sprm*(math.cos(arc))
local arc=(math.pi/180)*(wdeg-90-180)
local spmlx=0+sprm*(math.sin(arc))
local spmly=0-sprm*(math.cos(arc))
cairo_line_to (cr,wx+spmrx,wy+spmry)
cairo_line_to (cr,wx+spmlx,wy+spmly)
cairo_line_to (cr,wx+spx,wy+spy)
cairo_fill (cr)
--------------------------------------
cairo_set_source_rgba (cr,0,0,0,1)
cairo_arc (cr,wx,wy,nprm,(math.pi/180),0)
cairo_fill (cr)
cairo_set_source_rgba (cr,1,0,0,1)
cairo_arc (cr,wx,wy,nprm,(math.pi/180),0)
cairo_stroke (cr)
------------------------
cairo_set_source_rgba (cr,0,0,0,1)
local text="Rose des Vents"
local extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to (cr,wx-(width/2),wy-rout-5)
cairo_show_text (cr,text)
cairo_stroke (cr)
end--compass
--#############################################################################################################################################################
--
--#############################################################################################################################################################
function conky_draw_bg(r,x,y,w,h,color,alpha)
local function rgb_to_r_g_b(colour,alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
if conky_window == nil then return end
if cs == nil then cairo_surface_destroy(cs) end
if cr == nil then cairo_destroy(cr) end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr = cairo_create(cs)
cairo_set_source_rgba (cr,rgb_to_r_g_b(color,alpha))
--top left mid circle
local xtl=x+r
local ytl=y+r
--top right mid circle
local xtr=(x+r)+((w)-(2*r))
local ytr=y+r
--bottom right mid circle
local xbr=(x+r)+((w)-(2*r))
local ybr=(y+r)+((h)-(2*r))
--bottom right mid circle
local xbl=(x+r)
local ybl=(y+r)+((h)-(2*r))
-----------------------------
cairo_move_to (cr,xtl,ytl-r)
cairo_line_to (cr,xtr,ytr-r)
cairo_arc(cr,xtr,ytr,r,((2*math.pi/4)*3),((2*math.pi/4)*4))
cairo_line_to (cr,xbr+r,ybr)
cairo_arc(cr,xbr,ybr,r,((2*math.pi/4)*4),((2*math.pi/4)*1))
cairo_line_to (cr,xbl,ybl+r)
cairo_arc(cr,xbl,ybl,r,((2*math.pi/4)*1),((2*math.pi/4)*2))
cairo_line_to (cr,xtl-r,ytl)
cairo_arc(cr,xtl,ytl,r,((2*math.pi/4)*2),((2*math.pi/4)*3))
cairo_close_path(cr)
cairo_fill (cr)
------------------------------------------------------------
cairo_surface_destroy(cs)
cairo_destroy(cr)
return ""
end 

à gauche

imageradar

background no
use_xft yes
xftfont URW Chancery L:style=Bold:size=10
xftalpha 1
update_interval 1
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 178 178
maximum_width 178
text_buffer_size 2048
draw_shades no
draw_outline no
draw_borders no
border_width 1
draw_graph_borders no
default_color ffffff
default_outline_color cacaca
alignment top_left
gap_x 380
gap_y 735
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
#
color1                ffff00

lua_load ~/.conky/draw_bg/draw_bg.lua

 TEXT
${lua conky_draw_bg 0 5 5 0 0 0x000000 0.99}


${texeci 600 ~/.conky/conkyradar/sat-round.sh}
${image ~/.conky/conkyradar/radar.png -p 0,0 -s 190x190 -f 100}

et son lua

#!/bin/bash

# Crée par JPDipsy 
# script de recupération imagesat couverture nuageuse http://www.sat24.com
# et mise en forme polaroïd imagemagick et pagecurl  doivent être installés
# ce script et le script pagecurl doivent être dans le même rep.
#----------------------------------------------------------------------------------
path=`dirname $0`
heuremodif=`date +%H`; minmodif=`date +%M`
# ce que vous voulez
fonte=Norasi
nomimage=radar
tailleimage=50 # ceci est en pourcentage
tailledecoupe=450x450
rotation=0
libelle="Report: "

wget -q -O  ~/.conky/conkyradar/$nomimage.gif "http://www.meteo-mc.fr/dedie/Images/sat/satireu1.gif"

function mise_en_forme_image {
convert ~/.conky/conkyradar/$nomimage.png -gravity South -density 150 \
-fill white -font $fonte  -pointsize 14 -annotate 0x10+105+5 "$libelle $heuremodif h $minmodif" ~/.conky/conkyradar/$nomimage.png
convert  ~/.conky/conkyradar/$nomimage.png \
\( +clone  -alpha extract \
        -draw 'fill black polygon 0,0 0,15 15,0 fill white circle 0,15 15,0' \
        \( +clone -flip \) -compose Multiply -composite \
        \( +clone -flop \) -compose Multiply -composite \
     \) -alpha off -compose CopyOpacity -composite  ~/.conky/conkyradar/$nomimage.png
     
}


function ombre {
convert   ~/.conky/conkyradar/$nomimage.png  -background  black  \( +clone -shadow 60x4+2+2 \) +swap -background  none   -flatten ~/.conky/conkyradar/$nomimage.png	
}	

if [[ -e ~/.conky/conkyradar/$nomimage.gif ]] ; then
	# decoupage de la partie utile
	convert ~/.conky/conkyradar/$nomimage.gif -filter Lanczos -crop  $tailledecoupe+140+110\! ~/.conky/conkyradar/$nomimage.png
	mise_en_forme_image ; ombre ; rm ~/.conky/conkyradar/$nomimage.gif
else
	# comme ça votre conky aura toujours une image au cas ou 
	convert -size $tailledecoupe plasma:  ~/.conky/conkyradar/$nomimage.png
	libelle="Désolé pas d'image radar à "
	mise_en_forme_image ; ombre
fi
 

à droite

imagesat

background no
use_xft yes
xftfont URW Chancery L:style=Bold:size=10
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
#own_window_color 000000
#own_window_argb_value 180
own_window_argb_visual yes
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_pager
double_buffer yes
minimum_size 178 178
maximum_width 178
text_buffer_size 2048
draw_shades no
draw_outline no
draw_borders no
border_width 1
draw_graph_borders no
default_color ffffff
default_outline_color cacaca
alignment top_right
gap_x 385
gap_y 735
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
#
color1                ffff00

lua_load ~/.conky/draw_bg/draw_bg.lua

 TEXT
${lua conky_draw_bg 0 5 5 0 0 0x000000 0.99}

 
${texeci 300 ~/.conky/imagesat/couvnuage.sh} 
${image ~/.conky/imagesat/imagesat-couvnuage.png -p 0,0 -s 190x190 -f 100}

son lua

#!/bin/bash

# Crée par JPDipsy 
# script de recupération imagesat couverture nuageuse http://www.sat24.com
# et mise en forme polaroïd .imagemagick doit être installé

# pas touche ----------------------------------------------------------------------

heuremodif=`date +%H`; minmodif=`date +%M`
#----------------------------------------------------------------------------------
# ce que vous voulez
fonte=Times-Bold
nomimage=imagesat-couvnuage
tailleimage=80 # ceci est en pourcentage

# recup image sat
wget -q -O  ~/.conky/imagesat/$nomimage.gif "http://www.sat24.com/image.ashx?country=eu&type=zoom&format=640x480001001&rnd=610703"
if [[ -e ~/.conky/imagesat/$nomimage.gif ]] ; then
	# decoupage de la partie utile
	convert ~/.conky/imagesat/$nomimage.gif -filter Lanczos -crop 350x350+100+200\! ~/.conky/imagesat/imagesat-couvnuage.png
	libelle="Couverture nuageuse à  "
else
	# comme ça votre conky aura toujours une image au cas ou 
	convert -size 550x550 plasma:  ~/.conky/imagesat/$nomimage.png
	libelle="Désolé pas d'image radar à "
	
fi

Voila .

smilies%20(1).gif

Hors ligne

#1035 Le 29/05/2014, à 21:49

jlfh0816

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

@loutch

Merci pour le partage de ta station météo !


Xubuntu - Voyager 18.04 et 22.04

Hors ligne

#1036 Le 29/05/2014, à 22:01

loutch

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

@loutch

Merci pour le partage de ta station météo !

de rien .

pour avoir la full transparence du termometer voici le nouveau lua

 
 --[[weather display by mrpeachy nov 2011
version 4
-cleaned up a bit
-temp scale changing
-set mid point temp for color change
-added forecast display
-added wind speed guage
-added hi lo thermometers
]]
--#########################################################################################################
--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP
secs=300--set update interval
web="http://www.intellicast.com/Local/Forecast.aspx?unit=C&location=FRXX2585"--insert unit=C& after? for C
--get web address by going to the intellicast site and entering your location in the box
--for version 3 you must get click on "Extended Forecast" to get the necessary address
units="C"--set units for C or F
mid=75--this is the temp at which temp scale is yellow, ie mid point in color change scale
----###weathericons="~/v9000/additional_files/weathericons/"
--#########################################################################################################

require 'cairo'
------------------------------------------------------------------------------
function string:split(delimiter)
local result = { }
local from  = 1
local delim_from, delim_to = string.find( self, delimiter, from  )
while delim_from do
table.insert( result, string.sub( self, from , delim_from-1 ) )
from  = delim_to + 1
delim_from, delim_to = string.find( self, delimiter, from  )
end
table.insert( result, string.sub( self, from  ) )
return result
end
--------------------------------------------------------------------------------

function conky_weather()
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
cr = cairo_create(cs)
local updates=tonumber(conky_parse('${updates}'))
if updates>5 then
local timer=(updates %secs)+1
if timer==1 or updates==6 then
local f=io.popen("curl '"..web.."' | grep -A62 'As of ' | gawk -F'>' -v RS='</' 'RT{print $NF}' | sed -e 's/^[ \t]*//' -e '/^$/d' -e 's/&deg;//g' -e 's/%//g' -e 's/  / /g' -e 's/Thunderstorms/T.Storms/g'")
local data1=f:read("*a")
f:close()
local data2=string.split(data1,"\n")
local data={}
for i,v in pairs(data2) do
if string.find(v,"[%a%d]")~=nil then
table.insert(data,data2[i])
end
end
--##############################################
--current
local wdr=string.split(data[25]," ")
now={con=string.gsub(data[2],"[\r\n]",""),tmp=string.gsub(data[4],units,""),flk=string.gsub(data[5],"Feels Like: ",""),wch=data[7],cel=data[10],hid=data[12],vis=string.gsub(data[15],"[ %a]",""),dpt=data[17],wsp=string.gsub(data[20],"[ %a]",""),wdg=(wdr[1]),wdi=string.gsub(wdr[2],"[%(%)\n\r]",""),wgs=string.gsub(data[30],"[ %a]",""),hum=data[22],prs=string.gsub(data[27],"\"","")}
--############################################
--forecast
local f=io.popen("curl '"..web.."' | grep -A554 'View the Calendar Forecast' | gawk -F'>' -v RS='<' 'RT{print $NF}' | sed -e 's/^[ \t]*//' -e 's/&deg;//g' -e 's/  / /g' -e 's/%//g' -e 's/&deg//g' -e 's/Thunderstorms/T.Storms/g'")
local fdata1=f:read("*a")
f:close()
local fdata=string.split(fdata1,"\n")
local fdata2={}
for i,v in pairs(fdata) do
if string.find(v,"[%a%d]")~=nil then
table.insert(fdata2,fdata[i])
end
end
local uvi=string.split(fdata2[20]," ")
local wsp=string.split(fdata2[32]," ")
local wdr=string.split(fdata2[34]," ")
day1={day=fdata2[2],con=fdata2[3],hih=fdata2[4],low=fdata2[5],sri=fdata2[8],sst=fdata2[10],mri=fdata2[12],mst=fdata2[14],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[22],ppt=fdata2[24],snw=fdata2[26],cld=fdata2[28],mph=fdata2[30],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]","")}
--day2
local uvi=string.split(fdata2[53]," ")
local wsp=string.split(fdata2[65]," ")
local wdr=string.split(fdata2[67]," ")
day2={day=fdata2[35],con=fdata2[36],hih=fdata2[37],low=fdata2[38],sri=fdata2[41],sst=fdata2[43],mri=fdata2[45],mst=fdata2[47],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[55],ppt=fdata2[57],snw=fdata2[59],cld=fdata2[61],mph=fdata2[63],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]","")}
--day3
local start=68
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day3={day=fdata2[start],con=fdata2[start+1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]","")}
--day4
local start=start+29
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day4={day=fdata2[start],con=fdata2[start+1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]","")}
--day5
local start=start+29
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day5={day=fdata2[start],con=fdata2[start+1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]","")}
--day6
local start=start+29
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day6={day=fdata2[start],con=fdata2[start+1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]","")}
--day7
local start=start+29
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day7={day=fdata2[start],con=fdata2[start+1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=wmh,wkm=wkm,wkt=wkt,wdg=wdg,wdi=wdi}
--day8
local start=start+29
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day8={day=fdata2[start],con=fdata2[start+1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]","")}
--day9
local start=start+29
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day9={day=fdata2[start],con=fdata2[start+1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]","")}
--day10
local start=start+29
local uvi=string.split(fdata2[start+14]," ")
local wsp=string.split(fdata2[start+26]," ")
local wdr=string.split(fdata2[start+28]," ")
day10={day=fdata2[start],con=fdata2[start+1],hih=fdata2[start+2],low=fdata2[start+3],sri=fdata2[start+5],sst=fdata2[start+7],mri=fdata2[start+9],mst=fdata2[start+11],uvn=uvi[1],uvt=string.gsub(uvi[2],"[%(%)]",""),hum=fdata2[start+16],ppt=fdata2[start+18],snw=fdata2[start+20],cld=fdata2[start+22],mph=fdata2[start+24],wmh=string.gsub(wsp[1],"[%a]",""),wkm=string.gsub(wsp[2],"[%a%(,]",""),wkt=string.gsub(wsp[3],"[%a%)]",""),wdg=wdr[1],wdi=string.gsub(wdr[2],"[%(%)\n\r]","")}
end--timer section
display(now,day1,day2,day3,day4,day5,day6,day7,day8,day9,day10)
--################################################################3
end-- if updates>5
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return ""
end-- end main function

function display(now,day1,day2,day3,day4,day5,day6,day7,day8,day9,day10)
--print (now.con,now.tmp,now.flk,now.wch,now.cel,now.hid,now.vis,now.dpt,now.wsp,now.wdg,now.wgi,now.wgs,now.hum,now.prs)
--[[
--forecast information, 10 day, options
--use like this  dayX.option (where X=day number (1=today,2=tomorrow))
--eg day1.day
day=forecast day and date
con=conditions summary
hih=high temp
low=low temp
sri=sunrise
sst=sunset
mri=moon rise
mst=moon set
uvi=ultraviolet index
hum=humidity
ppt=chance of precipitation
snw=chance of snow
cld=cloud cover
mph=moon phase
wmh=wind speed in mph
wkm=wind speed in km/h
wkt=wind speed in knots
wdg=wind direction in degrees
wdi=wind direction in nesw
]]
--#####################################
--setup text type and color
local font="Mono"
local fsize=10
local red,green,blue,alpha=1,1,1,1
local xpos=430
local ypos=30--first line
local gap1=fsize+2
--TEST
--ypos=490--first line
--xpos=200
--gap1=fsize+2
--gap=0
--text=day2.day;txt(text,xpos,ypos,font,10,red,green,blue,alpha)
--text="    Conditions: "..day2.con;gap=gap1+4;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)
--text="      Temp Max: "..day2.hih.."°"..units;gap=gap+gap1;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)
--text="      Temp Min: "..day2.low.."°"..units;gap=gap+gap1;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)
--text="     Indice UV: "..day2.uvn.." ("..day1.uvt..")";gap=gap+gap1;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)
--text="      Humidité: "..day2.hum.."%";gap=gap+gap1;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)
--text="    Prob pluie: "..day2.ppt.."%";gap=gap+gap1;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)
--text="    Prob Neige: "..day2.snw.."%";gap=gap+gap1;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)
--text=" Couv.Nuageuse: "..day2.cld.."%";gap=gap+gap1;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)
--text="  Vent vitesse: "..day2.wmh.."kmh";gap=gap+gap1;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)
--text="Vent direction: "..day2.wdg.."° ("..day2.wdi..")";gap=gap+gap1;txt(text,xpos,ypos+gap,font,fsize,red,green,blue,alpha)

--#############################################
--wind direction compass
compass(250,80,60,tonumber(now.wdg),now.wsp,now.wgs)
--windspeed dial
wspeed_dial(now.wsp,380,220)
--################################################################3
--pressure barometer
barometer(tonumber(now.prs),130,220)
--#########################################
--humidity bar
humidity(600.0,0.0,tonumber(now.hum))
--#########################################
--current conditions display
--text="Conditions:";txt(text,240,430,"Mono",12,1,1,1,1)
--text="Température: "..now.tmp.."°, Plafond: "..now.cel;txt(text,240,445,"Mono",10,1,1,1,1)
--text=now.con;txt(text,270,465,"Mono",15,1,1,1,1)

end--display
--#############################################################################################################################################################
function wspeed_dial(ws,px,py)
--0 to 60 mph
--draw circle
cairo_set_line_width (cr,1)
local router=110
cairo_set_source_rgba (cr,0.1,0.1,0.1,0)
cairo_arc (cr,px,py,router,(math.pi/180),0)
cairo_fill (cr)
cairo_set_source_rgba (cr,0,0,0,1)
cairo_arc (cr,px,py,router,(math.pi/180),0)
cairo_stroke (cr)
-------------------------------------------
--mph scale
local rout1=80
local rin1=rout1-10
for i=0,60 do
if i==5 or i==15 or i==25 or i==35 or i==45 then
rin=rin1--set line length for 5s
cairo_set_line_width (cr,1)
elseif i==0 or i==10 or i==20 or i==30 or i==40 or i==50 or i==60 then
rin=rin1+7--set line length for 10's
cairo_set_line_width (cr,3)
else
rin=rin1+5--set other lines
cairo_set_line_width (cr,1)
end--if i==
arc=(math.pi/180)*(210+(i*(300/60)))
ppx=0+rout1*(math.sin(arc))
ppy=0-rout1*(math.cos(arc))
arc=(math.pi/180)*(210+(i*300/60))
pix=0+rin*(math.sin(arc))
piy=0-rin*(math.cos(arc))
cairo_move_to (cr,px+ppx,py+ppy)
cairo_line_to (cr,px+pix,py+piy)
cairo_stroke (cr)
end--for i=
--mph reading
mph={0,10,20,30,40,50,60}
local rin=rin1-2
for i=1,#mph do
arc=(math.pi/180)*(210+((i-1)*(300/6)))
ppx=0+rin*(math.sin(arc))
ppy=0-rin*(math.cos(arc))
text=mph[i]
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
width=extents.width
height=extents.height
cairo_move_to (cr,px+ppx-(width/2),py+ppy+(height/2))
cairo_show_text (cr,text)
cairo_stroke (cr)
end--for i= print inches
--kmh lines and numbers
--60kmh=96.5606
cairo_set_line_width (cr,1)
local m1=300/96.5606
local rout2=60
local rin2=rout2-5
local num=95
--print lines---------------
for i=0,num do
if i==0 or i==10 or i==20 or i==30 or i==40 or i==50 or i==60 or i==70 or i==80 or i==90 then
rin=rin2-5--set length for 10s
elseif i==5 or i==15 or i==25 or i==35 or i==45 or i==55 or i==65 or 1==75 or i==85 or i==95 then
rin=rin2-2--set length for 5's
else
rin=rin2
end--if i=
---------------------------------------------------
arc=(math.pi/180)*(210+(i*m1))
ppx=0+rout2*(math.sin(arc))
ppy=0-rout2*(math.cos(arc))
arc=(math.pi/180)*(210+(i*m1))
pix=0+rin*(math.sin(arc))
piy=0-rin*(math.cos(arc))
cairo_move_to (cr,px+ppx,py+ppy)
cairo_line_to (cr,px+pix,py+piy)
cairo_stroke (cr)
end--for i --line drawing
--kmh reading
kmh={0,10,20,30,40,50,60,70,80,90}
local rout=rin2-18
for i=1,#kmh do
arc=(math.pi/180)*(210+((i-1)*(m1*10)))
ppx=0+rout*(math.sin(arc))
ppy=0-rout*(math.cos(arc))
text=kmh[i]
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
width=extents.width
height=extents.height
cairo_move_to (cr,px+ppx-(width/2),py+ppy+(height/2))
cairo_show_text (cr,text)
cairo_stroke (cr)
end--kmh lines and numbers
--knots
--60kmh=52.1386
cairo_set_line_width (cr,1)
local m1=300/52.1386
local rout3=90
local rin3=rout3-5
local num=50
--print lines---------------
for i=0,num do
if i==0 or i==10 or i==20 or i==30 or i==40 or i==50 then
rout=rout3-1--set length for 10s
cairo_set_line_width (cr,3)
elseif i==5 or i==15 or i==25 or i==35 or i==45 then
rout=rout3+4--set length for 5's
cairo_set_line_width (cr,1)
else
rout=rout3
cairo_set_line_width (cr,1)
end--if i=
---------------------------------------------------
arc=(math.pi/180)*(210+(i*m1))
ppx=0+rout*(math.sin(arc))
ppy=0-rout*(math.cos(arc))
arc=(math.pi/180)*(210+(i*m1))
pix=0+rin3*(math.sin(arc))
piy=0-rin3*(math.cos(arc))
cairo_move_to (cr,px+pix,py+piy)
cairo_line_to (cr,px+ppx,py+ppy)
cairo_stroke (cr)
end--for i --line drawing
--kmh reading
knot={0,10,20,30,40,50}
local rout=rin3+15
for i=1,#kmh do
arc=(math.pi/180)*(210+((i-1)*(m1*10)))
ppx=0+rout*(math.sin(arc))
ppy=0-rout*(math.cos(arc))
text=knot[i]
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
width=extents.width
height=extents.height
cairo_move_to (cr,px+ppx-(width/2),py+ppy+(height/2))
cairo_show_text (cr,text)
cairo_stroke (cr)
end
--scale labels
local text="mph"
local extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to (cr,px-(width/2),py+rin1)
cairo_show_text (cr,text)
cairo_stroke (cr)
local text="kmh"
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to (cr,px-(width/2),py+rin2)
cairo_show_text (cr,text)
cairo_stroke (cr)
local text="Noeuds"
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to (cr,px-(width/2),py+rin3)
cairo_show_text (cr,text)
cairo_stroke (cr)
local text="Mesures Vent"
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to (cr,px-(width/2),py+rin3+12)
cairo_show_text (cr,text)
cairo_stroke (cr)
--pointer
if ws==nil then ws=0 end
local wspd=ws
local m1=300/60
local m2=wspd*m1
local rout1=rout3
local arc=(math.pi/180)*(210+m2)
local ppx=0+rout1*(math.sin(arc))
local ppy=0-rout1*(math.cos(arc))
------------------------------
local arc=(math.pi/180)*(210+m2+180)
local ppox=0+rout1*(math.sin(arc))
local ppoy=0-rout1*(math.cos(arc))
-------------------------------
local rin3=7
local arc=(math.pi/180)*(210+m2-90)
local pilx=0+rin3*(math.sin(arc))
local pily=0-rin3*(math.cos(arc))
local arc=(math.pi/180)*(210+m2+90)
local pirx=0+rin3*(math.sin(arc))
local piry=0-rin3*(math.cos(arc))
--------------------------------
cairo_move_to (cr,px+pilx,py+pily)
cairo_line_to (cr,px+ppx,py+ppy)
cairo_line_to (cr,px+pirx,py+piry)
cairo_line_to (cr,px+pilx,py+pily)
cairo_set_source_rgba (cr,1,0,0,1)
cairo_fill (cr)
cairo_arc (cr,px,py,rin3,(math.pi/180),0)
cairo_fill (cr)
---------------------------------
cairo_move_to (cr,px+pilx,py+pily)
cairo_line_to (cr,px+ppox,py+ppoy)
cairo_line_to (cr,px+pirx,py+piry)
cairo_line_to (cr,px+pilx,py+pily)
cairo_set_source_rgba (cr,1,1,1,1)
cairo_fill (cr)
cairo_set_source_rgba (cr,1,0,0,1)
cairo_arc (cr,px,py,rin3,(math.pi/180),0)
cairo_fill (cr)
-----------------------------------
cairo_set_source_rgba (cr,0,0,0,1)
cairo_arc (cr,px,py,rin3-1,(math.pi/180),0)
cairo_fill (cr)
end--wspeed dial function
--#############################################################################################################################################################
function circlewriting(text, font, fsize, radi, horiz, verti, start, finish)
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize)
cairo_set_source_rgba (cr,0,0,0,1);
local inum=string.len(text)
local deg=(finish-start)/(inum-1)
local degrads=(math.pi/180)
local textcut=string.gsub(text, ".", "%1|")
texttable=string.split(textcut, "|")
for i=1,inum do
interval=(degrads*(start+(deg*(i-1))))
txs=0+radi*(math.sin(interval))
tys=0-radi*(math.cos(interval))
cairo_move_to (cr, txs+horiz, tys+verti);
cairo_rotate (cr, interval)
cairo_show_text (cr, (texttable[i]))
cairo_stroke (cr)
cairo_rotate (cr, -interval)
end
end--circlewriting
--#############################################################################################################################################################
--#############################################################################################################################################################
function humidity(x,y,hval1)
hval=hval1*1.5
yt=y-1
rh=200
rw=30
local pat = cairo_pattern_create_linear (0,yt,0,yt+rh);
cairo_pattern_add_color_stop_rgba (pat, 1, 0, 0, 1, 0);
cairo_pattern_add_color_stop_rgba (pat, 0, 0, 0, 1, 1);
cairo_rectangle (cr,x,yt,rw, rh);
cairo_set_source (cr, pat);
cairo_fill (cr);
cairo_pattern_destroy (pat);
----------
for i=1,11 do
lwid=-1
cairo_set_source_rgba (cr,1,1,1,1)
cairo_move_to (cr,x+rw,(y+150)-((i-1)*15))
cairo_rel_line_to (cr,lwid,0)
cairo_stroke(cr)
end
----------
cairo_set_source_rgba (cr,0,0,0,1)
hh=5
hw1=19
hw2=hw1+10
if hval==nil then hval=0 end
tx,ty=x+hw1,(y+150)-(hval+hh)
ix,iy=x+hw2,(y+150)-hval
bx,by=x+hw1,(y+150)-(hval-hh)
cairo_move_to (cr,tx,ty)
cairo_line_to (cr,ix,iy)
cairo_line_to (cr,bx,by)
cairo_line_to (cr,tx,ty)
cairo_fill (cr)
cairo_set_source_rgba (cr,0,0,0,1)
font="URW Chancery L"
fsize=16
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize)
cairo_move_to (cr,x+hw2+3,(y+150)-(hval-hh))
cairo_show_text (cr,hval1.."%")
cairo_stroke (cr)
label="Taux d'humidité"
cairo_move_to (cr,x+12,y+150)
cairo_rotate (cr,(math.pi/180)*(-90))
cairo_show_text (cr,label)
cairo_stroke (cr)
cairo_rotate (cr,(math.pi/180)*(90))
end--humidity
--#############################################################################################################################################################
--#############################################################################################################################################################
function txt(text,xpos,ypos,font,fsize,red,green,blue,alpha)
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize)
cairo_set_source_rgba (cr,red,green,blue,alpha)
cairo_move_to (cr,xpos,ypos)
cairo_show_text (cr,text)
cairo_stroke (cr)
end--function txt
--#############################################################################################################################################################
--#############################################################################################################################################################
function barometer(pr,px,py)
--baromeer 27 inches to 32 inches = 5 inches
cairo_set_line_width (cr,1)
local router=110
cairo_set_source_rgba (cr,0.1,0.1,0.1,0.0)
cairo_arc (cr,px,py,router,(math.pi/180),0)
cairo_fill (cr)
cairo_set_source_rgba (cr,0,0,0,1)
cairo_arc (cr,px,py,router,(math.pi/180),0)
cairo_stroke (cr)
local rout1=75
local rin1=rout1-10
for i=0,40 do
if i==5 or i==15 or i==25 or i==35 then
rout=rout1-7
cairo_set_line_width (cr,3)
elseif i==0 or i==10 or i==20 or i==30 or i==40 then
rout=rout1
cairo_set_line_width (cr,1)
else
rout=rout1-5
cairo_set_line_width (cr,1)
end
arc=(math.pi/180)*(210+(i*(300/40)))
ppx=0+rout*(math.sin(arc))
ppy=0-rout*(math.cos(arc))
arc=(math.pi/180)*(210+(i*300/40))
pix=0+rin1*(math.sin(arc))
piy=0-rin1*(math.cos(arc))
cairo_move_to (cr,px+ppx,py+ppy)
cairo_line_to (cr,px+pix,py+piy)
cairo_stroke (cr)
end
--inches reading
inch={28,29,30,31}
local rout=rout1+2
for i=1,4 do
arc=(math.pi/180)*(210+(300/8)+((i-1)*(300/4)))
ppx=0+rout*(math.sin(arc))
ppy=0-rout*(math.cos(arc))
text=inch[i]
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
width=extents.width
height=extents.height
cairo_move_to (cr,px+ppx-(width/2),py+ppy+(height/2))
cairo_show_text (cr,text)
cairo_stroke (cr)
end
--942 to 1056
--27.5=931.25
--31.5=1066.70
cairo_set_line_width (cr,1)
local m1=300/135.45
local m2=m1*8.75--931.25+8.75=940
local rout2=60
local rin2=rout2-5
local num=60
for i=0,num do
if i==0 or i==5 or i==10 or i==15 or i==20 or i==25 or i==30 or i==35 or i==40 or i==45 or i==50 or i==55 or i==60 or i==65 then
rin=rin2-5
else
rin=rin2
end
arc=(math.pi/180)*(210+m2+(i*((m1*(num*2))/num)))
ppx=0+rout2*(math.sin(arc))
ppy=0-rout2*(math.cos(arc))
arc=(math.pi/180)*(210+m2+(i*((m1*(num*2))/num)))
pix=0+rin*(math.sin(arc))
piy=0-rin*(math.cos(arc))
cairo_move_to (cr,px+ppx,py+ppy)
cairo_line_to (cr,px+pix,py+piy)
cairo_stroke (cr)
end
--millibars reading
inch={940,960,980,1000,1020,1040,1060}
local rout=rin2-18
for i=1,7 do
arc=(math.pi/180)*(210+m2+((i-1)*(m1*20)))
ppx=0+rout*(math.sin(arc))
ppy=0-rout*(math.cos(arc))
text=inch[i]
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
width=extents.width
height=extents.height
cairo_move_to (cr,px+ppx-(width/2),py+ppy+(height/2))
cairo_show_text (cr,text)
cairo_stroke (cr)
end
--scale labels
local text="inches hg"
local extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to (cr,px-(width/2),py+rin1)
cairo_show_text (cr,text)
cairo_stroke (cr)
local text="millibars"
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to (cr,px-(width/2),py+rin2-height)
cairo_show_text (cr,text)
cairo_stroke (cr)
local text="Pression"
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to (cr,px-(width/2),py+rin2+35)
cairo_show_text (cr,text)
cairo_stroke (cr)
--pointer
if pr==nil then pr=27.5 end
local pres=pr-27.5
local m1=300/4
local m2=pres*m1
local rout1=rout1
local arc=(math.pi/180)*(210+m2)
local ppx=0+rout1*(math.sin(arc))
local ppy=0-rout1*(math.cos(arc))
------------------------------
local arc=(math.pi/180)*(210+m2+180)
local ppox=0+rout1*(math.sin(arc))
local ppoy=0-rout1*(math.cos(arc))
-------------------------------
local rin3=7
local arc=(math.pi/180)*(210+m2-90)
local pilx=0+rin3*(math.sin(arc))
local pily=0-rin3*(math.cos(arc))
local arc=(math.pi/180)*(210+m2+90)
local pirx=0+rin3*(math.sin(arc))
local piry=0-rin3*(math.cos(arc))
--------------------------------
cairo_move_to (cr,px+pilx,py+pily)
cairo_line_to (cr,px+ppx,py+ppy)
cairo_line_to (cr,px+pirx,py+piry)
cairo_line_to (cr,px+pilx,py+pily)
cairo_set_source_rgba (cr,1,0,0,1)
cairo_fill (cr)
cairo_arc (cr,px,py,rin3,(math.pi/180),0)
cairo_fill (cr)
---------------------------------
cairo_move_to (cr,px+pilx,py+pily)
cairo_line_to (cr,px+ppox,py+ppoy)
cairo_line_to (cr,px+pirx,py+piry)
cairo_line_to (cr,px+pilx,py+pily)
cairo_set_source_rgba (cr,1,1,1,1)
cairo_fill (cr)
cairo_set_source_rgba (cr,1,0,0,1)
cairo_arc (cr,px,py,rin3,(math.pi/180),0)
cairo_fill (cr)
-----------------------------------
cairo_set_source_rgba (cr,0,0,0,1)
cairo_arc (cr,px,py,rin3-1,(math.pi/180),0)
cairo_fill (cr)
----text
local horiz=px
local verti=py
local radi=87
local text="Tempete"
local font="URW Chancery L"
local fsize=16
local start=240
local finish=start+((string.len(text))*5)
circlewriting(text, font, fsize, radi, horiz, verti, start, finish)
local text="Pluie"
local start=300
local finish=start+((string.len(text))*5)
circlewriting(text, font, fsize, radi, horiz, verti, start, finish)
local text="Variable"
local start=340
local finish=start+((string.len(text))*5)
circlewriting(text, font, fsize, radi, horiz, verti, start, finish)
local text="Beau"
local start=395
local finish=start+((string.len(text))*5)
circlewriting(text, font, fsize, radi, horiz, verti, start, finish)
local text="Tres Sec"
local start=435
local finish=start+((string.len(text))*5)
circlewriting(text, font, fsize, radi, horiz, verti, start, finish)
end--barometer
--#############################################################################################################################################################
--#############################################################################################################################################################
function compass(wx,wy,rout,wdeg,w,wg)
local rin=rout-((rout/100)*10)
cairo_set_source_rgba (cr,0.1,0.1,0.1,0)
cairo_arc (cr,wx,wy,rout,(math.pi/180),0)
cairo_fill (cr)
cairo_set_source_rgba (cr,0,0,0,1)
cairo_arc (cr,wx,wy,rout,(math.pi/180),0)
cairo_stroke (cr)
for i=1,36 do
arc=(math.pi/180)*(i*10)
wpx=0+rout*(math.sin(arc))
wpy=0-rout*(math.cos(arc))
arc=(math.pi/180)*(i*10)
wix=0+rin*(math.sin(arc))
wiy=0-rin*(math.cos(arc))
cairo_move_to (cr,wx+wpx,wy+wpy)
cairo_line_to (cr,wx+wix,wy+wiy)
cairo_stroke (cr)
end
--print directions
local font="URW Chancery L"
local fsize=14
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize)
dirs={"N","NE","E","SE","S","SO","O","NO"}
local rdir=rout-((rout/100)*25)
for i=1,8 do
arc=(math.pi/180)*((i-1)*(360/8))
wdx=0+rdir*(math.sin(arc))
wdy=0-rdir*(math.cos(arc))
text=dirs[i]
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
width=extents.width
height=extents.height
cairo_move_to (cr,wx+wdx-(width/2),wy+wdy+(height/2))
cairo_show_text (cr,text)
cairo_stroke (cr)
end
--indicator
local npr=rout-((rout/100)*15)
if wdeg==nil then wdeg=0 end
local arc=(math.pi/180)*(wdeg)
local npx=0+npr*(math.sin(arc))
local npy=0-npr*(math.cos(arc))
cairo_move_to (cr,wx+npx,wy+npy)
local nprm=rout-((rout/100)*88)
local arc=(math.pi/180)*(wdeg+90)
local npmrx=0+nprm*(math.sin(arc))
local npmry=0-nprm*(math.cos(arc))
local arc=(math.pi/180)*(wdeg-90)
local npmlx=0+nprm*(math.sin(arc))
local npmly=0-nprm*(math.cos(arc))
cairo_line_to (cr,wx+npmrx,wy+npmry)
cairo_line_to (cr,wx+npmlx,wy+npmly)
cairo_line_to (cr,wx+npx,wy+npy)
cairo_set_source_rgba (cr,1,0,0,1)
cairo_fill (cr)
cairo_set_source_rgba (cr,1,1,1,1)
---------------------------------
local arc=(math.pi/180)*(wdeg-180)
local spx=0+npr*(math.sin(arc))
local spy=0-npr*(math.cos(arc))
cairo_move_to (cr,wx+spx,wy+spy)
local sprm=nprm
local arc=(math.pi/180)*(wdeg+90-180)
local spmrx=0+sprm*(math.sin(arc))
local spmry=0-sprm*(math.cos(arc))
local arc=(math.pi/180)*(wdeg-90-180)
local spmlx=0+sprm*(math.sin(arc))
local spmly=0-sprm*(math.cos(arc))
cairo_line_to (cr,wx+spmrx,wy+spmry)
cairo_line_to (cr,wx+spmlx,wy+spmly)
cairo_line_to (cr,wx+spx,wy+spy)
cairo_fill (cr)
--------------------------------------
cairo_set_source_rgba (cr,0,0,0,1)
cairo_arc (cr,wx,wy,nprm,(math.pi/180),0)
cairo_fill (cr)
cairo_set_source_rgba (cr,1,0,0,1)
cairo_arc (cr,wx,wy,nprm,(math.pi/180),0)
cairo_stroke (cr)
------------------------
cairo_set_source_rgba (cr,0,0,0,1)
local text="Rose des Vents"
local extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to (cr,wx-(width/2),wy-rout-5)
cairo_show_text (cr,text)
cairo_stroke (cr)
end--compass
--#############################################################################################################################################################
--
--#############################################################################################################################################################
function conky_draw_bg(r,x,y,w,h,color,alpha)
local function rgb_to_r_g_b(colour,alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
if conky_window == nil then return end
if cs == nil then cairo_surface_destroy(cs) end
if cr == nil then cairo_destroy(cr) end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr = cairo_create(cs)
cairo_set_source_rgba (cr,rgb_to_r_g_b(color,alpha))
--top left mid circle
local xtl=x+r
local ytl=y+r
--top right mid circle
local xtr=(x+r)+((w)-(2*r))
local ytr=y+r
--bottom right mid circle
local xbr=(x+r)+((w)-(2*r))
local ybr=(y+r)+((h)-(2*r))
--bottom right mid circle
local xbl=(x+r)
local ybl=(y+r)+((h)-(2*r))
-----------------------------
cairo_move_to (cr,xtl,ytl-r)
cairo_line_to (cr,xtr,ytr-r)
cairo_arc(cr,xtr,ytr,r,((2*math.pi/4)*3),((2*math.pi/4)*4))
cairo_line_to (cr,xbr+r,ybr)
cairo_arc(cr,xbr,ybr,r,((2*math.pi/4)*4),((2*math.pi/4)*1))
cairo_line_to (cr,xbl,ybl+r)
cairo_arc(cr,xbl,ybl,r,((2*math.pi/4)*1),((2*math.pi/4)*2))
cairo_line_to (cr,xtl-r,ytl)
cairo_arc(cr,xtl,ytl,r,((2*math.pi/4)*2),((2*math.pi/4)*3))
cairo_close_path(cr)
cairo_fill (cr)
------------------------------------------------------------
cairo_surface_destroy(cs)
cairo_destroy(cr)
return ""
end 

en image
1401397203.png

smilies%20(1).gif

Hors ligne

#1037 Le 29/05/2014, à 22:03

Didier-T

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

Merci pour le partage.
Sa fait toujours plaisir smile

Hors ligne

#1038 Le 30/05/2014, à 07:52

loutch

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

smilies%20(204).gif

De rien , de rien je ne fais que de les modifier ,(à la base le plus gros du travail est quand même celui du créateur ) .

AHHHH j'oubliais (mais je pense que vous le savez déjà) le chemin des lua et des images sont spécifique à ma configuration donc à modifier chez vous.

smilies%20(1).gif

Dernière modification par loutch (Le 30/05/2014, à 14:08)

Hors ligne

#1039 Le 31/05/2014, à 09:57

daniel38100

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

ragamatrix a écrit :

ça ne fonctionne plus aujourd'hui; même bug du script meteo avec convert... J'ai essayé aussi avec une autre compo et ça plante aussi.

desolé de repondre un peu tarde mais tu a quel distribution et quel interface graphique car il semblerai que ton interface garphique ne soit pas pris en charge

Hors ligne

#1040 Le 31/05/2014, à 19:39

loutch

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

smilies%20(204).gif

Utilisant le pack meteo6jours de Didier-t je voudrais y ajouter un thermometre pour que cela donne ceci:

1401561438.png

J'ai bien fouillé sur le forum mais impossible de trouvé les fichiers et lua qui permettent de faire fonctionner ce thermo.

J'ai trouvé un pack accuweather avec plein de dossier et des thermometres de JPDipsy mais impossible de sortir des compos juste le petit truc pour les thermos.

l'adresse c'est ici

smilies%20(242).gif d'avance et



smilies%20(1).gif

Dernière modification par loutch (Le 31/05/2014, à 20:51)

Hors ligne

#1041 Le 02/06/2014, à 18:01

loutch

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

smilies%20(204).gif

Je viens de faire un conky meteo 8 heures  ( j'ai tout supprimé  après la partie TEXT et essayé de la remplir par moi-meme )
.

background yes
use_xft yes
xftfont URW Chancery L:style=Bold:size=12
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
#own_window_color 000000
own_window_argb_visual yes
#own_window_argb_value 0
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_pager
double_buffer yes
minimum_size 400 450
maximum_width 400
text_buffer_size 2048
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color white
default_outline_color white
alignment top_right
gap_x 200
gap_y 320
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
# Fonctionne uniquement avec les polices Fixes
#use_spacer yes

 uppercase no

 default_color 000000
 color0     6495ee
	# -- Déclaration template -- #
	template0 ${lua fDrawImage ~/.conky/conky-meteo/meteo/images/\1 \2 \3 \4 \5} # -- images fond -- #
	template1 ${lua Meteo_\1 \2 \3 \4 \5 \6} # -- gestion météo --#
	template2 ${lua Meteo_\1 \2 \3 \4 \5 \6 \7} # -- icônes météo -- \2=répertoire icônes \3=position \4=taille \5=jour (pour les prévisions) #
	template3 ${lua Lune_\1} 
	template4 ${lua_parse Images_\1 \2 \3 60 \4} # -- Appelle image -- \2=position \3=taille \4=jour (pour les prévisions) #
	
	lua_load ~/.conky/conky-meteo/meteo_lua_2/scripts/meteo2.lua

	lua_startup_hook init ~/.conky/conky-meteo/meteo/meteo.cfg
	
	
	TEXT		
${template1 Maj} 
Heure  Temp                 Dir.Vent   Prob. pluie :
${template1 huitHeures_Heure 1} h      ${template1 huitHeures_Temp 1}° ${goto 150}${template1 huitHeures_VentDir 1}  ${goto 220} ${template1 huitHeures_ProbPluie 1}%

${template1 huitHeures_Heure 2} h      ${template1 huitHeures_Temp 2}° ${goto 150}${template1 huitHeures_VentDir 2}  ${goto 220} ${template1 huitHeures_ProbPluie 2}%

${template1 huitHeures_Heure 3} h      ${template1 huitHeures_Temp 3}° ${goto 150}${template1 huitHeures_VentDir 3}  ${goto 220} ${template1 huitHeures_ProbPluie 3}%

${template1 huitHeures_Heure 4} h      ${template1 huitHeures_Temp 4}° ${goto 150}${template1 huitHeures_VentDir 4}  ${goto 220} ${template1 huitHeures_ProbPluie 4}%

${template1 huitHeures_Heure 5} h      ${template1 huitHeures_Temp 5}° ${goto 150}${template1 huitHeures_VentDir 5}  ${goto 220} ${template1 huitHeures_ProbPluie 5}%

${template1 huitHeures_Heure 6} h      ${template1 huitHeures_Temp 6}° ${goto 150}${template1 huitHeures_VentDir 6}  ${goto 220} ${template1 huitHeures_ProbPluie 6}%

${template1 huitHeures_Heure 7} h      ${template1 huitHeures_Temp 7}° ${goto 150}${template1 huitHeures_VentDir 7}  ${goto 220} ${template1 huitHeures_ProbPluie 7}%

${template1 huitHeures_Heure 8} h      ${template1 huitHeures_Temp 8}° ${goto 150}${template1 huitHeures_VentDir 8}  ${goto 220} ${template1 huitHeures_ProbPluie 8}%


${template2 huitHeures_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 70 35 86 52 1}
${template2 huitHeures_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 70 75 86 52 2}
${template2 huitHeures_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 70 117 86 52 3}
${template2 huitHeures_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 70 158 86 52 4}
${template2 huitHeures_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 70 199 86 52 5}
${template2 huitHeures_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 70 241 86 52 6}
${template2 huitHeures_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 70 284 86 52 7}
${template2 huitHeures_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 70 326 86 52 8}

et l'image :

1401728026.png

avec le reste de la météo

1401728178.png

reste plus qu'à trouvé un thermometre et placé un peu mieux les conky .

smilies%20(1).gif

Dernière modification par loutch (Le 02/06/2014, à 21:33)

Hors ligne

#1042 Le 03/06/2014, à 16:39

loutch

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

smilies%20(204).gif

Je 'ai commencé avec un conkyrc vierge et mis tout en un pas de offset ni de voffset et limité le nombre d'heures et de jours à 6, ça donne ceci , il fonctionne mais en console il y a une erreur avec la ville ??????????????? .

le conkyrc :

background yes
use_xft yes
xftfont URW Chancery L:style=Bold:size=10
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
#own_window_color 000000
own_window_argb_visual yes
#own_window_argb_value 0
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_pager
double_buffer yes
minimum_size 600 
maximum_width 600
text_buffer_size 2048
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color white
default_outline_color white
alignment top_left
gap_x 500
gap_y 170
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
# Fonctionne uniquement avec les polices Fixes
#use_spacer yes

 uppercase no

 default_color 000000
 color0     6495ee
 

 # -- Déclaration template -- #
 template0 ${lua fDrawImage ~/.conky/conky-meteo/meteo6jours/fon/\1 \2 \3 \4 \5} # -- images fond -- #
 template1 ${lua Meteo_\1 \2 \3 \4 \5 \6} # -- gestion météo --#
 template2 ${lua Meteo_\1 \2 \3 \4 \5 \6 \7} # -- icônes météo -- \2=répertoire icônes \3=position \4=taille \5=jour (pour les prévisions) #
 template3 ${lua Lune_\1} 
 template4 ${lua_parse Images_\1 \2 \3 60 \4} # -- Appelle image -- \2=position \3=taille \4=jour (pour les prévisions) #

 lua_load ~/.conky/conky-meteo/meteo_lua_2/scripts/meteo2.lua

 lua_startup_hook init ~/.conky/conky-meteo/meteo6jours/meteo.cfg
 
 TEXT  
                                                ${alignc}${font URW Chancery L :size=12 style:bold}${template1 Ville}${font}
 ${template1 Maj}${alignc}Dernière mise à jour : ${template1 Heure} h ${template1 Minute}
 ${alignc} Conditions actuelles :
 ${goto 10}Température :            ${goto 95}Condition :             ${goto 170}Direction du Vent :    ${goto 290}Vitesse :                     ${goto 370}Rafales :                             ${goto 450}Pression :                  ${goto 550}Pluie : 
 ${goto 30}${template1 TempAct}°C   ${goto 97}${template1 CondMeteo}  ${goto 200}${template1 VentDirP}  ${goto 290} ${template1 VentForce} km/h  ${goto 370}${template1 Jour_VentRafales 1} Km/h  ${goto 450}${template1 Pression 1} mb  ${goto 550}${template1 Jour_NivPrec 1} mm
    
 
 
                                                ${alignc} Soleil :
 Lever ${template1 HLeverSoleil 1}:${template1 MLeverSoleil 1}      Coucher ${template1 HCoucherSoleil 1}:${template1 MCoucherSoleil 1}    ${goto 170} Durée :${template1 HDureeJour 1} h ${template1 MDureeJour 1}   ${goto 270} Indice UV : ${template1  Uv 1}  ${goto 370}Couverture nuageuse: ${template1  CouvNuage 1}%  ${goto 520} Visibilité: ${template1  Visibilite 1} km
       
                                                ${goto 255} Prochaines six heures :                                                
 ${goto 35}${template1 huitHeures_Heure 1} h                                            ${goto 140}${template1 huitHeures_Heure 2} h                                            ${goto 242}${template1 huitHeures_Heure 3} h                                            ${goto 355}${template1 huitHeures_Heure 4} h                                            ${goto 465}${template1 huitHeures_Heure 5} h                                            ${goto 560}${template1 huitHeures_Heure 6} h
 
 ${template2 huitHeures_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones  0 235 86 52 1}  ${template2 huitHeures_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 105 235 86 52 2}  ${template2 huitHeures_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 210 235 86 52 3}  ${template2 huitHeures_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 320 235 86 52 4}  ${template2 huitHeures_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 430 235 86 52 5}  ${template2 huitHeures_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 525 235 86 52 6}
 ${goto 36}${template1 huitHeures_Temp 1}°                                              ${goto 141}${template1 huitHeures_Temp 2}°                                              ${goto 243}${template1 huitHeures_Temp 3}°                                              ${goto 356}${template1 huitHeures_Temp 4}°                                              ${goto 466}${template1 huitHeures_Temp 5}°                                              ${goto 561}${template1 huitHeures_Temp 6}°

 ${template2 huitHeures_IconeV ~/.conky/conky-meteo/meteo_lua_2/icones 25 295 40 40 1}  ${template2 huitHeures_IconeV ~/.conky/conky-meteo/meteo_lua_2/icones 130 295 40 40 2}  ${template2 huitHeures_IconeV ~/.conky/conky-meteo/meteo_lua_2/icones 235 295 40 40 3}  ${template2 huitHeures_IconeV ~/.conky/conky-meteo/meteo_lua_2/icones 345 295 40 40 4}  ${template2 huitHeures_IconeV ~/.conky/conky-meteo/meteo_lua_2/icones 455 295 40 40 5}  ${template2 huitHeures_IconeV ~/.conky/conky-meteo/meteo_lua_2/icones 550 295 40 40 6}
 ${goto 36}${template1 huitHeures_VentDirP 1}                                           ${goto 141}${template1 huitHeures_VentDirP 2}                                           ${goto 242}${template1 huitHeures_VentDirP 3}                                           ${goto 354}${template1 huitHeures_VentDirP 4}                                           ${goto 466}${template1 huitHeures_VentDirP 5}                                           ${goto 561}${template1 huitHeures_VentDirP 6}
 ${goto 25}${template1 huitHeures_VentForce 1} km/h                                     ${goto 130}${template1 huitHeures_VentForce 2} km/h                                     ${goto 231}${template1 huitHeures_VentForce 3} km/h                                     ${goto 343}${template1 huitHeures_VentForce 4} km/h                                     ${goto 455}${template1 huitHeures_VentForce 5} km/h                                     ${goto 550}${template1 huitHeures_VentForce 6} km/h 
 
                                                 ${alignc} Prochains six jours :
                                   ${goto 25}${template1 Jour %a_%d 2}                                                                    ${goto 135}${template1 Jour %a_%d 3}                                                                               ${goto 235}${template1 Jour %a_%d 4}                                                                               ${goto 350}${template1 Jour %a_%d 5}                                                                               ${goto 460}${template1 Jour %a_%d 6}                                                                               ${goto 560}${template1 Jour %a_%d 7}                                                                  
 ${font Sans :size=8:style=bold}   ${color red}${template1 Jour_Temp 2}°${color black} / ${color cornflowerblue}${template1 Nuit_Temp 2}° ${goto 130}${color red}${template1 Jour_Temp 3}°${color black} / ${color cornflowerblue}${template1 Nuit_Temp 3}°  ${goto 230}${color red}${template1 Jour_Temp 4}°${color black} / ${color cornflowerblue}${template1 Nuit_Temp 4}°  ${goto 345}${color red}${template1 Jour_Temp 5}°${color black} / ${color cornflowerblue}${template1 Nuit_Temp 5}°  ${goto 455}${color red}${template1 Jour_Temp 4}°${color black} / ${color cornflowerblue}${template1 Nuit_Temp 6}°  ${goto 555}${color red}${template1 Jour_Temp 4}°${color black} / ${color cornflowerblue}${template1 Nuit_Temp 7}°
                                   ${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 0 440 86 52 2}                         ${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 105 440 86 52 3}                                   ${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 205 440 86 52 4}                                   ${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 320 440 86 52 5}                                   ${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 430 440 86 52 6}                                   ${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 530 440 86 52 7}
                                   
${font URW Chancery L :size=10:style=bold}${color black}
                                   ${goto 25}${template1 Jour_VentForce 2} km/h                                                           ${goto 135}${template1 Jour_VentForce 3} km/h                                                                      ${goto 235}${template1 Jour_VentForce 4} km/h                                                                      ${goto 350}${template1 Jour_VentForce 5} km/h                                                                      ${goto 460}${template1 Jour_VentForce 6} km/h                                                                      ${goto 560}${template1 Jour_VentForce 3} km/h
 # icone conditions actuelles 
 ${template2 IconeM ~/.conky/conky-meteo/meteo_lua_2/icones  75 95 91 57} ${lua fDrawImage ~/.conky/conky-meteo/meteo_lua_2/icones/icone_meteo/30.png -5 95 100 50}  ${lua fDrawImage ~/.conky/conky-meteo/meteo_lua_2/icones/vvent.png 300 98 45 45}      ${lua fDrawImage ~/.conky/conky-meteo/meteo_lua_2/icones/rvent.png 370 98 50 50}
 ${template2 IconeV ~/.conky/conky-meteo/meteo_lua_2/icones 188 99 50 50} ${lua fDrawImage ~/.conky/conky-meteo/meteo_lua_2/icones/barometre.png 440 95 60 60}       ${lua fDrawImage ~/.conky/conky-meteo/meteo_lua_2/icones/parapluie.png 540 102 47 47}

l'image :

1401824777.png

la console :

[romuald@localhost ~]$ conky -c ~/.conky/conky-meteo/meteo6jours/meteo6
Conky: forked to background, pid is 32132
[romuald@localhost ~]$ 
Conky: desktop window (1e00263) is subwindow of root window (90)
Conky: window type - normal
Conky: drawing to created window (0x6a00002)
Conky: drawing to double buffer
        version = v1.11
        web = http://www.accuweather.com/fr/fr/sarreguemines/57200/weather-forecast/135050
        Pévision Nb jours = 7 
        Pévision Matin = non
        Pévision Après Midi = non
        Pévision Soirée = non
        Pévision Nuit = non
        Prévision sur 8 heures = oui
        nbFoisHuit= 1
        Délais = 60
        Chemin de travail = /tmp
        Palier = 20
        Chemin de sauvegarde = /home/romuald/.conky/conky-meteo/meteo6jours/reptravail
        Chemin script = /home/romuald/.conky/conky-meteo/meteo_lua_2/scripts
        Notification = non
        ID = 32132
Conky: llua_getstring: function conky_Meteo_Ville didn't return a string, result discarded
Condition courante Ok
Prévision 1 Ok
Prévision 2 Ok
Prévision 3 Ok
Prévision 4 Ok
Prévision 5 Ok
Prévision 6 Ok
Prévision 7 Ok
huit heures Ok
Version = 1.31
lunaison Ok
huitHeures 1 Ok
Jour 1 Ok
Jour 2 Ok
Jour 3 Ok
Jour 4 Ok
Jour 5 Ok
Jour 6 Ok
Jour 7 Ok
CC Ok
mise a jour en : 8.320706605911255
Condition courante Ok
Prévision 1 Ok
Prévision 2 Ok
Prévision 3 Ok
Prévision 4 Ok
Prévision 5 Ok
Prévision 6 Ok
Prévision 7 Ok
huit heures Ok


smilies%20(1).gif

Dernière modification par loutch (Le 03/06/2014, à 20:48)

Hors ligne

#1043 Le 04/06/2014, à 07:42

Didier-T

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

Bonjour loutch,
tu devrais faire la mise a jour en premier après TEXT.
ceci

TEXT  
                                                ${alignc}${font URW Chancery L :size=12 style:bold}${template1 Ville}${font}
 ${template1 Maj}${alignc}Dernière mise à jour : ${template1 Heure} h ${template1 Minute}

deviens celà

TEXT  
 ${template1 Maj}                                                ${alignc}${font URW Chancery L :size=12 style:bold}${template1 Ville}${font}
 ${alignc}Dernière mise à jour : ${template1 Heure} h ${template1 Minute}

Hors ligne

#1044 Le 06/06/2014, à 15:51

ragamatrix

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

daniel38100 a écrit :
ragamatrix a écrit :

ça ne fonctionne plus aujourd'hui; même bug du script meteo avec convert... J'ai essayé aussi avec une autre compo et ça plante aussi.

desolé de repondre un peu tarde mais tu a quel distribution et quel interface graphique car il semblerai que ton interface garphique ne soit pas pris en charge

Oulah moi aussi... Je fais une pause avec le meteofond ecran et la regarde seulement quand j'en ai besoin avec conky-tool  j'ai une session compiz-stand-alone sur ma distri crunchbang 11 debian wheezy... j'ai aussi openbox.
1402066204.png

Hors ligne

#1045 Le 14/07/2014, à 14:55

loutch

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

smilies%20(204).gif

Voila je me suis permis de modifier le conky cronograph station de hfcf trouvé ici .

J'ai remplacé la météo d'origine par celle de Didier-t et rajouté un deuxième script pour le led du haut .

Ca donne ceci :

1405345281.png

le conkyrc :

background no
use_xft yes
xftfont URW Chancery L:style=Bold:size=10
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 300 300
maximum_width 300
text_buffer_size 1024
draw_shades no
draw_outline no
draw_borders no
border_width 1
draw_graph_borders no
default_color ffffff
default_outline_color cacaca
alignment top_right
gap_x 20
gap_y 200
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes

# — Lua Load — #
# -- Déclaration template -- #
 template0 ${lua fDrawImage ~/.conky/conky-meteo/meteo6jours/fon/\1 \2 \3 \4 \5} # -- images fond -- #
 template1 ${lua Meteo_\1 \2 \3 \4 \5 \6} # -- gestion météo --#
 template2 ${lua Meteo_\1 \2 \3 \4 \5 \6 \7} # -- icônes météo -- \2=répertoire icônes \3=position \4=taille \5=jour (pour les prévisions) #
 template3 ${lua Lune_\1} 
 template4 ${lua_parse Images_\1 \2 \3 60 \4} # -- Appelle image -- \2=position \3=taille \4=jour (pour les prévisions) #

lua_load ~/.conky/conky-meteo/meteo_lua_2/scripts/meteo2.lua
lua_startup_hook init ~/.conky/conky-meteo/meteo6jours/meteo.cfg
lua_load ~/.conky/cronograph/scripts/clock_rings.lua
lua_draw_hook_pre clock_rings
lua_load ~/.conky/cronograph/scripts/multi_rings.lua
lua_draw_hook_post main
lua_load ~/.conky/draw_bg/draw_bg.lua

TEXT
${lua conky_draw_bg 10 0 0 0 300 0x000000 0.30}${template1 Maj}
${voffset 30}${goto 80}${font URW Chancery L:style=Bold:size=10}${time %H:%M}${font}${goto 185}UPTIME:
${voffset 2}${goto 65}${time %a %d %b}${goto 185}${uptime}
${voffset 2}${goto 80}${time %Y}
${voffset -10}${goto 130}Racine
${voffset -6}${goto 105}${fs_used /}/${fs_size /}
${voffset 20}${goto 80}${cpu cpu0}%${goto 205}${memperc}%
${voffset 10}${goto 70}CPU${goto 200}MEM
${execpi 1 cat ~/.conky/cronograph/scripts/blinkingLED}
${execpi 1 cat ~/.conky/cronograph/scripts/blinkingLEDh}
${voffset -130}${goto 140}${template1 TempAct}°C ${template2 IconeM ~/.conky/conky-meteo/meteo_lua_2/icones  128 170 50 27}
${voffset 16}${goto 105}${template1 CondMeteo}
${voffset 15}${alignc 20}${font URW Chancery L:style=Bold:size=8}${template1 Jour_Temp 2}° / ${template1 Nuit_Temp 2}°${alignc -10}${template1 Jour_Temp 3}° / ${template1 Nuit_Temp 3}°${alignc -60}${template1 Jour_Temp 4}° / ${template1 Nuit_Temp 4}°
${voffset -5}${alignc 40}${template1 Jour %a_%d 2}${alignc -10}${template1 Jour %a_%d 3}${alignc -60}${template1 Jour %a_%d 4}
${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones   60 205 50 25 2}${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones   125 205 50 25 3}${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones   190 205 50 25 4}

le script pour le led du haut :

${image $HOME/.conky/cronograph/images/Blank.png -p 130, 19 -s 30x30}${if_match ${execi 1 num=$(date +%-S);rem=$(( num % 2 ));if [ $rem -eq 0 ] ; then echo 0 ; else  echo 1 ; fi}==0}${image $HOME/.conky/cronograph/images/Blue.png -p 130, 19 -s 30x30}${endif}

le reste est dans le pack d'origine.

smilies%20(1).gif


PS chez moi il y a une erreur en konsole mais elle semble venir du pack d'origine vu qu'elle y est déjà lors de l'éssai  du pack d'origine avant modification.

Dernière modification par loutch (Le 14/07/2014, à 18:37)

Hors ligne

#1046 Le 15/07/2014, à 08:28

loutch

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

Bonjour

je viens de trouver ce qui me met l'erreur

c'est le chargement des lua

lua_load ~/.conky/cronograph/scripts/clock_rings.lua
lua_draw_hook_pre clock_rings
lua_load ~/.conky/cronograph/scripts/multi_rings.lua
lua_draw_hook_post main

il y a quelque chose qui cloche avec la deuxième ligne "lua_draw_hook_pre clock_rings " j'ai essayé pleins de combinaisons avec pre  et post  et à chaque fois , ou il y a erreur en console , ou les cercles extérieurs ne s'affichent plus .Là je sèche .

Merci d'avance pour toute solution et

@+

Dernière modification par loutch (Le 15/07/2014, à 08:40)

Hors ligne

#1047 Le 15/07/2014, à 17:16

Didier-T

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

Bonjour loutch,
Pourrait tu nous donner le message d'erreur.

Hors ligne

#1048 Le 15/07/2014, à 20:16

loutch

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

bonsoir Didier

Voila juste une partie une fois tout chargé ça ne s'arrête plus.

[romuald@localhost ~]$ conky -c ~/.conky/cronograph/conkyrc
Conky: desktop window (1e00277) is subwindow of root window (90)
Conky: window type - normal
Conky: drawing to created window (0x5a00002)
Conky: drawing to double buffer
        version = v1.11
        web = http://www.accuweather.com/fr/fr/sarreguemines/57200/weather-forecast/135050
        Pévision Nb jours = 7 
        Pévision Matin = non
        Pévision Après Midi = non
        Pévision Soirée = non
        Pévision Nuit = non
        Prévision sur 8 heures = oui
        nbFoisHuit= 1
        Délais = 60
        Chemin de travail = /tmp
        Palier = 20
        Chemin de sauvegarde = /home/romuald/.conky/conky-meteo/meteo6jours/reptravail
        Chemin script = /home/romuald/.conky/conky-meteo/meteo_lua_2/scripts
        Notification = non
        ID = 15514
Condition courante Ok
Prévision 1 Ok
Prévision 2 Ok
Prévision 3 Ok
Prévision 4 Ok
Prévision 5 Ok
Prévision 6 Ok
Prévision 7 Ok
huit heures Ok
Version = 1.31
lunaison Ok
huitHeures 1 Ok
Jour 1 Ok
Jour 2 Ok
Jour 3 Ok
Conky: unknown variable 
Conky: unknown variable 
Conky: unknown variable 
Conky: unknown variable 
Conky: unknown variable 
Conky: unknown variable 
Conky: unknown variable 
Conky: unknown variable 
Conky: unknown variable 
Conky: unknown variable 
Conky: unknown variable 
Jour 4 Ok
Conky: unknown variable 
Conky: unknown variable 
Conky: unknown variable 
Conky: unknown variable 
Conky: unknown variable 
Conky: unknown variable 
Conky: unknown variable 
Conky: unknown variable 
Conky: unknown variable 
Conky: unknown variable 
Conky: unknown variable 
Jour 5 Ok
Conky: unknown variable 
Conky: unknown variable 
Conky: unknown variable 
Conky: unknown variable 
Conky: unknown variable 
Conky: unknown variable 
Conky: unknown variable 
Conky: unknown variable 
Conky: unknown variable 
Conky: unknown variable 
Conky: unknown variable 
Jour 6 Ok
Conky: unknown variable 
Conky: unknown variable 
Conky: unknown variable

si j'enlève ça

lua_load ~/.conky/cronograph/scripts/clock_rings.lua
lua_draw_hook_pre clock_rings

il ni a plus d'erreur

[romuald@localhost ~]$ conky -c ~/.conky/cronograph/conkyrc
Conky: desktop window (1e00289) is subwindow of root window (90)
Conky: window type - normal
Conky: drawing to created window (0x5200002)
Conky: drawing to double buffer
        version = v1.11
        web = http://www.accuweather.com/fr/fr/sarreguemines/57200/weather-forecast/135050
        Pévision Nb jours = 7 
        Pévision Matin = non
        Pévision Après Midi = non
        Pévision Soirée = non
        Pévision Nuit = non
        Prévision sur 8 heures = oui
        nbFoisHuit= 1
        Délais = 60
        Chemin de travail = /tmp
        Palier = 20
        Chemin de sauvegarde = /home/romuald/.conky/conky-meteo/meteo6jours/reptravail
        Chemin script = /home/romuald/.conky/conky-meteo/meteo_lua_2/scripts
        Notification = non
        ID = 2614
Condition courante Ok
Prévision 1 Ok
Prévision 2 Ok
Prévision 3 Ok
Prévision 4 Ok
Prévision 5 Ok
Prévision 6 Ok
Prévision 7 Ok
huit heures Ok
Version = 1.31
lunaison Ok
huitHeures 1 Ok
Jour 1 Ok
Jour 2 Ok
Jour 3 Ok
Jour 4 Ok
Jour 5 Ok
Jour 6 Ok
Jour 7 Ok
CC Ok
mise a jour en : 10.087359428405762
Condition courante Ok
Prévision 1 Ok
Prévision 2 Ok
Prévision 3 Ok
Prévision 4 Ok
Prévision 5 Ok
Prévision 6 Ok
Prévision 7 Ok
huit heures Ok

mais plus de cercle plus d'aiguille il reste ceci

1405451769.png



@+

Hors ligne

#1049 Le 16/07/2014, à 15:35

Didier-T

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

Bonjour loutch,
je viens de regarder le code du script clock_rings.lua, si je ne me trompe pas e qui pose problème ce sont les fonctions vide (elles servent a afficher les cercles) le soucis est que coky n'a pas de fonction vide, donc il renvoit un message d'erreur.
pour supprimer les messages d'erreurs il y a plusieurs solutions, modifier le script pour qu'il repère les fonctions nul, mais je suis en congé loins de mon pc, donc nous utiliserons une seconde solution qui consiste a modifier chaque fonction nul.

...
name='',
arg='',
...

en

...
name='exec',
arg='echo 100',
...

ça devrait régler le soucis

Hors ligne

#1050 Le 17/07/2014, à 09:46

loutch

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

smilies%20(204).gif

Merci plus d'erreur ça fonctionne au poil.




OHHH GRAND MAITRE-CONKY



moi petit padawan vous souhaite d'agréable vacance , et

smilies%20(1).gif

Hors ligne