#1226 Le 27/10/2015, à 14:29
- loutch
Re : [Conky] Alternative à weather.com (3)
Salut
il y a eu des changements sur le site accuweather
Je m'en doutait un peu , donc on va attendre que notre "maitre conkystador" corrige cela.
@+
Hors ligne
#1227 Le 28/10/2015, à 03:42
- seelord
Re : [Conky] Alternative à weather.com (3)
Didieeeeeeerrrrr Au Secours
Dernière modification par seelord (Le 28/10/2015, à 03:42)
Rien ne sert d'avoir une grosse tête, suffit juste de mettre les pieds dans le plat...^^
Hors ligne
#1228 Le 29/10/2015, à 18:36
- seelord
Re : [Conky] Alternative à weather.com (3)
Re salut,
Quelqu'un a trouvé une solution pour pallier ce problème svp?
Vous pensez que Didier-T suit encore ses scripts?
Cordialement.
Rien ne sert d'avoir une grosse tête, suffit juste de mettre les pieds dans le plat...^^
Hors ligne
#1229 Le 30/10/2015, à 09:01
- daniel38100
Re : [Conky] Alternative à weather.com (3)
@ tous
petite correction grossière mais fonctionnel en attendant (packs non mis a jour)
recmeteo.py passage à v1.31e pour le meteo-lua-2
#! /usr/bin/python3
# -*- coding: utf-8 -*-
# Par Didier-T Forum Ubuntu.fr
# Ajout notification par jpdipsy Forum Ubuntu.fr
# Ajout notification via DBus par ti_tux Forum Ubuntu.fr
# Ajout création repsauv si inexistant par jpdipsy Forum Ubuntu.fr
# Correction par daniel38100
from socket import timeout
from urllib.request import Request, urlopen, URLError
from os import path, makedirs, system
from time import time, sleep, strftime, localtime
from re import search, compile, findall
from sys import argv
from gc import collect
from bs4 import BeautifulSoup
Version='1.31e'
homedir = path.expanduser('~')
#### initialisation des variables
adressWeb="http://www.accuweather.com/fr/fr/belfort/133341/daily-weather-forecast/133341"
repsauv= "~/essais"
huitHeures="oui"
nbFoisHuit=1
matin="oui"
apresmidi="oui"
soiree="oui"
nuit="oui"
nbJour=1
interval=30
notifi="oui"
externe = None
Id = "sans"
demon = "non"
fullnotify = "non"
MAJP = "oui"
for a in argv:
if search("adressWeb=", a) is not None:
adressWeb=compile("adressWeb=(.*)").search(a).group(1)
if search("repsauv=", a) is not None:
repsauv=compile("repsauv=(.*)").search(a).group(1)
if search("huitHeures=", a) is not None:
huitHeures=compile("huitHeures=(.*)").search(a).group(1)
if search("nbJour=", a) is not None:
nbJour=compile("nbJour=(.*)").search(a).group(1)
if search("interval=", a) is not None:
interval=compile("interval=(.*)").search(a).group(1)
if search("notify=", a) is not None:
notifi=compile("notify=(.*)").search(a).group(1)
if search("notifyPartielle=", a) is not None:
fullnotify=compile("notifyPartielle=(.*)").search(a).group(1)
if search("matin=", a) is not None:
matin=compile("matin=(.*)").search(a).group(1)
if search("apresmidi=", a) is not None:
apresmidi=compile("apresmidi=(.*)").search(a).group(1)
if search("soiree=", a) is not None:
soiree=compile("soiree=(.*)").search(a).group(1)
if search("nuit=", a) is not None:
nuit=compile("nuit=(.*)").search(a).group(1)
if search("externe=", a) is not None:
externe=compile("externe=(.*)").search(a).group(1)
if search("nbFoisHuit=", a) is not None:
nbFoisHuit=compile("nbFoisHuit=(.*)").search(a).group(1)
if search("id=", a) is not None:
Id=compile("id=(.*)").search(a).group(1)
if search("demon=", a) is not None:
demon=compile("demon=(.*)").search(a).group(1)
if search("MAJP=", a) is not None:
MAJP=compile("MAJP=(.*)").search(a).group(1)
nbJour=int(nbJour)
interval=int(interval)
repsauv=repsauv.replace("~", homedir)
notifi=str.lower(notifi)
fullnotify==str.lower(fullnotify)
huitHeures=str.lower(huitHeures)
nbFoisHuit=int(nbFoisHuit)
MAJP=str(MAJP)
#### fin initialisation des variables
#### Fonction de traitement des fichiers
def traitement(adress, fichier, repsauv):
current_balise=None
x=1
user_agent = 'Mozilla/5.0 (X11; Linux x86_64)'
headers = { 'User-Agent' : user_agent }
while current_balise is None:
response = None
while response is None:
try:
html_page = urlopen(adress, timeout=10)
except (URLError) as error:
print("[\033[31mFAIL\033[0m] HTML ", error)
except timeout:
print("[\033[31mFAIL\033[0m] erreur timeout acces HTML")
else:
try:
currentCond=html_page.read()
except (URLError) as error:
print("[\033[31mFAIL\033[0m] Lecture page ", error)
except timeout:
print("[\033[31mFAIL\033[0m] erreur timeout lecture page")
else:
fiche = open("/tmp/page.html", "wb")
fiche.write(currentCond)
fiche.close()
response = "ok"
if response is None:
sleep(10)
fiche = open("/tmp/page.html", "r")
lines = fiche.readlines()
curr = {}
curr[0] = []
curr[1] = []
i=0
for line in lines:
curr[i].append(line)
if search("!-- /.feed-tabs --", line) is not None:
i=1
curr[0] = ''.join(curr[0])
curr[1] = ''.join(curr[1])
soup1 = BeautifulSoup(curr[0])
soup = BeautifulSoup(curr[1])
#si autres que huit heures
table=soup.find_all('table')
current_balise=soup.find(id="details")
information=[]
information.append("")
if search("huitHeures", fichier) is None:
# recherche vent
moment=adress.split('/')[7]
divs=current_balise.select("[class~=rt]")
if len(divs) == 0:
if moment == "current-weather" :
divs=current_balise.select("[class~=detail-tab-panel]")
else :
divs=current_balise.select("[class~=wind-box-lg]")
i=0
for div in divs:
i=i+1
if moment == "daily-weather-forecast" :
ventd=str(div.get_text().split("\n")[11]).split()[0]
ventf=str(div.get_text().split("\n")[11]).split()[1]
information.append("direction"+str(i)+": "+str(ventd))
information.append("vitesse"+str(i)+": "+str(ventf))
elif moment == "morning-weather-forecast" or moment == "afternoon-weather-forecast" or moment == "evening-weather-forecast" or moment == "overnight-weather-forecast" :
ventd=compile("var d = '(.*)';").search(str(div)).group(1).replace("W", "O")
ventf=compile("var s = '(.*)';").search(str(div)).group(1)
information.append("direction"+str(i)+": "+str(ventd))
information.append("vitesse"+str(i)+": "+str(ventf))
elif moment == "current-weather" :
ventd=str(str(str(div.select("[class~=more-info]")).split('\n')[2]).split('/')[6]).split('.')[0]
ventf=str(div.get_text()).split('\n')[29]
information.append("direction"+str(i)+": "+str(ventd))
information.append("vitesse"+str(i)+": "+str(ventf))
#info dans l'image
inf=current_balise.select("[class~=info]")
icone=current_balise.select("[class~=icon]")
i=0
#recherche icone
for ic in icone:
i=i+1
information.append("icone"+str(i)+": "+str(ic).replace('<div class="icon i-', '').replace('"></div>', ''))
i=0
#récupération date + historique
if search("Jour", fichier) is not None or search("CC", fichier) is not None:
histo=soup.find(id="feature-history")
#récupération date
date=histo.find_all('th')
jour=compile("(.*)/(.*)/(.*)").search(date[4].get_text())
information.append("jour: "+jour.group(1))
information.append("mois: "+jour.group(2))
information.append("année: "+str(int(jour.group(3))+1))
#récupération historique
hi=histo.select("[class~=hi]")
for v in hi:
hivalue=v.get_text().split("\n")
information.append("maxjour: "+hivalue[2])
information.append("maxnormal: "+hivalue[3])
information.append("maxrecord: "+hivalue[4])
information.append("max1ans: "+hivalue[5])
lo=histo.select("[class~=last]")
for v in lo:
lovalue=v.get_text().split("\n")
information.append("minjour: "+lovalue[2])
information.append("minnormal: "+lovalue[3])
information.append("minrecord: "+lovalue[4])
information.append("min1ans: "+lovalue[5])
#info dans l'image
if search("Jour", fichier) is not None:
infs=inf[0].get_text().split("\n")
information.append("Tempjour: "+findall('-?\d+', infs[1])[0])
information.append("RealFeeljour: "+findall('-?\d+', infs[2])[0])
information.append("Précipitationsjour: "+findall('-?\d+', infs[3])[0])
infs=inf[1].get_text().split("\n")
information.append("Tempnuit: "+findall('-?\d+', infs[1])[0])
information.append("RealFeelnuit: "+findall('-?\d+', infs[2])[0])
information.append("Précipitationsnuit: "+findall('-?\d+', infs[3])[0])
lever_coucher=soup.select("[class~=time-period]")
i=0
for p in lever_coucher:
spans=p.find_all('span')
i=i+1
x=0
for span in spans:
if i == 1:
span_nom="Soleil "
else:
span_nom="Lune "
if search('start', str(span)) is not None:
information.append(span_nom+"lever: "+span.get_text())
if search('time', str(span)) is not None:
information.append(span_nom+"durée: "+span.get_text())
if search('finish', str(span)) is not None:
information.append(span_nom+"coucher: "+span.get_text())
p=current_balise.find_all('p')
i=0
x=0
for pv in p:
i=i+1
if i==5 or i==10:
x=x+1
information.append("cond"+str(x)+": "+pv.get_text())
#localisation si condition courante
if search("CC", fichier) is not None:
# ville=soup1.select("[class~=current-city]")[0].get_text().split(",")[0]
ville=compile(" city: '(.*)',").search(str(soup1)).group(1)
longi=compile("lon: '(.*)',").search(str(soup1)).group(1)
lat=compile("lat: '(.*)',").search(str(soup1)).group(1)
information.append("ville: "+ville)
information.append("lat: "+lat)
information.append("long: "+longi)
#info alerte
response = None
while response is None:
try:
alerte_page=urlopen(adressWeb, timeout=10)
except (URLError) as error:
print("[\033[31mFAIL\033[0m] HTML ", error)
except timeout:
print("[\033[31mFAIL\033[0m] erreur timeout acces HTML")
else:
try:
alerte=alerte_page.read()
except (URLError) as error:
print("[\033[31mFAIL\033[0m] Lecture page ", error)
except timeout:
print("[\033[31mFAIL\033[0m] erreur timeout lecture page")
else:
alerte=BeautifulSoup(alerte)
alerte=alerte.select("[class~=lfs]")
if str(alerte) != "[]":
information.append("alerte: "+alerte[0].get_text().replace('\n', '').replace("\r", ""))
else:
information.append("alerte: RAS")
response = "ok"
if response is None:
sleep(10)
#info dans l'image
inf=inf[0].get_text()
cond=inf[:inf.find(findall('-?\d+', inf)[0])]
inf=inf.replace(cond, "")
infs=inf.split(" ")
information.append("cond:"+cond)
information.append("Temp: "+infs[0])
information.append("RealFeel: "+infs[2])
if search("Matin", fichier) is not None or search("AM", fichier) is not None or search("Soiree", fichier) is not None or search("Nuit", fichier) is not None:
infs=inf[0].get_text().split("\n")
i=0
infsc=["","","",""]
for inf in infs:
if inf!="":
infsc[i]=inf
i=i+1
information.append("cond:"+infsc[0])
information.append("max: "+infsc[1])
information.append("min: "+infsc[2].replace("Mn ", ""))
information.append("RealFeelmax: "+findall('-?\d+', infsc[3])[0])
information.append("RealFeelmin: "+findall('-?\d+', infsc[3])[1])
#info conditions générales
cc=current_balise.find_all('li')
for inf in cc:
inf=inf.get_text()
inf=inf.replace(compile('^ *').search(inf).group(0), "").replace("\n", "")
if search(":", inf) is not None:
information.append(inf)
elif search("Jour", fichier) is not None:
i=0
cc=current_balise.find_all('li')
for inf in cc:
inf=inf.get_text()
inf=inf.lstrip().replace("\n", "").replace(" \r", "")
if search(": ", inf) is not None:
i=i+1
if i <= 7:
inf=inf.replace(":", " jour:")
else:
inf=inf.replace(":", " nuit:")
information.append(inf)
else:
cc=current_balise.find_all('li')
for inf in cc:
inf=inf.get_text()
inf=inf.replace(compile('^ *').search(inf).group(0), "").replace("\n", "")
if search(":", inf) is not None:
information.append(inf)
information.append(str(int(time())))
else:
#recherche icones huit heures
rows = table[0].findAll('tr')
x=0
for tr in rows:
cols = tr.findAll('td')
texte_tr=tr.text.split("\n")[1].replace("\n", "")
i=0
for td in cols:
i=i+1
texte_bu = td.text.replace("\n", "").replace(chr(160), "")
if texte_bu != "" :
if texte_tr == chr(160) and x < len(cols):
information.append("Heure"+str(i)+": "+texte_bu)
x=x+1
elif texte_tr != chr(160):
information.append(texte_tr+str(i)+": "+texte_bu)
icone=table[0].find_all('div')
i=0
for ic in icone:
i=i+1
ico="icone"+str(i)+": "+str(ic).replace('<div class="icon i-', '')
fin=compile('">(.*)div>').search(ico).group(1)
information.append(ico.replace('">'+fin+'div>', ''))
if i == 8:
break
fiche = open(fichier, "w")
# fiche.write(current_balise.prettify())
information = '\n'.join(information)
fiche.write(information)
fiche.close()
collect()
#### fin Fonction de traitement des fichiers
#### Mise en tache de fond
def demonise(ent, id1, id2, huitHeures, nbJour, interval, nbFoisHuit, Id, demon):
dem=time()-(60*60)
misajour=1
while 1 :
heure=time()
if huitHeures=="oui":
x=0
while x<nbFoisHuit:
h=(x*8)+int(strftime('%H', localtime()))
x=x+1
traitement(ent+nb1+'/hourly-weather-forecast/'+nb2+'?hour='+str(h), repsauv+"/huitHeures"+str(x), repsauv)
print("[\033[32m OK \033[0m] huitHeures "+str(x))
if heure-dem >= 60*60 and MAJP=="oui":
x=0
while x<nbJour:
x=x+1
traitement(ent+nb1+'/daily-weather-forecast/'+nb2+"?day="+str(x), repsauv+"/Jour"+str(x), repsauv)
print("[\033[32m OK \033[0m] Jour "+str(x))
if matin=="oui":
traitement(ent+nb1+'/morning-weather-forecast/'+nb2+"?day="+str(x), repsauv+"/Matin"+str(x), repsauv)
print("[\033[32m OK \033[0m] Matin "+str(x))
if apresmidi=="oui":
traitement(ent+nb1+'/afternoon-weather-forecast/'+nb2+"?day="+str(x), repsauv+"/AM"+str(x), repsauv)
print("[\033[32m OK \033[0m] AM "+str(x))
if soiree=="oui":
traitement(ent+nb1+'/evening-weather-forecast/'+nb2+"?day="+str(x), repsauv+"/Soiree"+str(x), repsauv)
print("[\033[32m OK \033[0m] Soiree "+str(x))
if nuit=="oui":
traitement(ent+nb1+'/overnight-weather-forecast/'+nb2+"?day="+str(x), repsauv+"/Nuit"+str(x), repsauv)
print("[\033[32m OK \033[0m] Nuit "+str(x))
dem=heure
traitement(ent+nb1+'/current-weather/'+nb2, repsauv+"/CC", repsauv)
print("[\033[32m OK \033[0m] CC")
if externe is not None:
system(externe)
fin=time()
duree=fin-heure
if notifi == "oui":
notify2.init('Recmeteo.py')
if heure-dem == 0:
mess=notify2.Notification('Recmeteo.py v'+Version, 'Météo : mise à jour complète terminée\n en '+str(round(duree,2))+' secondes', 'dialog-information')
mess.show()
else:
if fullnotify == "oui" :
mess=notify2.Notification('Recmeteo.py v'+Version, 'Météo : mise à jour partielle terminée\n en '+str(round(duree,2))+' secondes', 'dialog-information')
mess.show()
start=heure
pause=60*interval-int(duree)
if pause < 0:
pause=interval
print("[\033[32m OK \033[0m] mise a jour en : "+str(duree))
if demon == "non":
print("[\033[33mINFO\033[0m] Mode démon non utilisé fin de recmeteo.py")
exit()
collect()
sleep(pause)
if Id != "sans":
if not path.exists("/proc/"+Id):
exit()
### Initialiation de DBus pour les notifications
if notifi == "oui":
import notify2
### Vérification répertoire
if not path.exists(repsauv):
makedirs(repsauv)
#### Lancement du script et initialisation de la tache de fond
nb1=findall('\d+', adressWeb)[0]
nb2=findall('\d+', adressWeb)[1]
ent=adressWeb[:adressWeb.find(nb1)]
fin=adressWeb.replace(ent+nb1, "")
fin=fin.replace(fin[:fin.find(nb2)]+nb2, "")
nb2=nb2+fin
print("[\033[33mINFO\033[0m] Recmeteo Version =", Version)
demonise(ent, nb1, nb2, huitHeures, nbJour, interval, nbFoisHuit, Id, demon)
recmeteo1.py passage a v1.32 pour le meteo fond d'ecran
#! /usr/bin/python3
# -*- coding: utf-8 -*-
# Par Didier-T Forum Ubuntu.fr
# Ajout notification par jpdipsy Forum Ubuntu.fr
# Ajout notification via DBus par ti_tux Forum Ubuntu.fr
# Ajout création repsauv si inexistant par jpdipsy Forum Ubuntu.fr
# Correction par daniel38100
from socket import timeout
from urllib.request import Request, urlopen, URLError
from os import path, makedirs, system
from time import time, sleep, strftime, localtime
from re import search, compile, findall
from sys import argv
from gc import collect
from bs4 import BeautifulSoup
from datetime import date, datetime
Version='1.32'
homedir = path.expanduser('~')
#### initialisation des variables
adressWeb="http://www.accuweather.com/fr/fr/belfort/133341/daily-weather-forecast/133341"
repsauv= "~/essais"
huitHeures="oui"
nbFoisHuit=1
matin="oui"
apresmidi="oui"
soiree="oui"
nuit="oui"
nbJour=1
interval=30
notifi="oui"
externe = None
Id = "sans"
demon = "non"
fullnotify = "non"
MAJP = "oui"
for a in argv:
if search("adressWeb=", a) is not None:
adressWeb=compile("adressWeb=(.*)").search(a).group(1)
if search("repsauv=", a) is not None:
repsauv=compile("repsauv=(.*)").search(a).group(1)
if search("huitHeures=", a) is not None:
huitHeures=compile("huitHeures=(.*)").search(a).group(1)
if search("nbJour=", a) is not None:
nbJour=compile("nbJour=(.*)").search(a).group(1)
if search("interval=", a) is not None:
interval=compile("interval=(.*)").search(a).group(1)
if search("notify=", a) is not None:
notifi=compile("notify=(.*)").search(a).group(1)
if search("notifyPartielle=", a) is not None:
fullnotify=compile("notifyPartielle=(.*)").search(a).group(1)
if search("matin=", a) is not None:
matin=compile("matin=(.*)").search(a).group(1)
if search("apresmidi=", a) is not None:
apresmidi=compile("apresmidi=(.*)").search(a).group(1)
if search("soiree=", a) is not None:
soiree=compile("soiree=(.*)").search(a).group(1)
if search("nuit=", a) is not None:
nuit=compile("nuit=(.*)").search(a).group(1)
if search("externe=", a) is not None:
externe=compile("externe=(.*)").search(a).group(1)
if search("nbFoisHuit=", a) is not None:
nbFoisHuit=compile("nbFoisHuit=(.*)").search(a).group(1)
if search("id=", a) is not None:
Id=compile("id=(.*)").search(a).group(1)
if search("demon=", a) is not None:
demon=compile("demon=(.*)").search(a).group(1)
if search("MAJP=", a) is not None:
MAJP=compile("MAJP=(.*)").search(a).group(1)
nbJour=int(nbJour)
interval=int(interval)
repsauv=repsauv.replace("~", homedir)
notifi=str.lower(notifi)
fullnotify==str.lower(fullnotify)
huitHeures=str.lower(huitHeures)
nbFoisHuit=int(nbFoisHuit)
MAJP=str(MAJP)
#### fin initialisation des variables
#### Fonction de traitement des fichiers
def traitement(adress, fichier, repsauv):
current_balise=None
x=1
user_agent = 'Mozilla/5.0 (X11; Linux x86_64)'
headers = { 'User-Agent' : user_agent }
while current_balise is None:
response = None
while response is None:
try:
html_page = urlopen(adress, timeout=10)
except (URLError) as error:
print("[\033[31mFAIL\033[0m] HTML ", error)
except timeout:
print("[\033[31mFAIL\033[0m] erreur timeout acces HTML")
else:
try:
currentCond=html_page.read()
except (URLError) as error:
print("[\033[31mFAIL\033[0m] Lecture page ", error)
except timeout:
print("[\033[31mFAIL\033[0m] erreur timeout lecture page")
else:
fiche = open("/tmp/page.html", "wb")
fiche.write(currentCond)
fiche.close()
response = "ok"
if response is None:
sleep(10)
fiche = open("/tmp/page.html", "r")
lines = fiche.readlines()
curr = {}
curr[0] = []
curr[1] = []
i=0
for line in lines:
curr[i].append(line)
if search("!-- /.feed-tabs --", line) is not None:
i=1
curr[0] = ''.join(curr[0])
curr[1] = ''.join(curr[1])
soup1 = BeautifulSoup(curr[0])
soup = BeautifulSoup(curr[1])
#si autres que huit heures
table=soup.find_all('table')
current_balise=soup.find(id="details")
information=[]
information.append("")
if search("huitHeures", fichier) is None:
# recherche vent
moment=adress.split('/')[7]
divs=current_balise.select("[class~=rt]")
if len(divs) == 0:
if moment == "current-weather" :
divs=current_balise.select("[class~=detail-tab-panel]")
else :
divs=current_balise.select("[class~=wind-box-lg]")
i=0
for div in divs:
i=i+1
if moment == "daily-weather-forecast" :
ventd=str(div.get_text().split("\n")[11]).split()[0]
ventf=str(div.get_text().split("\n")[11]).split()[1]
information.append("direction"+str(i)+": "+str(ventd))
information.append("vitesse"+str(i)+": "+str(ventf))
elif moment == "morning-weather-forecast" or moment == "afternoon-weather-forecast" or moment == "evening-weather-forecast" or moment == "overnight-weather-forecast" :
ventd=compile("var d = '(.*)';").search(str(div)).group(1).replace("W", "O")
ventf=compile("var s = '(.*)';").search(str(div)).group(1)
information.append("direction"+str(i)+": "+str(ventd))
information.append("vitesse"+str(i)+": "+str(ventf))
elif moment == "current-weather" :
ventd=str(str(str(div.select("[class~=more-info]")).split('\n')[2]).split('/')[6]).split('.')[0]
ventf=str(div.get_text()).split('\n')[29]
information.append("direction"+str(i)+": "+str(ventd))
information.append("vitesse"+str(i)+": "+str(ventf))
#info dans l'image
inf=current_balise.select("[class~=info]")
icone=current_balise.select("[class~=icon]")
i=0
#recherche icone
for ic in icone:
i=i+1
information.append("icone"+str(i)+": "+str(ic).replace('<div class="icon i-', '').replace('"></div>', ''))
i=0
#récupération date + historique
if search("Jour", fichier) is not None or search("CC", fichier) is not None:
histo=soup.find(id="feature-history")
#récupération date et heure
date=histo.find_all('th')
jour=compile("(.*)/(.*)/(.*)").search(date[4].get_text())
information.append("jour: "+jour.group(1))
information.append("mois: "+jour.group(2))
information.append("année: "+str(int(jour.group(3))+1))
#récupération historique
hi=histo.select("[class~=hi]")
for v in hi:
hivalue=v.get_text().split("\n")
information.append("maxjour: "+hivalue[2])
information.append("maxnormal: "+hivalue[3])
information.append("maxrecord: "+hivalue[4])
information.append("max1ans: "+hivalue[5])
lo=histo.select("[class~=last]")
for v in lo:
lovalue=v.get_text().split("\n")
information.append("minjour: "+lovalue[2])
information.append("minnormal: "+lovalue[3])
information.append("minrecord: "+lovalue[4])
information.append("min1ans: "+lovalue[5])
#info dans l'image
if search("Jour", fichier) is not None:
infs=inf[0].get_text().split("\n")
information.append("Tempjour: "+findall('-?\d+', infs[1])[0])
information.append("RealFeeljour: "+findall('-?\d+', infs[2])[0])
information.append("Précipitationsjour: "+findall('-?\d+', infs[3])[0])
infs=inf[1].get_text().split("\n")
information.append("Tempnuit: "+findall('-?\d+', infs[1])[0])
information.append("RealFeelnuit: "+findall('-?\d+', infs[2])[0])
information.append("Précipitationsnuit: "+findall('-?\d+', infs[3])[0])
lever_coucher=soup.select("[class~=time-period]")
i=0
for p in lever_coucher:
spans=p.find_all('span')
i=i+1
x=0
for span in spans:
if i == 1:
span_nom="Soleil "
else:
span_nom="Lune "
if search('start', str(span)) is not None:
information.append(span_nom+"lever: "+span.get_text())
if search('time', str(span)) is not None:
information.append(span_nom+"durée: "+span.get_text())
if search('finish', str(span)) is not None:
information.append(span_nom+"coucher: "+span.get_text())
p=current_balise.find_all('p')
i=0
x=0
for pv in p:
i=i+1
if i==5 or i==10:
x=x+1
information.append("cond"+str(x)+": "+pv.get_text())
#localisation si condition courante
if search("CC", fichier) is not None:
date=str(datetime.now()).split(' ')[1].split(':')
information.append("heure: "+date[0])
information.append("minute: "+date[1])
information.append("seconde: "+date[2].split('.')[0])
ville=compile(" city: '(.*)',").search(str(soup1)).group(1)
longi=compile("lon: '(.*)',").search(str(soup1)).group(1)
lat=compile("lat: '(.*)',").search(str(soup1)).group(1)
information.append("ville: "+ville)
information.append("lat: "+lat)
information.append("long: "+longi)
#info alerte
response = None
while response is None:
try:
alerte_page=urlopen(adressWeb, timeout=10)
except (URLError) as error:
print("[\033[31mFAIL\033[0m] HTML ", error)
except timeout:
print("[\033[31mFAIL\033[0m] erreur timeout acces HTML")
else:
try:
alerte=alerte_page.read()
except (URLError) as error:
print("[\033[31mFAIL\033[0m] Lecture page ", error)
except timeout:
print("[\033[31mFAIL\033[0m] erreur timeout lecture page")
else:
alerte=BeautifulSoup(alerte)
alerte=alerte.select("[class~=lfs]")
if str(alerte) != "[]":
information.append("alerte: "+alerte[0].get_text().replace('\n', '').replace("\r", ""))
else:
information.append("alerte: RAS")
response = "ok"
if response is None:
sleep(10)
#info dans l'image
inf=inf[0].get_text()
cond=inf[:inf.find(findall('-?\d+', inf)[0])]
inf=inf.replace(cond, "")
infs=inf.split(" ")
information.append("cond:"+cond)
information.append("Temp: "+infs[0])
information.append("RealFeel: "+infs[2])
if search("Matin", fichier) is not None or search("AM", fichier) is not None or search("Soiree", fichier) is not None or search("Nuit", fichier) is not None:
infs=inf[0].get_text().split("\n")
i=0
infsc=["","","",""]
for inf in infs:
if inf!="":
infsc[i]=inf
i=i+1
information.append("cond:"+infsc[0])
information.append("max: "+infsc[1])
information.append("min: "+infsc[2].replace("Mn ", ""))
information.append("RealFeelmax: "+findall('-?\d+', infsc[3])[0])
information.append("RealFeelmin: "+findall('-?\d+', infsc[3])[1])
#info conditions générales
cc=current_balise.find_all('li')
for inf in cc:
inf=inf.get_text()
inf=inf.replace(compile('^ *').search(inf).group(0), "").replace("\n", "")
if search(":", inf) is not None:
information.append(inf)
elif search("Jour", fichier) is not None:
i=0
cc=current_balise.find_all('li')
for inf in cc:
inf=inf.get_text()
inf=inf.lstrip().replace("\n", "").replace(" \r", "")
if search(": ", inf) is not None:
i=i+1
if i <= 7:
inf=inf.replace(":", " jour:")
else:
inf=inf.replace(":", " nuit:")
information.append(inf)
else:
cc=current_balise.find_all('li')
for inf in cc:
inf=inf.get_text()
inf=inf.replace(compile('^ *').search(inf).group(0), "").replace("\n", "")
if search(":", inf) is not None:
information.append(inf)
information.append(str(int(time())))
else:
#recherche icones huit heures
rows = table[0].findAll('tr')
x=0
for tr in rows:
cols = tr.findAll('td')
texte_tr=tr.text.split("\n")[1].replace("\n", "")
i=0
for td in cols:
i=i+1
texte_bu = td.text.replace("\n", "").replace(chr(160), "")
if texte_bu != "" :
if texte_tr == chr(160) and x < len(cols):
information.append("Heure"+str(i)+": "+texte_bu)
x=x+1
elif texte_tr != chr(160):
information.append(texte_tr+str(i)+": "+texte_bu)
icone=table[0].find_all('div')
i=0
for ic in icone:
i=i+1
ico="icone"+str(i)+": "+str(ic).replace('<div class="icon i-', '')
fin=compile('">(.*)div>').search(ico).group(1)
information.append(ico.replace('">'+fin+'div>', ''))
if i == 8:
break
fiche = open(fichier, "w")
# fiche.write(current_balise.prettify())
information = '\n'.join(information)
fiche.write(information)
fiche.close()
collect()
#### fin Fonction de traitement des fichiers
#### Mise en tache de fond
def demonise(ent, id1, id2, huitHeures, nbJour, interval, nbFoisHuit, Id, demon):
dem=time()-(60*60)
misajour=1
while 1 :
date=str(datetime.now()).split(' ')[1].split(':')
heure=time()
if huitHeures=="oui":
x=0
while x<nbFoisHuit:
h=(x*8)+int(strftime('%H', localtime()))
x=x+1
traitement(ent+nb1+'/hourly-weather-forecast/'+nb2+'?hour='+str(h), repsauv+"/huitHeures"+str(x), repsauv)
print("[\033[32m OK \033[0m] huitHeures "+str(x))
if heure-dem >= 60*60 and MAJP=="oui":
x=0
while x<nbJour:
x=x+1
traitement(ent+nb1+'/daily-weather-forecast/'+nb2+"?day="+str(x), repsauv+"/Jour"+str(x), repsauv)
print("[\033[32m OK \033[0m] Jour "+str(x))
if matin=="oui":
traitement(ent+nb1+'/morning-weather-forecast/'+nb2+"?day="+str(x), repsauv+"/Matin"+str(x), repsauv)
print("[\033[32m OK \033[0m] Matin "+str(x))
if apresmidi=="oui":
traitement(ent+nb1+'/afternoon-weather-forecast/'+nb2+"?day="+str(x), repsauv+"/AM"+str(x), repsauv)
print("[\033[32m OK \033[0m] AM "+str(x))
if soiree=="oui":
traitement(ent+nb1+'/evening-weather-forecast/'+nb2+"?day="+str(x), repsauv+"/Soiree"+str(x), repsauv)
print("[\033[32m OK \033[0m] Soiree "+str(x))
if nuit=="oui":
traitement(ent+nb1+'/overnight-weather-forecast/'+nb2+"?day="+str(x), repsauv+"/Nuit"+str(x), repsauv)
print("[\033[32m OK \033[0m] Nuit "+str(x))
dem=heure
traitement(ent+nb1+'/current-weather/'+nb2, repsauv+"/CC", repsauv)
print("[\033[32m OK \033[0m] CC")
try :
system("lunaison.py")
print("[\033[32m OK \033[0m] Lunaison")
except (URLError) as error:
print("[\033[31mFAIL\033[0m] Lunaison")
if externe is not None:
system(externe)
fin=time()
duree=fin-heure
if notifi == "oui":
notify2.init('Recmeteo.py')
if heure-dem == 0:
mess=notify2.Notification('Accuweather', "Mise a jour complete à "+str(date[0])+":"+str(date[1])+":"+str(date[2]).split('.')[0]+" en "+str(round(duree,2)).replace('.','s')+" sec", '/opt/Accuweather/icones/accuweather-logo1.png')
mess.show()
print("[\033[32m OK \033[0m] Mise a jour complete à "+str(date[0])+":"+str(date[1])+":"+str(date[2]).split('.')[0]+" en "+str(round(duree,2)).replace('.','s'))
else:
if fullnotify == "oui" :
mess=notify2.Notification('Accuweather', "Mise a jour partiel à "+str(date[0])+":"+str(date[1])+":"+str(date[2]).split('.')[0]+" en "+str(round(duree,2)).replace('.','s'), '/opt/Accuweather/icones/accuweather-logo1.png')
mess.show()
print("[\033[32m OK \033[0m] Mise a jour partiel à "+str(date[0])+":"+str(date[1])+":"+str(date[2]).split('.')[0]+" en "+str(round(duree,2)).replace('.','s'))
start=heure
pause=60*interval-int(duree)
if pause < 0:
pause=interval
if demon == "non":
# print("[\033[33mINFO\033[0m] Mode démon non utilisé fin de recmeteo.py")
exit()
collect()
sleep(pause)
if Id != "sans":
if not path.exists("/proc/"+Id):
exit()
### Initialiation de DBus pour les notifications
if notifi == "oui":
import notify2
### Vérification répertoire
if not path.exists(repsauv):
makedirs(repsauv)
#### Lancement du script et initialisation de la tache de fond
nb1=findall('\d+', adressWeb)[0]
nb2=findall('\d+', adressWeb)[1]
ent=adressWeb[:adressWeb.find(nb1)]
fin=adressWeb.replace(ent+nb1, "")
fin=fin.replace(fin[:fin.find(nb2)]+nb2, "")
nb2=nb2+fin
#print("[\033[33mINFO\033[0m] Recmeteo Version =", Version)
demonise(ent, nb1, nb2, huitHeures, nbJour, interval, nbFoisHuit, Id, demon)
Dernière modification par daniel38100 (Le 30/10/2015, à 09:04)
Hors ligne
#1230 Le 30/10/2015, à 10:02
- seelord
Re : [Conky] Alternative à weather.com (3)
Daniel,
Merci bien pour le recmeteo.py, pour moi c'est parfait vu que je n'utilise que la météo du jour et sans fond d'écran
Cordialement.
Edit: Bon ça merdouille un ti peu encore ça se met pas à jour, faudrait que Didier-T bidouille le bidule
Edit2: Bon ça va mieux ça se met à jour, juste penser mettre l'adresse de votre météo dans le fichier "meteo.cfg":
http//www.accuweather.com/fr/fr/Vous/xxxxxx/daily-weather-forecast/xxxxxx
Dernière modification par seelord (Le 30/10/2015, à 16:24)
Rien ne sert d'avoir une grosse tête, suffit juste de mettre les pieds dans le plat...^^
Hors ligne
#1231 Le 22/11/2015, à 13:15
- Didier-T
Re : [Conky] Alternative à weather.com (3)
Bonjour a tous,
j'ai reçus un email hier matin de Yvance77, me signalant le soucis que vous rencontriez avec meteo lua.
Les notifications du site n'avaient pas fonctionnées, ou étaient passées en spam ???
le pack est corrigé mais certaines informations sont devenus trop chiante à extraire.
dans condition courante le vent n'est plus renseigné il y a des valeurs bidon a la place 0 km/h et direction Nord.
le soucis que je rencontre est qu'ils ont fait pleins de modification sur le site accuweather et ceci sur plusieurs page, tout est géré sauf sur la page de condition courante la direction du vent n'est simplement plus renseignée , et la vitesse du vent est placé dans un coins étrange, rendant son extraction difficile. N'ayant pas beaucoup de temps libre en ce moment je ne me pencherais pas trop sur ce soucis, si certains ont des idées pour récupérer les informations qu'ils n’hésite pas
A+,
Didier.
Hors ligne
#1232 Le 23/11/2015, à 11:22
- ragamatrix
Re : [Conky] Alternative à weather.com (3)
Salut,
Effectivement la récupération des données à changé, j'ai un peu participé à cette alternative, cela pourrait peut-être vous intéresser si vous recherchez un conky accuweather fonctionnel.
Hors ligne
#1233 Le 14/12/2015, à 16:58
- loutch
Re : [Conky] Alternative à weather.com (3)
Hello ayant des problèmes avec les template 3 du conky-meteo de Didier-t (accuweather.com a surement de nouveau changé )j'ai trouvé un conky-lune à prendre
ici: [url]http://[Merci de relire les règles]/4_2-6-15[/url] du site "bunsenlabs" à décompresser dans votre home.
J'y ais intégré du lua (pour ceux qui on un fond d'écran clair) les images passent mieux et traduit en françois .
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_argb_visual yes
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_pager
double_buffer yes
minimum_size 410 250
maximum_width 410
text_buffer_size 2048
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color white #dbc38f
default_outline_color black
alignment tr
gap_x 00
gap_y 620
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
# Fonctionne uniquement avec les polices Fixes
#use_spacer yes
imlib_cache_size 0
uppercase no
lua_load ~/.conky/lua/image.lua
TEXT
${texeci 500 bash $HOME/4_Moon/moon_MoonGiant}
${voffset 90}${alignc 10}${execpi 600 sed -n '7p' $HOME/4_Moon/raw | awk '{print $1}'}
${alignc 10}${execpi 600 sed -n '7p' $HOME/4_Moon/raw | awk '{print $2}'}
${alignc 10}${execpi 600 sed -n '1p' $HOME/4_Moon/raw}
${voffset -60}${goto 25}${execi 3600 echo `date --date="-2 day" | awk '{print $3" "$2}'`}\
${goto 92}${execi 3600 echo `date --date="-1 day" | awk '{print $3" "$2}'`}\
${goto 277}${execi 3600 echo `date --date="+1 day" | awk '{print $3" "$2}'`}\
${goto 350}${execi 3600 echo `date --date="+2 day" | awk '{print $3" "$2}'`}
${voffset -5}${goto 25}${execpi 600 sed -n '19p' $HOME/4_Moon/raw | awk '{print $1}'}\
${goto 92}${execpi 600 sed -n '27p' $HOME/4_Moon/raw | awk '{print $1}'}\
${goto 277}${execpi 600 sed -n '35p' $HOME/4_Moon/raw | awk '{print $1}'}\
${goto 350}${execpi 600 sed -n '43p' $HOME/4_Moon/raw | awk '{print $1}'}
${voffset -5}${goto 20}${execpi 600 sed -n '19p' $HOME/4_Moon/raw | awk '{print $2}'}\
${goto 87}${execpi 600 sed -n '27p' $HOME/4_Moon/raw | awk '{print $2}'}\
${goto 272}${execpi 600 sed -n '35p' $HOME/4_Moon/raw | awk '{print $2}'}\
${goto 347}${execpi 600 sed -n '43p' $HOME/4_Moon/raw | awk '{print $2}'}
${voffset -5}${goto 30}${execpi 600 sed -n '13p' $HOME/4_Moon/raw}\
${goto 100}${execpi 600 sed -n '21p' $HOME/4_Moon/raw}\
${goto 280}${execpi 600 sed -n '29p' $HOME/4_Moon/raw}\
${goto 355}${execpi 600 sed -n '37p' $HOME/4_Moon/raw}
${alignc}Details
Visibilitée: ${execpi 600 sed -n '1p' $HOME/4_Moon/raw} % ${goto 250}Age lune: ${execpi 600 sed -n '5p' $HOME/4_Moon/raw} jours
Angle soleil: ${execpi 600 sed -n '2p' $HOME/4_Moon/raw} ° ${goto 250}Angle lune: ${execpi 600 sed -n '6p' $HOME/4_Moon/raw} °
Distance soleil: ${execpi 600 sed -n '3p' $HOME/4_Moon/raw} kms ${goto 250}Distance lune: ${execpi 600 sed -n '4p' $HOME/4_Moon/raw} kms
${lua fDrawImage ~/4_Moon/-2.png 10 65 60 60}
${lua fDrawImage ~/4_Moon/-1.png 80 65 60 60}
${lua fDrawImage ~/4_Moon/0.png 157 35 90 90}
${lua fDrawImage ~/4_Moon/1.png 265 65 60 60}
${lua fDrawImage ~/4_Moon/2.png 340 65 60 60}
${voffset -500}
le moon_MoonGiant (rendu éxécutable ) aussi en françois:
#!/bin/bash
#function: moonrise_set
moonrise_set () {
case "$1" in
"FirstQuarter")
echo "Noon/Midnight"
cp $HOME/4_Moon/riseicons/rise_FirstQuarter.jpg $HOME/4_Moon/rise.jpg
;;
"FullMoon")
echo "6PM/6AM"
cp $HOME/4_Moon/riseicons/rise_FullMoon.jpg $HOME/4_Moon/rise.jpg
;;
"LastQuarter")
echo "Midnight/Noon"
p $HOME/4_Moon/riseicons/rise_LastQuarter.jpg $HOME/4_Moon/rise.jpg
;;
"NewMoon")
echo "6AM/6PM"
cp $HOME/4_Moon/riseicons/rise_NewMoon.jpg $HOME/4_Moon/rise.jpg
;;
"WaningCrescent")
echo "3AM/3PM"
cp $HOME/4_Moon/riseicons/rise_WaningCrescent.jpg $HOME/4_Moon/rise.jpg
;;
"WaningGibbous")
echo "9PM/9AM"
cp $HOME/4_Moon/riseicons/rise_WaningGibbous.jpg $HOME/4_Moon/rise.jpg
;;
"WaxingCrescent")
echo "9AM/9PM"
cp $HOME/4_Moon/riseicons/rise_WaxingCrescent.jpg $HOME/4_Moon/rise.jpg
;;
"WaxingGibbous")
echo "3PM/3AM"
cp $HOME/4_Moon/riseicons/rise_WaxingGibbous.jpg $HOME/4_Moon/rise.jpg
;;
*)
echo "Unavailable"
esac
}
kill -STOP $(pidof conky)
killall wget
#put your hemisphere here: north or south
hemisphere=north
wget -O $HOME/4_Moon/raw "http://www.moongiant.com/phase/today"
rm $HOME/4_Moon/*.png $HOME/4_Moon/*.jpg
sed -i -e '/^ *$/d' -e 's/^ *//g' $HOME/4_Moon/raw
sed -i '/var jArray=\|"todayMoonContainer"\|"moonNotToday"/!d' $HOME/4_Moon/raw
sed -i -e '/var jArray/s/","/\n/g' -e 's/<span>\|<b>\|<\\\/span>\|<\\\/b>\|\\n//g' /$HOME/4_Moon/raw
sed -i 's/"\].*\[\"/\n/g' /$HOME/4_Moon/raw
sed -i '/var jArray/d' /$HOME/4_Moon/raw
sed -i -e 's/"\]};//g' -e 's/^.*today_phase\///g' -e 's/\.jpg.*$//g' /$HOME/4_Moon/raw
sed -i -e 's/^small\///g' -e 's/\.png.*$//g' /$HOME/4_Moon/raw
sed -i 's/Illumination: \|Sun Angle: \|Sun Distance: \|Moon Distance: \|Moon Age: \|Moon Angle: //g' /$HOME/4_Moon/raw
phase=$(sed -n 7p $HOME/4_Moon/raw|sed 's/ //')
mrise_mset=$(moonrise_set $phase)
sed -i 7a$(moonrise_set $phase) /$HOME/4_Moon/raw
#Day before Yesterday
img_in=$(sed -n 44p $HOME/4_Moon/raw)
cp $HOME/4_Moon/moongiant_icons_$hemisphere/$img_in.png $HOME/4_Moon/-2.png
#Yesterday
img_in=$(sed -n 45p $HOME/4_Moon/raw)
cp $HOME/4_Moon/moongiant_icons_$hemisphere/$img_in.png $HOME/4_Moon/-1.png
#Today
img_in=$(sed -n 46p $HOME/4_Moon/raw)
cp $HOME/4_Moon/moongiant_icons_$hemisphere/$img_in.png $HOME/4_Moon/0.png
#Tomorrow
img_in=$(sed -n 47p $HOME/4_Moon/raw)
cp $HOME/4_Moon/moongiant_icons_$hemisphere/$img_in.png $HOME/4_Moon/1.png
#Day after Tomorrow
img_in=$(sed -n 48p $HOME/4_Moon/raw)
cp $HOME/4_Moon/moongiant_icons_$hemisphere/$img_in.png $HOME/4_Moon/2.png
sed -i -e 's/New Moon/Nouvelle Lune/g' -e 's/Waxing Crescent/Lune Montante/g' -e 's/First Quarter/Premier Quartier/g' -e 's/Waxing Gibbous/Gibeuse Croissante/g' -e 's/Full Moon/Pleine Lune/g' -e 's/Waning Gibbous/Gibeuse Décroissante/g' -e 's/Last Quarter/Dernier Quartier/g' -e 's/Waning Crescent/Lune Déscendante/g' /$HOME/4_Moon/raw
kill -CONT $(pidof conky)
@+
Dernière modification par loutch (Le 14/12/2015, à 17:07)
Hors ligne
#1234 Le 14/12/2015, à 17:20
- jibel
Re : [Conky] Alternative à weather.com (3)
@loutch
Salut,
Plutôt aller voir ici :
http://goodies.xfce.org/projects/panel- … her-plugin
ce qui serait plus efficace qu'autre chose ? non? normalement ceci devrait être installé dans votre OS , lequel ?
Plus grande est la face, plus grand est le dos!
Toutes les fautes de frappe, d'orthographe, de grammaire et de syntaxe ci-dessus, sont la propriété intellectuelle de l'auteur. Elles doivent être reproduites et même corrigées sans l'accord préalable du susdit et toc !
Mint 21.1,Voyager20.04 et 22.04,Ubuntu 22.04,Emmabuntus 1.Buster, Debian 12.buster, Hybryde 14.04, Pas d'OS intermédiaire ! PC Medion AKOYA DD 1T + 2 .
Hors ligne
#1235 Le 14/12/2015, à 17:33
- loutch
Re : [Conky] Alternative à weather.com (3)
@ jibel
Non pas installé ma distro principale étant Mageia 5 en KDE mais intéressant pour ma Rafaela en xfce ,merci et
@+
Hors ligne
#1236 Le 14/12/2015, à 18:01
- jibel
Re : [Conky] Alternative à weather.com (3)
@ jibel
Non pas installé ma distro principale étant Mageia 5 en KDE mais intéressant pour ma Rafaela en xfce ,merci et
@+
Effectivement , avec xfce tu sais installer ce xfce weather facilement sans PB mais avec la mageia KDE ? peut -etre quand utilisant le TdeBord de kde il y a la possibilité d'avoir une méteo a rajouter sur le bureau, je crois....
Plus grande est la face, plus grand est le dos!
Toutes les fautes de frappe, d'orthographe, de grammaire et de syntaxe ci-dessus, sont la propriété intellectuelle de l'auteur. Elles doivent être reproduites et même corrigées sans l'accord préalable du susdit et toc !
Mint 21.1,Voyager20.04 et 22.04,Ubuntu 22.04,Emmabuntus 1.Buster, Debian 12.buster, Hybryde 14.04, Pas d'OS intermédiaire ! PC Medion AKOYA DD 1T + 2 .
Hors ligne
#1237 Le 15/12/2015, à 16:49
#1238 Le 16/12/2015, à 15:49
- jlfh0816
Re : [Conky] Alternative à weather.com (3)
@Ioutch
Bonjour,
Je trouve l'ensemble de ton conky (celui à droite) vraiment superbe, et plus spécialement le baromètre (il fonctionne bien ? ).
Comme tu as beaucoup posté dans plusieurs topics, je n'arrive pas à retrouver les différents fichiers que tu combines pour parvenir à ce beau résultat. Accepterais-tu de les communiquer ou d'indiquer à quels posts se référer ?
Un grand merci d'avance,
Xubuntu - Voyager 18.04 et 22.04
Hors ligne
#1239 Le 16/12/2015, à 20:39
- loutch
Re : [Conky] Alternative à weather.com (3)
Hello
Oui le barometre fonctionne bien,c'est un mix du pack de Didier-t avec les icones du conkyforecast (c'est pas obligatoire celle de Didier fonctionne aussi très bien) ainsi que du lua pour les baro . Les adresses sont @ la fin du post .
le conkyrc
background yes
use_xft yes
xftfont URW Chancery L:style=Bold:size=10
xftalpha 1
imlib_cache_size 0
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 200 700
maximum_width 200
text_buffer_size 2048
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color ffffff #ffd579
default_outline_color white
alignment top_right
gap_x 00
gap_y 00
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
# -- 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/blanc/baro.lua
lua_draw_hook_pre main
lua_load ~/.conky/blanc/textwriting.lua
lua_draw_hook_post draw_text
#lua_load ~/.conky/draw_bg/draw_bg.lua${lua conky_draw_bg 20 0 10 1300 150 0x000000 0.5}
TEXT
${execi 500 $HOME/4_Moon/moon}${texeci 500 bash $HOME/4_Moon/moon_MoonGiant}${template1 Maj}${voffset 100}${goto 90}${template1 Pression 1} mb
${voffset 20}${goto 30}Temp ${goto 165}Res
${goto 35}${template1 TempAct} ° ${goto 170}${template1 TempRes} °
${voffset 10}${goto 40}Dernière mise à jour : ${template1 Heure} h ${template1 Minute}
${alignc}${template1 CondMeteo}
${voffset 80}${goto 25}${template1 huitHeures_Heure 1} h ${goto 75}${template1 huitHeures_Heure 2} h ${goto 125}${template1 huitHeures_Heure 3} h ${goto 175}${template1 huitHeures_Heure 4} h
${goto 25}${template1 huitHeures_Temp 1}° ${goto 75}${template1 huitHeures_Temp 2}° ${goto 125}${template1 huitHeures_Temp 3}° ${goto 175}${template1 huitHeures_Temp 4}°
${voffset 25}${goto 15}${template1 Jour %a_%d 2} ${goto 65}${template1 Jour %a_%d 3} ${goto 115}${template1 Jour %a_%d 4} ${goto 165}${template1 Jour %a_%d 5}
${goto 15}${template1 Nuit_Temp 2}°/${template1 Jour_Temp 2}° ${goto 65}${template1 Nuit_Temp 3}°/${template1 Jour_Temp 3}° ${goto 115}${template1 Nuit_Temp 4}°/${template1 Jour_Temp 4}° ${goto 165}${template1 Nuit_Temp 5}°/${template1 Jour_Temp 5}°
${voffset 35}${alignc}Indice Uv : ${template1 Uv}
${alignc}Durée Enso : ${template1 HDureeJour} h ${template1 MDureeJour}
${voffset 30}${goto 15}Heu.Lev. ${goto 160}Heu.Cou.
${goto 22}${template1 HLeverSoleil}-${template1 MLeverSoleil} ${goto 165}${template1 HCoucherSoleil}-${template1 MCoucherSoleil}
${voffset 00}${alignc}Phase : ${execpi 600 sed -n '7p' $HOME/4_Moon/raw}
${alignc}Visibilitée : ${execpi 600 sed -n '1p' $HOME/4_Moon/raw}
${alignc}Distance : ${execpi 600 sed -n '4p' $HOME/4_Moon/raw} km
${goto 70}Age : ${execpi 600 sed -n '5p' $HOME/4_Moon/raw} jours
${voffset 60}${goto 35}Demain ${goto 135}Après-demain
${goto 25}${execpi 600 sed -n '35p' $HOME/4_Moon/raw} ${goto 125}${execpi 600 sed -n '43p' $HOME/4_Moon/raw}
${goto 25}Visibilitée : ${execpi 600 sed -n '29p' $HOME/4_Moon/raw} ${goto 125}Visibilitée : ${execpi 600 sed -n '37p' $HOME/4_Moon/raw}
${voffset -5}${goto 100}Alerte
${alignc}${template1 Alerte1}
${goto 20}${template1 Alerte2}
#### icones barometre ####
${lua fDrawImage ~/.conky/conky-meteo/meteo_lua_2/icones/icone_forecast/00.png 20 120 30 20}
${lua fDrawImage ~/.conky/conky-meteo/meteo_lua_2/icones/icone_forecast/12.png 20 90 30 20}
${lua fDrawImage ~/.conky/conky-meteo/meteo_lua_2/icones/icone_forecast/09.png 35 60 30 20}
${lua fDrawImage ~/.conky/conky-meteo/meteo_lua_2/icones/icone_forecast/39.png 70 30 30 20}
${lua fDrawImage ~/.conky/conky-meteo/meteo_lua_2/icones/icone_forecast/28.png 130 30 30 20}
${lua fDrawImage ~/.conky/conky-meteo/meteo_lua_2/icones/icone_forecast/30.png 155 60 30 20}
${lua fDrawImage ~/.conky/conky-meteo/meteo_lua_2/icones/icone_forecast/34.png 170 90 30 20}
${lua fDrawImage ~/.conky/conky-meteo/meteo_lua_2/icones/icone_forecast/36.png 170 120 30 20}
#### icone condition actuelle ####
${template2 IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 80 250 70 70}
#### icones prochaines quatre heures ####
${template2 huitHeures_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 10 350 40 40 1}
${template2 huitHeures_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 60 350 40 40 2}
${template2 huitHeures_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 110 350 40 40 3}
${template2 huitHeures_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 160 350 40 40 4}
#### icones prochains quatre jours ####
${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 10 410 40 40 2}
${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 60 410 40 40 3}
${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 110 410 40 40 4}
${template2 Jour_IconeM ~/.conky/conky-meteo/meteo_lua_2/icones 160 410 40 40 5}
#### icone soleil ####
${lua fDrawImage ~/.conky/conky-meteo/meteo_lua_2/icones/icone_forecast/36.png 80 490 70 70}
#### icone lune ####
${lua fDrawImage $HOME/4_Moon/0.png 80 630 70 70}
${lua fDrawImage $HOME/4_Moon/1.png 40 650 35 35}
${lua fDrawImage $HOME/4_Moon/2.png 155 650 35 35}
le baro.lua pour le barmetre
--==============================================================================
-- baro.lua
--
-- author : SLK-adapted by shamen456
-- version : v2011-06-13
-- license : Distributed under the terms of GNU GPL version 2 or later
--
--==============================================================================
require 'cairo'
--------------------------------------------------------------------------------
-- gauge DATA
gauge = {
{
name='cpu', arg='', max_value=1060, sub_value=960,
x=110, y=110,
graph_radius=40,
graph_thickness=5,
graph_start_angle=235,
graph_unit_angle=2.5, graph_unit_thickness=2.,
graph_bg_colour=0xFFFFFF, graph_bg_alpha=0.4,
graph_fg_colour=0xB1ADA7, graph_fg_alpha=0,
hand_fg_colour=0x000000, hand_fg_alpha=.0,
txt_radius=0,
txt_weight=0, txt_size=10.0,
txt_fg_colour=0xFFFFFF, txt_fg_alpha=0,
graduation_radius=40,
graduation_thickness=8, graduation_mark_thickness=2,
graduation_unit_angle=18,
graduation_fg_colour=0x4F4B41, graduation_fg_alpha=0,
caption='',
caption_weight=1, caption_size=8.0,
caption_fg_colour=0xFFFFFF, caption_fg_alpha=0.8,
},
{
name='lua', arg='Meteo_Pression', max_value=1050, sub_value=950,
x=110, y=110,
graph_radius=30,
graph_thickness=50,
graph_start_angle=260,
graph_unit_angle=2.1, graph_unit_thickness=2.,
graph_bg_colour=0xFFFFFF, graph_bg_alpha=0.0,
graph_fg_colour=0xB1ADA7, graph_fg_alpha=0,
hand_fg_colour=0xFF0000, hand_fg_alpha=0.8,
txt_radius=20,
txt_weight=0, txt_size=10.0,
txt_fg_colour=0xFFFFFF, txt_fg_alpha=0,
graduation_radius=32,
graduation_thickness=6, graduation_mark_thickness=2,
graduation_unit_angle=18,
graduation_fg_colour=0x4F4B41, graduation_fg_alpha=1,
caption='',
caption_weight=1, caption_size=8.0,
caption_fg_colour=0xFFFFFF, caption_fg_alpha=0.1,
},
{
name='lua', arg='Meteo_TempRes',
max_value=60, sub_value=-30,--valeur de depart du graphe
x=110, y=160,
graph_radius=20,
graph_thickness=40,
graph_start_angle=75,
graph_unit_angle=2.33, graph_unit_thickness=1.5,
graph_bg_colour=0xFFFFFF, graph_bg_alpha=0,
graph_fg_colour=0xB1ADA7, graph_fg_alpha=0,
hand_fg_colour=0xFF0000, hand_fg_alpha=0,
txt_radius=18,
txt_weight=1, txt_size=10.0,
txt_fg_colour=0xC0C0FF, txt_fg_alpha=0,
graduation_radius=20,
graduation_thickness=8, graduation_mark_thickness=2,
graduation_unit_angle=11.6,
graduation_fg_colour=0xffffff, graduation_fg_alpha=0.9,
caption='',
caption_weight=1, caption_size=8.0,
caption_fg_colour=0xFFFFFF, caption_fg_alpha=0.3,
},
{
name='lua', arg='Meteo_TempAct', max_value=60, sub_value=-30,
x=110, y=160,
graph_radius=20,
graph_thickness=40,
graph_start_angle=75,
graph_unit_angle=2.33, graph_unit_thickness=1.5,
graph_bg_colour=0xFFFFFF, graph_bg_alpha=0.,
graph_fg_colour=0xB1ADA7, graph_fg_alpha=0,
hand_fg_colour=0xff0000, hand_fg_alpha=1,
txt_radius=30,
txt_weight=1, txt_size=10.0,
txt_fg_colour=0xED7F77, txt_fg_alpha=0,
graduation_radius=22,
graduation_thickness=14, graduation_mark_thickness=2,
graduation_unit_angle=23.3,
graduation_fg_colour=0xffffff, graduation_fg_alpha=1,
caption='',
caption_weight=1, caption_size=8.0,
caption_fg_colour=0xFFFFFF, caption_fg_alpha=0.9,
},
}
-------------------------------------------------------------------------------
-- rgb_to_r_g_b
-- converts color in hexa to decimal
--
function rgb_to_r_g_b(colour, alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
-------------------------------------------------------------------------------
-- angle_to_position
-- convert degree to rad and rotate (0 degree is top/north)
--
function angle_to_position(start_angle, current_angle)
local pos = current_angle + start_angle
return ( ( pos * (2 * math.pi / 360) ) - (math.pi / 2) )
end
-------------------------------------------------------------------------------
-- draw_gauge_ring
-- displays gauges
--
function draw_gauge_ring(display, data, value)
local max_value = data['max_value']-data['sub_value']
local sub_value = data['sub_value']
local x, y = data['x'], data['y']
local graph_radius = data['graph_radius']
local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
local graph_start_angle = data['graph_start_angle']
local graph_unit_angle = data['graph_unit_angle']
local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']
local hand_fg_colour, hand_fg_alpha = data['hand_fg_colour'], data['hand_fg_alpha']
local graph_end_angle = (max_value * graph_unit_angle) % 360
-- background ring
cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, 0), angle_to_position(graph_start_angle, graph_end_angle))
cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
cairo_set_line_width(display, graph_thickness)
cairo_stroke(display)
-- arc of value
local val = (value-sub_value) % (max_value + 1)
local start_arc = 0
local stop_arc = 0
local i = 1
while i <= val do
start_arc = (graph_unit_angle * i) - graph_unit_thickness
stop_arc = (graph_unit_angle * i)
cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
cairo_set_source_rgba(display, rgb_to_r_g_b(graph_fg_colour, graph_fg_alpha))
cairo_stroke(display)
i = i + 1
end
local angle = start_arc
-- hand
start_arc = (graph_unit_angle * val) - (graph_unit_thickness * 2)
stop_arc = (graph_unit_angle * val)
cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
cairo_set_source_rgba(display, rgb_to_r_g_b(hand_fg_colour, hand_fg_alpha))
cairo_stroke(display)
-- graduations marks
local graduation_radius = data['graduation_radius']
local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
local graduation_unit_angle = data['graduation_unit_angle']
local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
local nb_graduation = graph_end_angle / graduation_unit_angle
local i = 0
while i < nb_graduation do
cairo_set_line_width(display, graduation_thickness)
start_arc = (graduation_unit_angle * i) - (graduation_mark_thickness / 2)
stop_arc = (graduation_unit_angle * i) + (graduation_mark_thickness / 2)
cairo_arc(display, x, y, graduation_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
cairo_stroke(display)
cairo_set_line_width(display, graph_thickness)
i = i + 1
end
end
-- text
local txt_radius = data['txt_radius']
local txt_weight, txt_size = data['txt_weight'], data['txt_size']
local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
local movex = txt_radius * math.cos(angle_to_position(graph_start_angle, angle))
local movey = txt_radius * math.sin(angle_to_position(graph_start_angle, angle))
cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight)
cairo_set_font_size (display, txt_size)
cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha))
cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3)
cairo_show_text (display, value)
cairo_stroke (display)
-- caption
local caption = data['caption']
local caption_weight, caption_size = data['caption_weight'], data['caption_size']
local caption_fg_colour, caption_fg_alpha = data['caption_fg_colour'], data['caption_fg_alpha']
local tox = graph_radius * (math.cos((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
local toy = graph_radius * (math.sin((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, caption_weight);
cairo_set_font_size (display, caption_size)
cairo_set_source_rgba (display, rgb_to_r_g_b(caption_fg_colour, caption_fg_alpha))
cairo_move_to (display, x + tox + 5, y + toy + 1)
-- bad hack but not enough time !
if graph_start_angle < 105 then
cairo_move_to (display, x + tox - 30, y + toy + 1)
end
cairo_show_text (display, caption)
cairo_stroke (display)
end
-------------------------------------------------------------------------------
-- go_gauge_rings
-- loads data and displays gauges
--
function go_gauge_rings(display)
local function load_gauge_rings(display, data)
local str, value = '', 0
str = string.format('${%s %s}',data['name'], data['arg'])
str = conky_parse(str)
value = tonumber(str)
draw_gauge_ring(display, data, value)
end
for i in pairs(gauge) do
load_gauge_rings(display, gauge[i])
end
end
-------------------------------------------------------------------------------
-- MAIN
function conky_main()
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)
local display = cairo_create(cs)
local updates = conky_parse('${updates}')
update_num = tonumber(updates)
if update_num > 5 then
go_gauge_rings(display)
end
end
le textwriting.lua aussi pour le baro
--[[circlewriting by mrpeachy (2010)]]
require 'cairo'
function addzero100(num)
if tonumber(num) < 10 then
return "00" .. num
elseif tonumber(num) <100 then
return "0" .. num
else
return num
end
end
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 circlewriting(cr, text, font, fsize, radi, horiz, verti, tred, tgreen, tblue, talpha, start, finish, var1)
local inum=string.len(text)
range=finish
deg=(finish-start)/(inum-1)
degrads=1*(math.pi/180)
local textcut=string.gsub(text, ".", "%1@@@")
texttable=string.split(textcut, "@@@")
for i = 1,inum do
ival=i
interval=(degrads*(start+(deg*(i-1))))+var1
interval2=degrads*(start+(deg*(i-1)))
txs=0+radi*(math.sin(interval))
tys=0-radi*(math.cos(interval))
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, tred, tgreen, tblue, talpha);
cairo_move_to (cr, txs+horiz, tys+verti);
cairo_rotate (cr, interval2)
cairo_show_text (cr, (texttable[i]))
cairo_stroke (cr)
cairo_rotate (cr, -interval2)
end
end
function circlewritingdown(cr, text, font, fsize, radi, horiz, verti, tred, tgreen, tblue, talpha, start, finish, var1)
local inum=string.len(text)
deg=(start-finish)/(inum-1)
degrads=1*(math.pi/180)
local textcut=string.gsub(text, ".", "%1@@@")
texttable=string.split(textcut, "@@@")
for i = 1,inum do
ival=i
interval=(degrads*(start-(deg*(i-1))))+var1
interval2=degrads*(start-(deg*(i-1)))
txs=0+radi*(math.sin(interval))
tys=0-radi*(math.cos(interval))
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, tred, tgreen, tblue, talpha);
cairo_move_to (cr, txs+horiz, tys+verti);
cairo_rotate (cr, interval2+(180*math.pi/180))
cairo_show_text (cr, (texttable[i]))
cairo_stroke (cr)
cairo_rotate (cr, -interval2-(180*math.pi/180))
end
end
function conky_draw_text()
local updates=conky_parse('${updates}')
update_num=tonumber(updates)
if update_num > 5 then
if conky_window==nil then return end
local w=conky_window.width
local h=conky_window.height
local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)
cr=cairo_create(cs)
--circlewriting variable
cpu=tonumber(conky_parse('${cpu}'))
--text must be in quotes
text=("Tempete - Pluie - Variable - Beau - Tres Sec")
--text=("Stormy - Rain - Change - Fair - Very Dry")
--font name must be in quotes
font="URW Chancery L"
fontsize=15
radius=50
positionx=110
positiony=110
colorred=1
colorgreen=1
colorblue=1
coloralpha=1
--to set start and finish values for circlewriting, if the text will cross 0 degrees then you must calculate for 360+finish degrees
--eg if you want to go from 270 to 90, then you will input 270 to 450. Finish has to be greater than start.
start=-115
finish=115
letterposition=0
circlewriting(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)
--circlewritingdown variables
--mem=tonumber(conky_parse('${memperc}'))
--text must be in quotes
text=(" 0 ")
--font name must be in quotes
font="URW Chancery L"
fontsize=10
radius=40
positionx=110
positiony=160
colorred=1
colorgreen=1
colorblue=1
coloralpha=1
--to set start and finish values for circlewritingdown, if the text will cross 0 degrees then you must calculate for 0-finish degrees
--eg if you want to go from 90 to 270, then you will input 90 to -90. Start has to be greater than finish
start=150
finish=144
letterposition=0
circlewritingdown(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)
text=("50")
font="URW Chancery L"
fontsize=10
radius=40
positionx=110
positiony=160
colorred=1
colorgreen=1
colorblue=1
coloralpha=1
start=268
finish=262
letterposition=0
circlewritingdown(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)
text=("40")
font="URW Chancery L"
fontsize=10
radius=40
positionx=110
positiony=160
colorred=1
colorgreen=1
colorblue=1
coloralpha=1
start=245
finish=239
letterposition=0
circlewritingdown(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)
text=("30")
font="URW Chancery L"
fontsize=10
radius=40
positionx=110
positiony=160
colorred=1
colorgreen=1
colorblue=1
coloralpha=1
start=222
finish=216
letterposition=0
circlewritingdown(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)
text=("20")
font="URW Chancery L"
fontsize=10
radius=40
positionx=110
positiony=160
colorred=1
colorgreen=1
colorblue=1
coloralpha=1
start=199
finish=193
letterposition=0
circlewritingdown(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)
text=("10")
font="URW Chancery L"
fontsize=10
radius=40
positionx=110
positiony=160
colorred=1
colorgreen=1
colorblue=1
coloralpha=1
start=176
finish=170
letterposition=0
circlewritingdown(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)
text=("-10")
font="URW Chancery L"
fontsize=10
radius=40
positionx=110
positiony=160
colorred=1
colorgreen=0
colorblue=0
coloralpha=1
start=134
finish=124
letterposition=0
circlewritingdown(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)
text=("-20")
font="URW Chancery L"
fontsize=10
radius=40
positionx=110
positiony=160
colorred=1
colorgreen=0
colorblue=0
coloralpha=1
start=112
finish=99
letterposition=0
circlewritingdown(cr, text, font, fontsize, radius, positionx, positiony, colorred, colorgreen, colorblue, coloralpha, start, finish, letterposition)
end
end
le conky-barograph (il faut gnuplot)
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_argb_visual yes
own_window_type normal
own_window_hints undecorated,below,skip_taskbar,skip_pager
double_buffer yes
minimum_size 180 100
maximum_width 190
text_buffer_size 2048
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color white#dbc38f
default_outline_color black
alignment tr
gap_x -10
gap_y 800
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
# Fonctionne uniquement avec les polices Fixes
#use_spacer yes
imlib_cache_size 0
uppercase no
# -- 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/meteo6jours/meteo.cfg
lua_load ~/.conky/draw_bg/draw_bg.lua
color1 lightgreen
color2 ff2121
TEXT
${if_gw}${execi 1200 bash ~/.conky/barograph/barognuplot.sh }${endif}#
${image ~/.conky/barograph/graph.png -s 160x110 -p 10,0 -n}#
${font URW Chancery L:style=Bold:size=8}}#
${voffset -12} ${goto 1}${color1} 40 ° ${goto 162}${color2}1040mb
${voffset 01} ${goto 1}${color1} 20 ° ${goto 162}${color2}1020mb
${voffset -1} ${goto 4}${color1} 0 ° ${goto 162}${color2}1000mb
${voffset -1} ${goto 1}${color1}-10 ° ${goto 162}${color2} 980mb
${voffset -1} ${goto 1}${color1}-20 ° ${goto 162}${color2} 960mb
${lua conky_draw_bg 0 28 17 130 70 0x000000 0.7}
${lua fDrawImage ~/.conky/barograph/white.png 28 96 132 10}
${voffset -800}
Conky-meteo de Didier-t ici:
https://forum.ubuntu-fr.org/viewtopic.p … 229761&p=1
Forecast-icone ici (.deb or tarz)
http://guideubuntu.blogspot.fr/2011/09/ … e-htc.html
Barographe ici
http://shamen456.deviantart.com/art/bar … -270650950
conky-moon phase ici:
https://forums.bunsenlabs.org/viewtopic.php?id=189
@+
Hors ligne
#1240 Le 17/12/2015, à 07:55
- jlfh0816
Re : [Conky] Alternative à weather.com (3)
@Ioutch
Wouah ! Un grand merci Ioucht pour ta gentillesse, voilà de quoi m'occuper durant les prochaines vacances de fin d'année !
Xubuntu - Voyager 18.04 et 22.04
Hors ligne
#1241 Le 18/12/2015, à 23:08
Hors ligne
#1242 Le 19/12/2015, à 08:12
- loutch
Re : [Conky] Alternative à weather.com (3)
Hello
@ seelord
Superbe , je viens de voir que tes phases sont en english .
@ Tous
Oublie de ma part voici mon moon_MooGiant pour les phases en bon francois
#!/bin/bash
#function: moonrise_set
moonrise_set () {
case "$1" in
"FirstQuarter")
echo "Noon/Midnight"
cp $HOME/4_Moon/riseicons/rise_FirstQuarter.jpg $HOME/4_Moon/rise.jpg
;;
"FullMoon")
echo "6PM/6AM"
cp $HOME/4_Moon/riseicons/rise_FullMoon.jpg $HOME/4_Moon/rise.jpg
;;
"LastQuarter")
echo "Midnight/Noon"
p $HOME/4_Moon/riseicons/rise_LastQuarter.jpg $HOME/4_Moon/rise.jpg
;;
"NewMoon")
echo "6AM/6PM"
cp $HOME/4_Moon/riseicons/rise_NewMoon.jpg $HOME/4_Moon/rise.jpg
;;
"WaningCrescent")
echo "3AM/3PM"
cp $HOME/4_Moon/riseicons/rise_WaningCrescent.jpg $HOME/4_Moon/rise.jpg
;;
"WaningGibbous")
echo "9PM/9AM"
cp $HOME/4_Moon/riseicons/rise_WaningGibbous.jpg $HOME/4_Moon/rise.jpg
;;
"WaxingCrescent")
echo "9AM/9PM"
cp $HOME/4_Moon/riseicons/rise_WaxingCrescent.jpg $HOME/4_Moon/rise.jpg
;;
"WaxingGibbous")
echo "3PM/3AM"
cp $HOME/4_Moon/riseicons/rise_WaxingGibbous.jpg $HOME/4_Moon/rise.jpg
;;
*)
echo "Unavailable"
esac
}
kill -STOP $(pidof conky)
killall wget
#put your hemisphere here: north or south
hemisphere=north
wget -O $HOME/4_Moon/raw "http://www.moongiant.com/phase/today"
rm $HOME/4_Moon/*.png $HOME/4_Moon/*.jpg
sed -i -e '/^ *$/d' -e 's/^ *//g' $HOME/4_Moon/raw
sed -i '/var jArray=\|"todayMoonContainer"\|"moonNotToday"/!d' $HOME/4_Moon/raw
sed -i -e '/var jArray/s/","/\n/g' -e 's/<span>\|<b>\|<\\\/span>\|<\\\/b>\|\\n//g' /$HOME/4_Moon/raw
sed -i 's/"\].*\[\"/\n/g' /$HOME/4_Moon/raw
sed -i '/var jArray/d' /$HOME/4_Moon/raw
sed -i -e 's/"\]};//g' -e 's/^.*today_phase\///g' -e 's/\.jpg.*$//g' /$HOME/4_Moon/raw
sed -i -e 's/^small\///g' -e 's/\.png.*$//g' /$HOME/4_Moon/raw
sed -i 's/Illumination: \|Sun Angle: \|Sun Distance: \|Moon Distance: \|Moon Age: \|Moon Angle: //g' /$HOME/4_Moon/raw
phase=$(sed -n 7p $HOME/4_Moon/raw|sed 's/ //')
mrise_mset=$(moonrise_set $phase)
sed -i 7a$(moonrise_set $phase) /$HOME/4_Moon/raw
#Day before Yesterday
img_in=$(sed -n 44p $HOME/4_Moon/raw)
cp $HOME/4_Moon/moongiant_icons_$hemisphere/$img_in.png $HOME/4_Moon/-2.png
#Yesterday
img_in=$(sed -n 45p $HOME/4_Moon/raw)
cp $HOME/4_Moon/moongiant_icons_$hemisphere/$img_in.png $HOME/4_Moon/-1.png
#Today
img_in=$(sed -n 46p $HOME/4_Moon/raw)
cp $HOME/4_Moon/moongiant_icons_$hemisphere/$img_in.png $HOME/4_Moon/0.png
#Tomorrow
img_in=$(sed -n 47p $HOME/4_Moon/raw)
cp $HOME/4_Moon/moongiant_icons_$hemisphere/$img_in.png $HOME/4_Moon/1.png
#Day after Tomorrow
img_in=$(sed -n 48p $HOME/4_Moon/raw)
cp $HOME/4_Moon/moongiant_icons_$hemisphere/$img_in.png $HOME/4_Moon/2.png
sed -i -e 's/New Moon/Nouvelle Lune/g' -e 's/Waxing Crescent/Lune Montante/g' -e 's/First Quarter/Premier Quartier/g' -e 's/Waxing Gibbous/Gibeuse Croissante/g' -e 's/Full Moon/Pleine Lune/g' -e 's/Waning Gibbous/Gibeuse Décroissante/g' -e 's/Last Quarter/Dernier Quartier/g' -e 's/Waning Crescent/Lune Déscendante/g' /$HOME/4_Moon/raw
kill -CONT $(pidof conky)
@+
Hors ligne
#1243 Le 19/12/2015, à 08:16
- loutch
Re : [Conky] Alternative à weather.com (3)
@Ioutch
Wouah ! Un grand merci Ioucht pour ta gentillesse, voilà de quoi m'occuper durant les prochaines vacances de fin d'année !
De rien
@+
Hors ligne
#1244 Le 19/12/2015, à 13:23
- seelord
Re : [Conky] Alternative à weather.com (3)
@loutch,
Oui effectivement c'est beaucoup mieux comme ça
Un GRAND merci
PS: loutch si c'est pas trop te demander serait-il possible d'avoir ta config du Zodiac avec les icons Sioupléééé
Ah tien tu as l'air de bien maîtriser le sujet des Conky's tu vas pouvoir peut être me donner la solution.
Regarde sur le Screen du dessus, mon calendar, je ne peux pas changer la police d'écriture des jours de la semaine(en lettre) et des jours(en chiffre).
Dés que je change le "font" pour mettre "URW Chancery L" à la place de celui de base "Droid Sans Mono" plus rien est à sa place du coup ça fait un calendar tout barbouillé
normal_font = "URW Chancery L:pixelsize=14",
big_font = "URW Chancery L:pixelsize=42",
grid_font = "Droid Sans Mono:pixelsize=12"
Genre si je change comme ceci:
normal_font = "URW Chancery L:pixelsize=14",
big_font = "URW Chancery L:pixelsize=42",
grid_font = "URW Chancery L:pixelsize=12"
Ça me donne ceci:
Si tu veux jeter un oeil je te donne la config :
calendar.lua
--
-- calendar.lua
-- Calendar for Conky
--
months = {
-- Add translations for names of months for your language
en = { "JANVIER", "FEVRIER", "MARS", "AVRIL",
"MAI", "JUIN", "JUILLET", "AOUT",
"SEPTEMBRE", "OCTOBRE", "NOVEMBRE", "DECEMBRE" },
ru = { "ЯНВАРЬ", "ФЕВРАЛЬ", "МАРТ", "АПРЕЛЬ",
"МАЙ", "ИЮНЬ", "ИЮЛЬ", "АВГУСТ",
"СЕНТЯБРЬ", "ОКТЯБРЬ", "НОЯБРЬ", "ДЕКАБРЬ" }
}
weekDays = {
-- Add translations for acronyms names days of the week for your language
en = { "DI", "LU", "MA", "ME", "JE", "VE", "SA" },
ru = { "ВС", "ПН", "ВТ", "СР", "ЧТ", "ПТ", "СБ" }
}
weekDaysFull = {
-- Add translations for names days of the week for your language
en = { "DIMANCHE", "LUNDI", "MARDI", "MERCREDI",
"JEUDI", "VENDREDI", "SAMEDI" },
ru = { "ВОСКРЕСЕНЬЕ", "ПОНЕДЕЛЬНИК", "ВТОРНИК", "СРЕДА",
"ЧЕТВЕРГ", "ПЯТНИЦА", "СУББОТА" }
}
function conky_calendar ()
local t = { lang = "en", -- Language for display Months and Days of week
-- Change it to your language, and add translations
-- for into the tables named 'months', 'weekDays'
-- and 'weekDaseFull' at top of this file
right_space = 78,
left_space = 123,
back_voffset = -113,
draw_spin = false,
normal_font = "URW Chancery L:pixelsize=14",
big_font = "URW Chancery L:pixelsize=42",
grid_font = "Droid Sans Mono:pixelsize=12",
weekend_color = "FFA300",
spin_color = "FFA300", }
local m, y = os.date("%m"), os.date("%Y")
return displayCalendar(m, y, 2, t) -- Month, Year, Start of Week (1 = Sunday, 2 = Monday)
-- and parameters table :-)
end
-- Display the calendar
-- Based on some examples from this page: http://lua-users.org/wiki/DisplayCalendarInHtml
function displayCalendar(month, year, weekStart, params)
local t, wkSt = os.time{year=year, month=month+1, day=0}, weekStart or 1
local d = os.date("*t", t)
local mthDays, stDay = d.day, (d.wday - d.day - wkSt+1) % 7
local wd = tonumber(os.date("%w")) + 1
local mths = months[params.lang] or months["en"]
local wdsf = weekDaysFull[params.lang] or weekDaysFull["en"]
local wds = weekDays[params.lang] or weekDays["en"]
local rs = "${alignc " .. params.right_space .. "}"
local ls = "${goto " .. params.left_space .. "}"
local bv = "${voffset " .. params.back_voffset .. "}"
local df = "${font}"
local nf = "${font " .. params.normal_font .. "}"
local bf = "${font " .. params.big_font .. "}"
local gf = "${font " .. params.grid_font .. "}"
local wc = "${color " .. params.weekend_color .. "}"
local sc = "${color " .. params.spin_color .. "}"
local result = "\n"
result = result .. nf .. rs .. mths[tonumber(month)] .. df .. "\n\n${voffset -10}"
if wd == 1 or wd == 7 then
result = result .. bf .. rs .. wc .. os.date("%d") .. "${color}" .. df .. "\n\n${voffset -2}"
result = result .. nf .. rs ..wc .. wdsf[wd] .. "${color}" .. df .. "\n\n"
else
result = result .. bf .. rs .. os.date("%d") .. df .. "\n\n${voffset -2}"
result = result .. nf .. rs .. wdsf[wd] .. df .. "\n\n"
end
if params.draw_spin then
result = result .. bv .. sc .. "${voffset -15}${goto 1}${hr 15}${color}\n\n${voffset -13}"
else
result = result .. bv .. "${voffset 2}"
end
result = result .. ls .. gf
for x=0,6 do
wd = (x + wkSt) <= 7 and x + wkSt or 1
if wd == 1 or wd == 7 then
result = result .. wc
end
result = result .. wds[wd] .. " "
if wd == 1 or wd == 7 then
result = result .. "${color}"
end
end
result = result .. "\n\n${voffset -13}" .. ls .. string.rep(" ", stDay)
for x = 1, mthDays do
wd = os.date("%w", os.time{year = year, month = month, day = x}) + 1
if wd == 1 or wd == 7 then
result = result .. wc
end
if x < 10 then
result = result .. "0"
end
result = result .. x .. " "
if wd == 1 or wd == 7 then
result = result .. "${color}"
end
if (x+stDay)%7==0 then
result = result .. "\n\n${voffset -14}" .. ls
end
end
return result
end
calendar.rc
background yes
out_to_console no
out_to_stderr no
out_to_x yes
double_buffer yes
no_buffers yes
text_buffer_size 2048
total_run_times 0
update_interval 1.0
alignment tr
gap_x 550
gap_y 45
border_inner_margin 0
border_outer_margin 0
border_width 0
maximum_width 276
minimum_size 276 142
# Window Setting
own_window_argb_visual true
own_window_argb_value 0
own_window_type desktop
own_window yes
own_window_transparent yes
own_window_type normal
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
default_color e4e4e4
default_outline_color 000000
default_shade_color 222222
draw_borders no
draw_graph_borders no
draw_outline no
draw_shades no
override_utf8_locale yes
use_xft yes
xftalpha 0.8
xftfont Droid Sans:style=Bold:pixelsize=12
lua_load calendar.lua
TEXT
${lua_parse calendar}
${goto 30}${font URW Chancery L:size=10}Semaine : ${color FFA300}${time %V}${color} Jour : ${color FFA300}${time %j}${color}
${goto 30}Zodiac : ${color FFA300}${execp ~/.conky/blanc/astro_neo.sh}${color}
${goto 30}Saint du jour : ${color FFA300}${exec $HOME/.conky/conky-meteo/meteo6jours/scripts/Saints.sh}${color}
#${goto 30}${color FFA300}Saint: $color${color1}${font Helvetica LT Std :size=8}${exec $HOME/.conky/conky-meteo/meteo6jours/scripts/Saints.sh}
calendar.sh
#!/bin/sh
##############################################################################
# Get the real directory, where is located executable file
case `uname` in
"FreeBSD" )
if [ $( readlink ${0} ) ]; then
RUNDIR=$( realpath $( dirname $( readlink ${0} ) ) )
else
RUNDIR=$( realpath $( dirname ${0} ) )
fi
;;
"Linux" )
RUNDIR=$( dirname $( readlink -f ${0} ) )
;;
esac
##############################################################################
INTERVAL=${1:-10}
cd ${RUNDIR}
sleep ${INTERVAL}
conky -c calendar.rc &
exit 0
Merci d'avance
Dernière modification par seelord (Le 19/12/2015, à 16:50)
Rien ne sert d'avoir une grosse tête, suffit juste de mettre les pieds dans le plat...^^
Hors ligne
#1245 Le 19/12/2015, à 20:28
- loutch
Re : [Conky] Alternative à weather.com (3)
Hello
Pour ton calendrier c'est normal il faut une police à chasse fixe
URW Chancery L est une police variable (elle ne va quand même pas se transformer en gendarmerie )
Si tu veux utilisé URW Chancery L vas sur mlo.org dans la rubrique wiki - utiliser mageia - en bas de page il y a 3 parties conky avec un vrai calendrier lua .
config zodiac à rajouter dans le conky
${execpi 3600 /home/loutch/.conky/blanc/astro_neo.sh}
l'astro_neo.sh (il faut modifier la dernière ligne pour le chemin et pour le placement des icônes);
#!/bin/bash
# Astro.sh
# by Crinos512 (17 Feb, 2011)
# updated by Sector11 (21 Feb, 2011)
# Usage:
# ${execp ~/path/to/Astro.sh}
#
# Aquarius Jan 20 - Feb 18
# Pisces Feb 19 - Mar 20
# Aries Mar 21 - Apr 19
# Taurus Apr 20 - May 20
# Gemini May 21 - Jun 20
# Cancer Jun 21 - Jul 22
# Leo Jul 23 - Aug 22
# Virgo Aug 23 - Sep 22
# Libra Sep 23 - Oct 22
# Scorpio Oct 23 - Nov 21
# Sagittarius Nov 22 - Dec 21
# Capricorn Dec 22 - Jan 19
# Traduis en français par loutch
Month=`date +%m`
Day=`date +%d`
case "$Month" in
01 ) if [ "$Day" -le "20" ] ; then Sign="Capricorne" ; else Sign="Verseau" ; fi ;;
02 ) if [ "$Day" -le "19" ] ; then Sign="Verseau" ; else Sign="Poisson" ; fi ;;
03 ) if [ "$Day" -le "21" ] ; then Sign="Poisson" ; else Sign="Bélier" ; fi ;;
04 ) if [ "$Day" -le "20" ] ; then Sign="Bélier" ; else Sign="Taureau" ; fi ;;
05 ) if [ "$Day" -le "21" ] ; then Sign="Taureau" ; else Sign="Gémaux" ; fi ;;
06 ) if [ "$Day" -le "21" ] ; then Sign="Gémaux" ; else Sign="Cancer" ; fi ;;
07 ) if [ "$Day" -le "23" ] ; then Sign="Cancer" ; else Sign="Lion" ; fi ;;
08 ) if [ "$Day" -le "23" ] ; then Sign="Lion" ; else Sign="Vierge" ; fi ;;
09 ) if [ "$Day" -le "23" ] ; then Sign="Vierge" ; else Sign="Balance" ; fi ;;
10 ) if [ "$Day" -le "23" ] ; then Sign="Balance" ; else Sign="Scorpion" ; fi ;;
11 ) if [ "$Day" -le "22" ] ; then Sign="Scorpion" ; else Sign="Sagittaire" ; fi ;;
12 ) if [ "$Day" -le "22" ] ; then Sign="Sagittaire" ; else Sign="Capricorne" ; fi ;;
* ) Sign="ERROR" ;;
esac
case "$Sign" in
"Capricorne" ) BeginDate="22 Déc" ; EndDate="19 Jan" ; ;;
"Verseau" ) BeginDate="20 Jan" ; EndDate="18 Fév" ; ;;
"Poisson" ) BeginDate="19 Fév" ; EndDate="20 Mar" ; ;;
"Bélier" ) BeginDate="21 Mar" ; EndDate="19 Avr" ; ;;
"Taureau" ) BeginDate="20 Avr" ; EndDate="20 Mai" ; ;;
"Gémaux" ) BeginDate="21 Mai" ; EndDate="20 Juin" ; ;;
"Cancer" ) BeginDate="21 Juin" ; EndDate="22 Juil" ; ;;
"Lion" ) BeginDate="23 Juil" ; EndDate="22 Aou" ; ;;
"Vierge" ) BeginDate="23 Aou" ; EndDate="22 Sep" ; ;;
"Balance" ) BeginDate="23 Sep" ; EndDate="22 Oct" ; ;;
"Scorpion" ) BeginDate="23 Oct" ; EndDate="21 Nov" ; ;;
"Sagittaire" ) BeginDate="22 Nov" ; EndDate="21 Déc" ; ;;
* ) BeginDate="XXX XX" ; EndDate="XXX XX" ; ;;
esac
echo "\${image ~/.conky/blanc/signs/$Sign.png -p 1090,30 -s 40x40}\${image ~/.conky/blanc/stars/$Sign.png -p 1200,30 -s 40x40}\${goto 880}du : $BeginDate au : $EndDate nous sommes en : \${goto 1140} $Sign "
Pour le packs voir ici à faire deux extractions .
http://www.mageialinux-online.org/uploa … ars_tar.gz
@+
Dernière modification par loutch (Le 19/12/2015, à 21:00)
Hors ligne
#1246 Le 19/12/2015, à 21:10
#1247 Le 19/12/2015, à 21:54
- loutch
Re : [Conky] Alternative à weather.com (3)
ok
@+
Hors ligne
#1248 Le 19/12/2015, à 22:10
- seelord
Re : [Conky] Alternative à weather.com (3)
Ça marche pas j'ai plus rien qui s'affiche
Rien ne sert d'avoir une grosse tête, suffit juste de mettre les pieds dans le plat...^^
Hors ligne
#1249 Le 19/12/2015, à 22:19
- loutch
Re : [Conky] Alternative à weather.com (3)
Hors ligne
#1250 Le 20/12/2015, à 00:32
- seelord
Re : [Conky] Alternative à weather.com (3)
Re loutch,
J'ai fini par le faire apparaître
Le souci c'était les "1090,30 & 1200,30" qui du coup m'envoyait l'affichage hors écran^^
${image ~/.conky/blanc/signs/$Sign.png -p 1090,30 -s 40x40}\${image ~/.conky/blanc/stars/$Sign.png -p 1200,30 -s 40x40}
Merci bien loutch
Rien ne sert d'avoir une grosse tête, suffit juste de mettre les pieds dans le plat...^^
Hors ligne