Fecfactor-ek atzo eskatu zidan azpiko pantailan erakusten dudan konkyaren konfigurazioa argitaratzeko
Ikus dezakezunez, 3 konker daude, script baten bidez exekutatzen direnak, honen konfigurazioa oinarrian dago post honetan erabiltzaileak Bruce M. erabiltzaileak argitaratua Ubuntu-Ar mail conky-n aldaketa batzuk eginda, nire kasuan Gmail-erako da.
Erreferentzia mezuan Bruce-k oso ondo azaltzen du, baina niretzat memoriarako lagungarri gisa, jarraitu beharreko pausoak eta nire kontsolen kodea kopiatuko ditut daukanarentzat.
Beno, noski, conky, curl eta python instalatuta izan behar ditugu kontsola batean idazteko:
Sudo APT-GET INSTALL CONKY CURL PYTHON
Weather.ttf eta geziak.ttf iturria hemen dago. Ilargiaren iturria.ttf hemen dago deskargatu ondoren / usr / share / fonts-era kopiatu behar dituzu
Sortu dezagun ~. / Startconky izeneko gure script-a
gksudo gedit ~ / .startconky
fitxategi hutsaren barruan honako hau itsasten dugu
#! / Bin / bash
lo 0 & # 0 ona Xfcerentzat - erabili 20 eta 30 Gnome-rentzat
conky -c ~ / Conky / conkymain &
#sleep 0 & # 0 ona Xfcerentzat - erabili 1 Gnomerako
conky -c ~ / Conky / conkyforecast &
#sleep 0 & # 0 ona Xfcerentzat - erabili 1 Gnomerako
conky -c ~ / Conky / conkymail &
Orain conkymain fitxategia ~ / Conky karpetan sortzen dugu, Conky karpeta ez badugu, sortu beharko dugu.
gedit ~ / Conky / conkymain
Calibri letra tipoa erabiltzen dut, ez baduzu, ordezkatu nahi duzunarekin.
Ondorengoaren barruan itsasten gara
aurrekariak ez
jabea_leihoa bai
own_window_transparent bai
own_window_hints dekoratu gabea, behean, itsaskorra, skip_taskbar, skip_pager
jabea_leihoa_kolorea beltza
double_buffer bai
erabili_tartea utzi
erabili_xft bai
letra tipo calibri: tamaina = 9
xftfont calibri: size = 9
xftalpha 0.5
eguneraketa_tartea 5.0
maiuskulaz ez # ezarrita baieztatu testu guztia maiuskulaz egotea nahi baduzu
puntuak_mugak 3
muga_margina 9
ertza_zabalera 10
lehenetsia_kolorea zuria
default_outline_color beltza
default_shade_color beltza
kolore0 zian
kolore1 urdin argia
kolore2 laranja
kolore3 horia
kolorea4 garia
kolore5 zuria
kolore6 zuria
kolore7 zuria
kolore8 zuria
kolore9 zuria
lerrokatzea goi_eskuin # edo goi_ezker, behean_ezker, behean_eskuin
hutsunea_x 10
hutsunea_y 35
text_buffer_size 128 # erabili 1024 iragarpenerako
no_buffers yes # Kendu fitxategi sistema bufferrak erabilitako memoriatik?
draw_borders ez
draw_outline yes # testua anplifikatzen du bai bada
draw_shades bai # itzal kolorea beltzaTEXT
$ {font calibri: size = 12} $ {alignc} $ {color1} $ sysname $ kernel $ machine} $ color $ font
$ {font calibri: size = 12} $ {alignc} $ {color2} $ {exec whoami} @ $ nodename $ color $ font
$ {color0} $ {hr 1} $ kolorea
$ {font calibri: size = 20} $ {alignc} $ {time% H:% M} $ letra-tipo
$ {font calibri: size = 12} $ {color1} $ {alignc} $ {time% A,% d% b. % Y} $ color $ letra tipo
$ {color3} UpTime: $ {alignr 2} $ uptime $ color
$ {color0} $ {hr 1} $ kolorea
$ {voffset 5} $ {color2} CPU: $ {alignc} $ color $ running_processes $ {color1} / $ color $ prozesuak $ {alignr 2} $ {color2} $ {cpubar cpu0 14,80} $ color
$ {color1} $ {voffset -16} $ {alignr 5} $ cpu% $ kolorea
$ {voffset 2} $ {color1} Kargatu batez bestekoa ($ {color3} Min $ {color1}): $ {alignr 2} $ {color3} 1: $ color $ {loadavg 1} $ {color3} 5: $ color $ {loadavg 2} $ {color3} 15: $ color $ {loadavg 3}
$ {voffset 5} $ {color2} RAM: $ color $ mem $ {color2} / $ color $ memmax $ {alignr 2} $ {color2} $ {membar 14,80} $ color
$ {color1} $ {voffset -16} $ {alignr 5} $ memperc% $ color
$ {voffset 2} $ {color1} Buffered: $ color $ {buffers} $ {alignr 2} $ {color1} Cachean: $ color $ {cached}
$ {voffset 5} $ {color2} SWAP: $ color $ swap $ {color2} / $ color $ {swapmax} $ {alignr 2} $ {color2} $ {swapbar 14,80} $ color
$ {color1} $ {voffset -16} $ {alignr 5} $ swapperc%
$ {color0} $ {hr 1} $ kolorea
$ {voffset 5} $ {color2} HD informazioa $ {color1} - $ color Doakoa $ {color1} - Erabilitakoa - $ {color2} Guztira
$ {voffset 5} $ {color1} Erroa: $ color $ {fs_free_perc /}% $ {alignr 2} $ {fs_free /} $ {color2} / $ {color1} $ {fs_used /} $ color / $ {color2} $ {fs_size /} $ kolorea
$ {color1} Hasiera: $ color $ {fs_free_perc / home / user}% $ {alignr 2} $ {fs_free / home / user} $ {color2} / $ {color1} $ {fs_used / home / user} $ color / $ {color2} $ {fs_size / home / user} $ kolorea
$ {color0} $ {hr 1} $ kolorea
$ {color1} Igorlea: $ color Buenos Aires, Argentina
$ {color1} Lat: $ {color2} 34 ° 35'S $ {color1} Luzea: $ {color2} 58 ° 21'W $ {color1} Alt: $ {color2} 25 m $ kolore
$ {voffset 5} $ {color2} $ {font calibri: size = 12} gaur: $ font $ {color3} $ {execi 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = CC} $ $ {alignr 2} $ {color1} ST: $ {color2} $ {execi 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = LT}
$ {color3} $ {font Weather: size = 50} $ {execi 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = WF} $ font $ color
$ {alignr 50} $ {voffset -55} $ {font calibri: size = 25} $ {execi 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = HT} $ font
$ {alignc 20} $ {voffset -30} $ {font Arrows: size = 20} $ {color4} $ {execi 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = BF} $ color $ letra tipo
$ {alignc 10} $ {voffset 5} $ {color4} Haizea: $ {execi 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = WS} $ color
$ {color1} Hezetasuna: $ {color3} $ {execi 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = HM} $ {alignr 2} $ {color1} Prezipitazioak: $ {color3} $ { execi 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = PC} $ kolorea
$ {alignc} $ {color1} Presioa: $ {color3} $ {execi 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = BR} - $ {color3} $ {execi 3600 python ~ / Conky /scripts/conkyForecast.py –location = ARBA0009 –datatype = BD} $ kolorea
$ {color4} $ {hr} $ kolorea
$ {color1} Sunrise: $ {color3} $ {execi 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = SR} $ {alignr 2} $ {color1} Sunset: $ {color3} $ { execi 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = SS} $ kolorea
$ {voffset 15} $ {color1} Moon: $ {color4} $ {alignr 2} $ {color3} $ {execi 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = MP} $ color
$ {voffset -20} $ {offset 80} $ {color4} $ {font moon phases: size = 20} $ {execi 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = MF} $ font $ kolorea
$ {color0} $ {hr} $ kolorea
$ {voffset 5} $ {color2} IP: $ {alignc} $ color $ {addr eth0}
$ {color1} Behera: $ color $ {downspeed eth0} k / s $ {alignr 2} $ {color1} Up: $ color $ {upspeed eth0} k / s
$ {color1} Guztira: $ color $ {totaldown eth0} $ {alignr 2} $ {color1} Guztira: $ color $ {totalup eth0}
$ {color1} Sarrerakoa: $ color $ {tcp_portmon 1 32767 count} $ {color1} Irteerakoa: $ color $ {tcp_portmon 32768 61000 count} $ {alignr 2} $ {color1} Guztira: $ color $ {tcp_portmon 1 65535 count}
$ {voffset 5} $ {color2} konexioak: $ color $ {tcp_portmon 32768 61000 count} $ {alignr 2} $ {color2} Zerbitzua / Portua $ color
$ {voffset 5} $ {tcp_portmon 32768 61000 rhost 0} $ {alignr 2} $ {tcp_portmon 32768 61000 rservice 0}
$ {tcp_portmon 32768 61000 rhost 1} $ {alignr 2} $ {tcp_portmon 32768 61000 rservice 1}
$ {tcp_portmon 32768 61000 rhost 2} $ {alignr 2} $ {tcp_portmon 32768 61000 rservice 2}
$ {tcp_portmon 32768 61000 rhost 3} $ {alignr 2} $ {tcp_portmon 32768 61000 rservice 3}
$ {tcp_portmon 32768 61000 rhost 4} $ {alignr 2} $ {tcp_portmon 32768 61000 rservice 4}
$ {tcp_portmon 32768 61000 rhost 5} $ {alignr 2} $ {tcp_portmon 32768 61000 rservice 5} $ kolorea
~ / Conky / conkyforecast fitxategia sortzen dugu
gedit ~ / Conky / conkyforecast
eta honako hau barruan itsatsi dugu
aurrekariak ez
jabea_leihoa bai
own_window_transparent bai
own_window_hints dekoratu gabea, behean, itsaskorra, skip_taskbar, skip_pager
jabea_leihoa_kolorea beltza
double_buffer bai
erabili_tartea utzi
erabili_xft bai
letra tipo calibri: tamaina = 8
xftfont calibri: size = 8
xftalpha 0.5
eguneraketa_tartea 5.0
maiuskulaz ez # ezarrita baieztatu testu guztia maiuskulaz egotea nahi baduzu
puntuak_mugak 3
muga_margina 9
ertza_zabalera 10
lehenetsia_kolorea zuria
default_outline_color beltza
default_shade_color beltza
kolore0 zian
kolore1 urdin argia
kolore2 laranja
kolore3 horia
kolorea4 garia
kolore5 zuria
kolore6 zuria
kolore7 zuria
kolore8 zuria
kolore9 zuria
lerrokatzea behean_ezker # edo goiko_ezkerrean, behean_ezkerrean, behean_eskuinean
hutsunea_x 10
hutsunea_y 35
text_buffer_size 1024 # erabili 1024 iragarpenerako
no_buffers yes # Kendu fitxategi sistema bufferrak erabilitako memoriatik?
draw_borders ez
draw_outline yes # testua anplifikatzen du bai bada
draw_shades bai # itzal kolorea beltzaTEXT
$ {color4} $ {font calibri: size = 11} Iragarpen hedatua $ font $ color
$ {color0} $ {hr} $ kolorea
$ {color4} $ {font calibri: size = 9} $ {execi 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –template = / home / user / Conky / scripts / myweather.template} $ font $ kolore
~ / Conky / conkymail fitxategia sortzen dugu
gedit ~ / Conky / conkymail
honako hau fitxategian itsasten dugu
aurrekariak ez
jabea_leihoa bai
own_window_transparent bai
own_window_hints dekoratu gabea, behean, itsaskorra, skip_taskbar, skip_pager
jabea_leihoa_kolorea beltza
double_buffer bai
erabili_tartea utzi
erabili_xft bai
letra tipo calibri: tamaina = 8
xftfont calibri: size = 8
xftalpha 0.5
eguneraketa_tartea 5.0
maiuskulaz ez # ezarrita baieztatu testu guztia maiuskulaz egotea nahi baduzu
puntuak_mugak 3
muga_margina 9
ertza_zabalera 10
lehenetsia_kolorea zuria
default_outline_color beltza
default_shade_color beltza
kolore0 zian
kolore1 urdin argia
kolore2 laranja
kolore3 horia
kolorea4 garia
kolore5 zuria
kolore6 zuria
kolore7 zuria
kolore8 zuria
kolore9 zuria
lerrokatzea behean_ezker # edo goiko_ezkerrean, behean_ezkerrean, behean_eskuinean
hutsunea_x 565
hutsunea_y 35
text_buffer_size 128 # erabili 1024 iragarpenerako
no_buffers yes # Kendu fitxategi sistema bufferrak erabilitako memoriatik?
draw_borders ez
draw_outline yes # testua anplifikatzen du bai bada
draw_shades bai # itzal kolorea beltzaTEXT
$ {font calibri: size = 11} $ {alignc} $ {color4} Gmail
$ {color0} $ {hr} $ kolorea
$ {font calibri: size = 11} $ {color4} $ {color3} $ {execi 300 python ~ / Conky / scripts / mail / conkyEmail.py} $ {color4} mezu elektronikoak $ font
~ / Conky / scripts / conkyForecast.py-n fitxategi bat sortzen dugu (scripten karpeta sortu behar dugu)
gedit ~ / Conky / scripts / conkyForecast.py
#! / usr / bin / python
# - * - kodeketa: utf-8 - * -
####################################################### ###############################
# conkyForecast.py biltzeko python script (ez hain) sinplea (jada) da
# uneko eguraldiaren xehetasunak conky-n erabiltzeko.
#
# Egilea: Kaivalagi
# Sortua: 13/04/2008
# Aldaketak:
# 14/04/2008 Baimendu eguneko tarteak iragarpen datuetarako
# 14/04/2008 Begiratu konektagarritasuna xoap zerbitzurako
# 18/04/2008 Baimendu irteera urruneko espazioen ezarpena
18/04/2008 Baimendu gau eta egun iragarpena
# 18/04/2008 Laguntza lokala baldintza kodearen testuaren «CC» aukerarako, gaztelaniazko itzulpenaren zain
# 18/04/2008 Erabili desugerketa klaseko datuetarako xml irekitzea baino, honek katxeatutako datuak galdekatzeko beharra gainditzen du.
19/04/2008 # Gaztelaniazko baldintzaren testua gehitu da. Eskerrik asko Bruce M
# 19/04/2008 zenbakizko irteera guztietan gehitu da unitate atzizkia duten zenbakizko irteeran
19/04/2008 # Aldatutako eskabetxearen fitxategien izena kokapen kodea sartzeko
19/04/2008 # Espainiako aste egunetako bihurketa gehitu da lokal bidez
20/04/2008 # Aginduen argumentu analizatzaile duina gehitu da
20/04/2008 # Aste laburreko aukera gehitu da, asteko eguna ematen bada datu mota 3 karakteretara laburtzen da
# 21/04/2008 Lokal aukerak finkatuta iragarpenaren irteerarako
# 21/04/2008 Gehitu da –template aukera exec exekuzio dei bakarra erabiliz irteera pertsonalizatua baimentzeko
# 21/04/2008 Gehitu da –hideunits aukera, adibidez, mph eta C irteeratik kentzeko
23/04/2008 kendu da - aukera inprimakia txantiloitik, hau DEI ezarri behar da script deian eta ez da txantiloien fitxategian erabili.
# 23/04/2008 Irakurria - Aukera inprimakia txantiloian, datu metriko edo balio inperialak gaituz. Kontuan izan txantiloiak komando lerroaren aukerak erabiltzeak ez duela funtzionatuko.
# 23/04/2008 Irteera gehitu da erabiltzaileari jakinarazten zaion kokapena txarra bada
# 24/04/2008 Konektagarritasunik gabeko manipulazioa gehitu da, cache datuetara itzuliko da orain (akatsik ez badago cachea existitzen bada). Probak xoap.weather.com irekitzen saiatuz
24/04/2008 Celsius konpondu zen Fahrenheit bihurketa
# 06/05/2008 Web zerbitzua eguneratu ondoren erabilitako URL eguneratua
09/05/2008 # Uneko egoera bateratua eta aurreikusitako datuak dei bakarrean biltzen dira
# 09/05/2008 Egunsentia eta ilunabarra gehitu dira datu motetan, uneko baldintzetarako eta iragarpen datuetarako espezifikoak dira
09/05/2008 # Ilargiaren fasea, barometroaren irakurketa eta barometroaren deskribapena datu motetan gehitu dira, uneko baldintzei soilik dagozkie eta, beraz, N / A aurreikusitako irteeran
09/05/2008 # Barometroaren unitate bihurketak gehitu dira mb-tik hazbetetara (inperiala)
09/05/2008 # Gaztelaniazko baldintzaren testua eguneratu da. Eskerrik asko Bruce M
10/05/2008 # Frantziako tokiko datuak gehitu dira - Eskerrik asko benpaka
12/05/2008 # BF (letra tipografikoa) datu mota berria gehitu da gezi karakterea emateko (erabili Arrow.ttf letra tipoarekin) NSEW irteeraren ordez WD (haizearen norabidea)
12/05/2008 # WD irteera locale espezifikoa izateko, gaur egun ingeles eta gaztelania lehenetsiak onartzen ditu. Eskerrik asko Bruce M
# 18/05/2008 MF (ilargiaren letra-tipo) datu mota berria gehitu da, ilargiaren letra-karakterea emateko (karaktere okerrak eta oraindik letra-tipo dedikaturik ez).
# 21/05/2008 Uneko baldintzetarako –datatype = LT aukerak uneko tenperatura baino gehiago "sentitzen duen" tenperatura erakusten du.
#
# DENA:
# Finkatu pkl fitxategiak fitxategi / klase bakarrean
# Gehitu eguraldiaren letra ilargiaren faseko irteeran oinarrituta ilargiaren ikonoen datuetan oinarrituta
# ??? Eskakizun gehiago al dago?inportatu sys, os, socket, urllib2, datetime, time
xml.dom-etik inportatu minidom-etik
estat inportazioetatik *
optparse import OptionParser-etik
inportatu lokala
inportatu gettext
inportatu ozpinetakoa
matematika inportaziotik *APP = »conkyForecast.py»
DIR = os.path.dirname (__file__) + '/ locale'
gettext.bindtextdomain (APP, DIR)
gettext.textdomain (APP)
_ = gettext.gettextCommandLineParser klasea:
analizatzailea = Bat ere ez
def __init __ (norbera):
self.parser = AukeraParser ()
self.parser.add_option («- l», »- location», dest = »location», default = »UKXX0103 ″, type =» string », metavar =» CODE », help = u» eguraldiaren datuetarako kokapen kodea [ lehenetsia:% lehenetsia], erabili url hau zure kokapen kodea hiriaren izenaren arabera zehazteko: http://xoap.weather.com/search/search?where=Norwich »)
self.parser.add_option ("- d", "- datatype", dest = "datatype", default = "HT", type = "string", metavar = "DATATYPE", help = u "[lehenetsia:% default] Datu moten aukerak hauek dira: DW (asteko eguna), WF (eguraldi letra irteera), LT (iragarpena: tenperatura baxua, unekoa: tenperatura sentitzen du), HT (iragarpena: tenperatura altua, unekoa: uneko tenperatura), CC (unekoa Baldintzak), CT (Baldintzetako testua), PC (prezipitazio aukera), HM (hezetasuna), WD (Haizearen norabidea), WS (Haizearen abiadura), WG (Haize boladak), CN (Hiriaren izena), SR (egunsentia), SS (ilunabarra), MP (ilargiaren fasea), MF (ilargiaren letra), BR (barometroaren irakurketa), BD (barometroaren deskribapena). Ez da komando-lerroan txantiloiak erabiltzerakoan aplikatzen. »)
self.parser.add_option («- s», »- startday», dest = »startday», idatzi = »int», metavar = »NUMBER», help = u »definitu hasierako egunaren zenbakia, kendutako uneko baldintzak irteten badira . Ez da komando-lerroan aplikatzen txantiloiak erabiltzean. »)
self.parser.add_option ("- e", "- endday", dest = "endday", type = "int", metavar = "NUMBER", help = u "zehaztu amaiera eguneko zenbakia, hasierako eguneko datuak bakarrik kentzen badira irteera da. Ez da komando lerroan aplikatzen txantiloiak erabiltzean. »)
self.parser.add_option («- S», »- espazioak», dest = »espazioak», mota = »int», lehenetsia = 1, metavar = »ZENBAKIA», laguntza = u »[lehenetsia:% lehenetsia] irteera barrutiaren arteko espazio kopurua. Ez da komando-lerroan aplikatzen txantiloiak erabiltzean. »)
self.parser.add_option («- t», »- template», dest = »template», type = »string», metavar = »FILE», help = u »definitu txantiloi fitxategi bat deialdi batean irteera sortzeko. A Fitxategian bistar daitekeen elementua {–datatype = HT –startday = 1} forman dago. Honako hauek dira elementu bakoitzaren aukerak: –datatype, –startday, –endday, –night, –shortweekday, –imperial, –hideunits, –Espazioak. Kontuan izan aukeren forma laburrak ez direla onartzen! Aukera horietako bat ere ez da komando-lerroan aplikatzen txantiloiak erabiltzean. »)
self.parser.add_option («- L», »- locale», dest = »locale», idatzi = »katea», laguntza = u »gainidatzi hizkuntza irteerako sistemaren lokala (en = ingelesa, es = gaztelania, fr = frantsesa, etorriko den gehiago) »)
self.parser.add_option ("- i", "- imperial", dest = "imperial", default = False, action = "store_true", help = u "eskatu unitate inperialak, kendutako irteera metrikokoa bada. komando lerroa txantiloiak erabiltzean. »)
self.parser.add_option («- n», »- night», dest = »night», lehenetsia = False, action = »store_true», help = u »irteera gaueko datuetara aldatu, eguneko irteera kenduko bada. Ez da komando-lerroan aplikatzen txantiloiak erabiltzean. »)
self.parser.add_option («- w», »- shortweekday», dest = »shortweekday», default = False, action = »store_true», help = u »Laburtu asteko eguneko datu mota 3 karakteretara. Ez da aplikagarria hemen: komando lerroa txantiloiak erabiltzean. »)
self.parser.add_option («- u», »- hideunits», dest = »hideunits», default = False, action = »store_true», help = u »Ezkutatu mph edo C bezalako unitateak, gradu ikurrak (°) oraindik erakusten da. Ez da komando lerroan aplikatzen txantiloiak erabiltzean.
self.parser.add_option ("- v", "- verbose", dest = "verbose", default = False, action = "store_true", help = u "eskatu irteera zehatza, ideia ona ez da conky-ren bidez exekutatzean!" )
self.parser.add_option ("- r", "- refetch", dest = "berreskuratu", lehenetsia = Faltsua, ekintza = "store_true", laguntza = u "datuak eskuratu iraungitze-datuak kontuan hartu gabe")def parse_args (auto):
(aukerak, argudioak) = self.parser.parse_args ()
itzulera (aukerak, argudioak)def print_help (auto):
itzuli self.parser.print_help ()klaseko EguraldiDatuak:
def __init __ (norbera, aste_eguna, baxua, altua, baldintza_kodea, baldintza_testua, prezipitazioa, hezetasuna, haize_dir, haize_abiadura, haize_gusts, hiria, egunsentia, ilunabarra, ilargia_fasea, ilargia_ikonoa, barra_irakurra, barra_desc):
self.we_of_week = u »» + week_of_week
auto.low = u »» + baxua
auto.high = u »» + high
auto.kondizio_kode = u »» + baldintza_kode
self.condition_text = u »» + baldintza_text
self.precip = u »» + prezip
auto.humiditatea = u »» + hezetasuna
self.wind_dir = u »» + haize_dir
self.wind_speed = u »» + haize_abiadura
norberak.wind_winds = u »» + haize_gusts
auto.hiria = u »» + hiria
auto.eguzkia = u »» + egunsentia
self.sunset = u »» + ilunabarra
auto.ilargia_fase = u »» + ilargia_fase
self.moon_icon = u »» + moon_icon
auto.bar_read = u »» + barra_read
self.bar_desc = u »» + bar_descklaseko WeatherText:
baldintzak_testua = {
«0»: _ (u »Tornado»),
«1»: _ (u »Ekaitz tropikala»),
«2»: _ (u »Urakana»),
«3»: _ (u »Ekaitz larriak»),
«4»: _ (u »Ekaitzak»),
«5»: _ (u »Euria eta elurra nahastuta»),
«6»: _ (u »Euri eta elur nahasketa»),
«7»: _ (u »Prezipitazio mistoa»),
«8»: _ (u »Zirimiri izoztua»),
«9»: _ (u »Zirimiri»),
«10»: _ (u »Izozte euria»),
«11»: _ (u »Dutxak»),
«12»: _ (u »Dutxak»),
«13»: _ (u »Elur zaparradak»),
«14»: _ (u »Elur zaparrada arinak»),
«15»: _ (u »Elurra botatzen»),
«16»: _ (u »Elurra»),
«17»: _ (u »Agur»),
«18»: _ (u »Txirrina»),
«19»: _ (u »Hauts»),
«20»: _ (u »Lainoa»),
«21»: _ (u »Haze»),
«22»: _ (u »Kea»),
«23»: _ (u »Blustery»),
«24»: _ (u »Haizetsua»),
«25»: _ (u »Hotza»),
«26»: _ (u »Hodeitsua»),
«27»: _ (u »Oso Hodeitsua»),
«28»: _ (u »Oso Hodeitsua»),
«29»: _ (u »Ostarteak»),
«30»: _ (u »Ostarteak»),
«31»: _ (u »Garbitu»),
«32»: _ (u »Garbitu»),
«33»: _ (u »Azoka»),
«34»: _ (u »Azoka»),
«35»: _ (u »Euria eta kazkabarra nahastuta»),
«36»: _ (u »Hot»),
«37»: _ (u »Ekaitz isolatuak»),
«38»: _ (u »Ekaitz ekaitzak»),
«39»: _ (u »Ekaitz ekaitzak»),
«40»: _ (u »Sakabanatutako dutxak»),
«41»: _ (u »Elur gogorra»),
«42»: _ (u »Sakabanatutako elur zaparradak»),
«43»: _ (u »Elur gogorra»),
«44»: _ (u »Ostarteak»),
«45»: _ (u »Thunder Showers»),
«46»: _ (u »Elur zaparradak»),
«47»: _ (u »Ekaitz isolatuak»),
«Na»: _ (u »N / A»),
"-": _ (a ")
}baldintzak_testua_es = {
«0»: _ (u »Tornado»),
«1»: _ (u »Ekaitz tropikala»),
«2»: _ (u »Huracá¡n»),
«3»: _ (u »Ekaitz indartsuak»),
«4»: _ (u »Ekaitzak»),
«5»: _ (u »Euria eta elurra nahastuta»),
«6»: _ (u »Euri eta elur nahasketa»),
«7»: _ (u »Lurmuturra»),
«8»: _ (u »Zirimiri izoztua»),
«9»: _ (u »Zirimiri»),
«10»: _ (u »Izozte euria»), # edo euri izoztua
«11»: _ (u »Dutxak»),
«12»: _ (u »Dutxak»),
«13»: _ (u »Elur argia»),
«14»: _ (u »Elur argia»),
«15»: _ (u »Snow Blizzard»),
«16»: _ (u »Elurra»),
«17»: _ (u »Agur»),
«18»: _ (u »Lurmuturra»),
«19»: _ (u »Hauts»),
«20»: _ (u »Lainoa»),
«21»: _ (u »Haze»),
«22»: _ (u »Kea»),
«23»: _ (u »Ekaitza»),
«24»: _ (u »Haizetsua»),
«25»: _ (u »Fráo»),
«26»: _ (u »Oso hodeitsua»),
«27»: _ (u »Oso Hodeitsua»),
«28»: _ (u »Oso Hodeitsua»),
«29»: _ (u »Ostarteak»),
«30»: _ (u »Ostarteak»),
«31»: _ (u »Garbitu»),
«32»: _ (u »Garbitu»),
«33»: _ (u »Zerbait lainotuta»),
«34»: _ (u »Zerbait lainotuta»),
«35»: _ (u »Kazkabarrarekin euria»),
«36»: _ (u »Beroa»),
«37»: _ (u »Ekaitz isolatuak»),
«38»: _ (u »Ekaitz sakabanatuak»),
«39»: _ (u »Ekaitz sakabanatuak»),
«40»: _ (u »Sakabanatutako dutxak»),
«41»: _ (u »Elur gogorra»),
«42»: _ (u »Elurte ahulak eta sakabanatuak»),
«43»: _ (u »Nevada bizia»),
«44»: _ (u »Sakabanatutako hodeiak»),
«45»: _ (u »Ekaitzak»),
«46»: _ (u »Sakabanatutako elurteak»),
«47»: _ (u »Ekaitz isolatuak»),
«Na»: _ (u »N / A»),
"-": _ (a ")
}CONDIONS_TEXT_FR = {
«0»: _ (u »Tornade»),
«1»: _ (u »Tempête Tropicale»),
«2»: _ (edo »Ouragan»),
«3»: _ (edo »Orages Violents»),
«4»: _ (edo »Orageux»),
«5»: _ (u »Pluie et Neige»),
«6»: _ (u »Pluie et Neige Mouillée»),
«7»: _ (u »Variable avec averses»),
«8»: _ (u »Bruine Givrante»),
«9»: _ (u »Bruine»),
«10»: _ (u »Pluie Glacante»),
«11»: _ (u »Averses»),
«12»: _ (u »Averses»),
«13»: _ (u »Légère Neige»),
«14»: _ (u »Forte Neige»),
«15»: _ (u »Tempête de Neige»),
«16»: _ (u »Neige»),
«17»: _ (u »Grêle»),
«18»: _ (u »Pluie / Neige»),
«19»: _ (u »Nuage de poussière»),
«20»: _ (u »Brouillard»),
«21»: _ (u »Brume»),
«22»: _ (u »Fumée»),
«23»: _ (u »Tres Venteux»),
«24»: _ (u »Venteux»),
«25»: _ (u »Froid»),
«26»: _ (u »Nuageux»),
«27»: _ (u »Tres Nuageux»),
«28»: _ (u »Tres Nuageux»),
«29»: _ (u »Nuages Disséminés»),
«30»: _ (u »Nuages Disséminés»),
«31»: _ (u »Beau»),
«32»: _ (u »Beau»),
«33»: _ (u »Belles Éclaircies»),
«34»: _ (u »Belles Éclaircies»),
«35»: _ (u »Pluie avec Grêle»),
«36»: _ (u »Chaleur»),
«37»: _ (edo »Orages Isolés»),
«38»: _ (edo »Orages Localisés»),
«39»: _ (edo »Orages Localisés»),
«40»: _ (u »Averses Localisées»),
«41»: _ (u »Neige Lourde»),
«42»: _ (u »Tempête de Neige Localisées»),
«43»: _ (u »Neige Lourde»),
«44»: _ (u »Nuages Disséminés»),
«45»: _ (edo »Orages»),
«46»: _ (u »Tempête de Neige»),
«47»: _ (edo »Orages Isolés»),
«Na»: _ (u »N / A»),
"-": _ (a ")
}Conditions_weather_font = {
«0»: _ (u »W»),
«1»: _ (u »V»),
«2»: _ (u »W»),
«3»: _ (u »s»),
«4»: _ (u »p»),
«5»: _ (u »k»),
«6»: _ (u »k»),
«7»: _ (u »g»),
«8»: _ (u »g»),
«9»: _ (u »g»),
«10»: _ (u »h»),
«11»: _ (u »g»),
«12»: _ (u »g»),
«13»: _ (u »k»),
«14»: _ (u »k»),
«15»: _ (u »k»),
«16»: _ (u »k»),
«17»: _ (u »k»),
«18»: _ (u »k»),
«19»: _ (u »e»),
«20»: _ (u »e»),
«21»: _ (u »a»),
«22»: _ (u »d»),
«23»: _ (u »d»),
«24»: _ (u »d»),
«25»: _ (u »d»),
«26»: _ (u »e»),
«27»: _ (u »e»),
«28»: _ (u »e»),
«29»: _ (u »c»),
«30»: _ (u »c»),
«31»: _ (u »a»),
«32»: _ (u »a»),
«33»: _ (u »b»),
«34»: _ (u »b»),
«35»: _ (u »k»),
«36»: _ (u »a»),
«37»: _ (u »f»),
«38»: _ (u »f»),
«39»: _ (u »f»),
«40»: _ (u »g»),
«41»: _ (u »k»),
«42»: _ (u »k»),
«43»: _ (u »k»),
«44»: _ (u »b»),
«45»: _ (u »g»),
«46»: _ (u »k»),
«47»: _ (u »f»),
«Na»: _ (u »»),
"-": _ (edo "")
}CONDIONS_MOON_FONT = {
«0»: _ (u »1 ″),
«1»: _ (u »N»),
«2»: _ (u »O»),
«3»: _ (u »P»),
«4»: _ (u »Q»),
«5»: _ (u »R»),
«6»: _ (u »S»),
«7»: _ (u »T»),
«8»: _ (u »U»),
«9»: _ (u »V»),
«10»: _ (u »W»),
«11»: _ (u »X»),
«12»: _ (u »Y»),
«13»: _ (u »Z»),
«14»: _ (u »0 ″),
«15»: _ (u »0 ″),
«16»: _ (u »A»),
«17»: _ (u »B»),
«18»: _ (u »C»),
«19»: _ (u »D»),
«20»: _ (u »E»),
«21»: _ (u »F»),
«22»: _ (u »G»),
«23»: _ (u »H»),
«24»: _ (u »I»),
«25»: _ (u »J»),
«26»: _ (u »K»),
«27»: _ (u »L»),
«28»: _ (u »M»),
«29»: _ (u »1 ″),
«Na»: _ (u »»),
"-": _ (edo "")
}asteko_eguna = {
"Gaur": _ (edo "Gaur"),
«Astelehena»: _ (u »astelehena»),
«Asteartea»: _ (u »asteartea»),
«Asteazkena»: _ (u »asteazkena»),
«Osteguna»: _ (u »osteguna»),
«Ostirala»: _ (u »ostirala»),
"Larunbata": _ (u "Larunbata"),
"Igandea": _ (u "igandea")
}asteko_eguna_laburra = {
"Gaur": _ (u "Orain"),
«Astelehena»: _ (u »astelehena),
«Asteartea»: _ (u »asteartea»),
«Asteazkena»: _ (u »az.»),
«Osteguna»: _ (u »jue»),
«Ostirala»: _ (u »ost.»),
"Larunbata": _ (u "Sat"),
"Igandea": _ (u "Eguzkia")
}asteko_eguna = {
"Gaur": _ (u "gaur"),
«Astelehena»: _ (u »astelehena»),
«Asteartea»: _ (u »asteartea»),
«Asteazkena»: _ (u »asteazkena»),
«Osteguna»: _ (u »osteguna»),
«Ostirala»: _ (u »ostirala»),
"Larunbata": _ (u "Larunbata"),
"Igandea": _ (u "igandea")
}day_of_week_short_eu = {
"Gaur": _ (u "gaur"),
"Astelehena": _ (u "mon"),
«Asteartea»: _ (u »itsasoa»),
«Asteazkena»: _ (u »wed»),
«Osteguna»: _ (u »Osteguna»),
«Ostirala»: _ (u »fri»),
"Larunbata": _ (u "eseri"),
"Igandea": _ (u "dom")
}asteko_eguna_fr = {
«Gaur»: _ (u »Aujourd'hui»),
«Astelehena»: _ (u »Lundi»),
«Asteartea»: _ (u »Mardi»),
«Asteazkena»: _ (u »Mercredi»),
«Osteguna»: _ (u »Jeudi»),
«Ostirala»: _ (u »Vendredi»),
"Larunbata": _ (u "Samedi"),
"Igandea": _ (u "Dimanche")
}day_of_week_short_fr = {
«Gaur»: _ (u »Auj»),
"Astelehena": _ (u "Mon"),
«Asteartea»: _ (u »Mar»),
"Asteazkena": _ (u "Mer"),
«Osteguna»: _ (u »Jeu»),
«Ostirala»: _ (u »Etorri»),
"Larunbata": _ (u "Sam"),
"Igandea": _ (u "Dim")
}BEARING_ARROW_FONT = {
«N»: _ (u »i»),
«NNE»: _ (u »j»),
«NE»: _ (u »k»),
«ENE»: _ (u »l»),
«E»: _ (u »m»),
«ESE»: _ (u »n»),
"SE": _ (u "o"),
«SSE»: _ (u »p»),
«S»: _ (u »a»),
«SSW»: _ (u »b»),
«SW»: _ (u »c»),
"WSW": _ (u "d"),
«W»: _ (u »e»),
"WNW": _ (u "f"),
«NW»: _ (u »g»),
«NNW»: _ (u »h»),
«N / A»: _ (u »«)
}bearing_text_eu = {
«N»: _ (u »N»),
«NNE»: _ (u »NNE»),
«NE»: _ (u »NE»),
«ENE»: _ (u »ENE»),
«E»: _ (u »E»),
«ESE»: _ (u »ESE»),
«SE»: _ (u »SE»),
"SSE": _ (u "SSE"),
"Haien"),
"SSW": _ (u "SSO"),
«SW»: _ (u »SO»),
"WSW": _ (u "WOW"),
«W»: _ (u »O»),
«WNW»: _ (u »ONO»),
«NW»: _ (u »EZ»),
«NNW»: _ (u »NNO»),
«N / A»: _ (u »N \ A»)
}Bearing_text_fr = {
«N»: _ (u »N»),
«NNE»: _ (u »NNE»),
«NE»: _ (u »NE»),
«ENE»: _ (u »ENE»),
«E»: _ (u »E»),
«ESE»: _ (u »ESE»),
«SE»: _ (u »SE»),
"SSE": _ (u "SSE"),
"Haien"),
"SSW": _ (u "SSO"),
«SW»: _ (u »SO»),
"WSW": _ (u "WOW"),
«W»: _ (u »O»),
«WNW»: _ (u »ONO»),
«NW»: _ (u »EZ»),
«NNW»: _ (u »NNO»),
«N / A»: _ (u »N \ A»)
}GlobalWeather klasea:
egungo_baldintzak = []
egun_iragarpena = []
gau_iragarpena = []locale = "in"
aukerak = Bat ere ez
weatherxmldoc = ""TEMP_FILEPATH_CURRENT = "/tmp/conkyForecast-c-LOCATION.pkl"
TEMP_FILEPATH_DAYFORECAST = "/tmp/conkyForecast-df-LOCATION.pkl"
TEMP_FILEPATH_NIGHTFORECAST = "/tmp/conkyForecast-nf-LOCATION.pkl"
EXPIRY_MINUTES = 30
DEFAULT_SPACING = u »«def __init __ (auto, aukerak):
auto. aukerak = aukerak
self.options.locale bada == Bat ere ez:
saiatu:
# self.locale = locale.getdefaultlocale () [0] [0: 2]
self.locale = «es» #komentatu lerro hau gaztelaniazko lokala behartzeko
# self.locale = "fr" #komentatu lerro hau frantseseko lokala behartzeko
ezik:
inprimatu "ezarrita dagoen lokala"
bestela:
# self.locale = auto. aukerak.locale
self.locale = «es» #komentatu lerro hau gaztelaniazko lokala behartzeko
# self.locale = "fr" #komentatu lerro hau frantseseko lokala behartzekoself.options.verbose bada == Egia:
inprimatu >> sys.stdout, "ezarrita dagoen lokala", self.localedef getText (auto, nodelist):
rc = ""
nodelisteko nodoarentzako:
node.nodeType == node.TEXT_NODE bada:
rc = rc + nodo.datuak
itzuli rcdef getSpaces (norbera, espazioak):
katea = u »»
espazioak == Bat ere ez:
katea = auto.DEFAULT_SPACING
bestela:
i barrutian (0, zuriuneak + 1):
katea = katea + u »«
itzuli kateadef isNumeric (norbera, katea):
saiatu:
dummy = karroza (katea)
itzuli Egia
ezik:
itzuli Faltsuadef isConnectionAvailable (auto):
# ziurtatu weather.com zerbitzarian sar gaitezkeela URLa irekiz
saiatu:
Usock = urllib2.urlopen ('http://xoap.weather.com')
Usock.close ()
itzuli Egia
ezik:
itzuli Faltsuadef getBearingText (norbera, errodamendua):
bearing = karroza (bearing)
<11.25 baldin badu:
itzuli u »N»
elif bearing <33.75:
itzuli u »NNE»
elif bearing <56.25:
itzuli u »NE»
elif bearing <78.75:
itzuli u »URT»
elif bearing <101.25:
itzuli u »E»
elif bearing <123.75:
itzuli u »ESE»
elif bearing <146.25:
itzuli u »SE»
elif bearing <168.75:
itzuli u »SSE»
elif bearing <191.25:
itzuli u »S»
elif bearing <213.75:
itzuli u »SSW»
elif bearing <236.25:
itzuli u »SW»
elif bearing <258.75:
itzuli u »WSW»
elif bearing <281.25:
itzuli u »W»
elif bearing <303.75:
itzuli u »WNW»
elif bearing <326.25:
itzuli u »NW»
elif bearing <348.75:
itzuli u »NNW»
bestela:
itzuli «N / A»def convertCelsiusToFahrenheit (auto, tenperatura):
return str (int (floor (((float (temp) * 9.0) /5.0) +32)))def convertKilometresToMiles (auto, dist):
return str (int (solairua (float (dist) * 0.621371192)))def convertMillibarsToInches (auto, mb):
return str (int (solairua (float (mb) /33.8582)))def getTemplateList (auto, txantiloia):
txantiloi-zerrenda = []
template.part-en template.split-en («{«):
template_part! bada! = «»:
template_part-en template_part.split-en ("}")
template_part! bada! = «»:
templatelist.append (u »» + template_part)itzuli txantiloien zerrenda
def getOutputText (norbera, datu mota, hasiera eguna, amaiera eguna, gaua, aste laburra, inperiala, ezkutuko unitateak, espazioak):
# saiakera:
irteera = u »»# definitu irteerako unitate unitateak
ezkutuko unitateak == Gezurra:
inperiala bada == Gezurra:
tenperatura = u »° C»
speedunit = u »kph»
presio unitatea = u »mb»
bestela:
tenperatura = u »° F»
speedunit = u »mph»
pressureunit = u »in»
bestela:
tenperatura = u »°»
speedunit = u »»
pressureunit = u »»hasiera eguna == Bat ere ez: # uneko baldintzak
datu mota == "DW" bada:
self.locale == "bada":
aste laburra bada == Egia:
output = WeatherText.day_of_week_short_es [self.current_conditions [0] .day_of_week]
bestela:
output = WeatherText.day_of_week_es [self.current_conditions [0] .day_of_week]
elif self.locale == "fr":
aste laburra bada == Egia:
output = WeatherText.day_of_week_short_fr [self.current_conditions [0] .day_of_week]
bestela:
output = WeatherText.day_of_week_fr [self.current_conditions [0] .day_of_week]
bestela:
aste laburra bada == Egia:
output = WeatherText.day_of_week_short [self.current_conditions [0] .day_of_week]
bestela:
output = WeatherText.day_of_week [self.current_conditions [0] .day_of_week]
elif datatype == "WF": # weather type
output = WeatherText.conditions_weather_font [self.current_conditions [0] .condition_code]
elif datu mota == "LT":
string = self.current_conditions [0] .low
self.isNumeric bada (katea) == Egia:
inperiala bada == Egia:
katea = self.convertCelsiusToFahrenheit (katea)
katea = katea + tenperatura
irteera = katea
elif datu mota == "HT":
string = self.current_conditions [0] .high
self.isNumeric bada (katea) == Egia:
inperiala bada == Egia:
katea = self.convertCelsiusToFahrenheit (katea)
katea = katea + tenperatura
irteera = katea
elif datu mota == "CC":
self.locale == "bada":
output = WeatherText.conditions_text_es [self.current_conditions [0] .condition_code]
elif self.locale == "fr":
output = WeatherText.conditions_text_fr [self.current_conditions [0] .condition_code]
bestela:
output = WeatherText.conditions_text [self.current_conditions [0] .condition_code]
elif datu mota == "CT":
output = self.current_conditions [0] .condition_text
elif datu mota == "PC":
string = self.current_conditions [0] .precip
self.isNumeric bada (katea) == Egia:
katea = katea + u »%»
irteera = katea
elif datu mota == "HM":
string = self.current_conditions [0] .humility
self.isNumeric bada (katea) == Egia:
katea = katea + u »%»
irteera = katea
elif datu mota == "WD":
string = self.current_conditions [0] .wind_dir
self.isNumeric bada (katea) == Egia:
katea = self.getBearingText (katea)self.locale == "bada":
output = WeatherText.bearing_text_es [katea]
elif self.locale == "fr":
output = WeatherText.bearing_text_fr [katea]
bestela:
irteera = kateaelif datu mota == "BF":
string = self.current_conditions [0] .wind_dir
self.isNumeric bada (katea) == Egia:
katea = WeatherText.bearing_arrow_font [self.getBearingText (katea)]
irteera = katea
elif datu mota == "WS":
string = self.current_conditions [0] .wind_speed
self.isNumeric bada (katea) == Egia:
inperiala bada == Egia:
katea = self.convertKilometresToMiles (katea)
katea = katea + abiadura-unitatea
irteera = katea
elif datu mota == "WG":
string = self.current_conditions [0] .wind_gusts
self.isNumeric bada (katea) == Egia:
inperiala bada == Egia:
katea = self.convertKilometresToMiles (katea)
katea = katea + abiadura-unitatea
irteera = katea
elif datu mota == "CN":
output = self.current_conditions [0] .hiria
elif datu mota == "SR":
irteera = self.current_conditions [0] .sunrise
elif datu mota == "SS":
output = self.current_conditions [0] .sunset
elif datu mota == "MP":
output = self.current_conditions [0] .moon_phase
elif datu mota == "MF":
output = WeatherText.conditions_moon_font [self.current_conditions [0] .moon_icon]
elif datu mota == "BR":
string = self.current_conditions [0] .bar_read
self.isNumeric bada (katea) == Egia:
inperiala bada == Egia:
katea = self.convertMillibarsToInches (katea)
katea = katea + presio unitatea
irteera = katea
elif datu mota == "BD":
output = self.current_conditions [0] .bar_desc
bestela:
output = "\ nERROR: datu mota ezezaguna eskatu da"bestela: # iragarpen datuak
endday == None: # endday ezarrita ez badago erabili startday
endday = hasiera egunabada gaua == Egia: # gaueko iragarpena behar da
barrutiko egun_zenbakirako (hasiera, amaiera + 1):
datu mota == "DW" bada:
self.locale == "bada":
aste laburra bada == Egia:
output = output + self.getSpaces (spaces) + WeatherText.we_of_week_short_es [self.night_forecast [day_number] .day_of_week]
bestela:
output = output + self.getSpaces (spaces) + WeatherText.day_of_week_es [self.night_forecast [day_number] .day_of_week]
elif self.locale == "fr":
aste laburra bada == Egia:
output = output + self.getSpaces (espazioak) + WeatherText.we_of_week_short_fr [self.night_forecast [day_number] .day_of_week]
bestela:
irteera = irteera + auto.getSpaces (espazioak) + WeatherText.day_of_week_fr [self.night_forecast [day_number] .day_of_week]
bestela:
aste laburra bada == Egia:
output = output + self.getSpaces (spaces) + WeatherText.day_of_week_short [self.night_forecast [day_number] .day_of_week]
bestela:
output = output + self.getSpaces (espazioak) + WeatherText.day_of_ weekek [self.night_forecast [day_number] .day_ofweek]
elif datatype == "WF": # weather type
output = output + self.getSpaces (espazioak) + WeatherText.conditions_weather_font [self.night_forecast [day_number] .condition_code]
elif datu mota == "LT":
katea = auto.gaua_iragarpena [egun_zenbakia]. baxua
self.isNumeric bada (katea) == Egia:
inperiala bada == Egia:
katea = self.convertCelsiusToFahrenheit (katea)
katea = katea + tenperatura
irteera = irteera + auto.getSpaces (espazioak) + kateaelif datu mota == "HT":
katea = auto.gaua_iragarpena [egun_zenbakia] .high
self.isNumeric bada (katea) == Egia:
inperiala bada == Egia:
katea = self.convertCelsiusToFahrenheit (katea)
katea = katea + tenperatura
irteera = irteera + auto.getSpaces (espazioak) + katea
elif datu mota == "CC":
self.locale == "bada":
output = output + self.getSpaces (espazioak) + WeatherText.conditions_text_es [self.night_forecast [day_number] .condition_code]
elif self.locale == "fr":
output = output + self.getSpaces (espazioak) + WeatherText.conditions_text_fr [self.night_forecast [day_number] .condition_code]
bestela:
output = output + self.getSpaces (espazioak) + WeatherText.conditions_text [self.night_forecast [day_number] .condition_code]
elif datu mota == "CT":
output = output + self.getSpaces (espazioak) + self.night_forecast [day_number] .condition_text
elif datu mota == "PC":
string = self.night_forecast [day_number] .precip
self.isNumeric bada (katea) == Egia:
katea = katea + u »%»
irteera = irteera + auto.getSpaces (espazioak) + katea
elif datu mota == "HM":
string = self.night_forecast [day_number] .humidity
self.isNumeric bada (katea) == Egia:
katea = katea + u »%»
irteera = irteera + auto.getSpaces (espazioak) + katea
elif datu mota == "WD":
katea = auto.gaua_iragarpena [egun_zenbakia] .wind_dir
self.locale == "bada":
output = output + self.getSpaces (espazioak) + WeatherText.bearing_text_es [katea]
elif self.locale == "fr":
output = output + self.getSpaces (espazioak) + WeatherText.bearing_text_fr [katea]
bestela:
irteera = irteera + auto.getSpaces (espazioak) + kateaelif datu mota == "BF":
output = output + self.getSpaces (espazioak) + WeatherText.bearing_arrow_font [self.night_forecast [day_number] .wind_dir]
elif datu mota == "WS":
katea = auto.gau_iragarpena [egun_zenbakia] .wind_speed
self.isNumeric bada (katea) == Egia:
inperiala bada == Egia:
katea = self.convertKilometresToMiles (katea)
katea = katea + abiadura-unitatea
irteera = irteera + auto.getSpaces (espazioak) + katea
elif datu mota == "WG":
katea = auto.gaua_iragarpena [egun_zenbakia] .wind_gusts
self.isNumeric bada (katea) == Egia:
inperiala bada == Egia:
katea = self.convertKilometresToMiles (katea)
katea = katea + abiadura-unitatea
irteera = irteera + auto.getSpaces (espazioak) + katea
elif datu mota == "CN":
output = output + self.getSpaces (espazioak) + self.night_forecast [day_number] .city
elif datu mota == "SR":
output = output + self.getSpaces (espazioak) + self.night_forecast [day_number] .sunrise
elif datu mota == "SS":
output = output + self.getSpaces (espazioak) + self.night_forecast [day_number] .sunset
elif datu mota == "MP":
output = output + self.getSpaces (espazioak) + self.night_forecast [day_number] .moon_phase
elif datu mota == "MF":
output = output + self.getSpaces (espazioak) + WeatherText.conditions_moon_font [self.night_forecast [day_number] .moon_icon]
elif datu mota == "BR":
output = output + self.getSpaces (espazioak) + self.night_forecast [day_number] .bar_read
elif datu mota == "BD":
output = output + self.getSpaces (espazioak) + self.night_forecast [day_number] .bar_desc
bestela:
output = "\ nERROR: datu mota ezezaguna eskatu da"
apurtubestela: # eguneko iragarpena nahi da
barrutiko egun_zenbakirako (hasiera, amaiera + 1):
datu mota == "DW" bada:
self.locale == "bada":
aste laburra bada == Egia:
output = output + self.getSpaces (espazioak) + WeatherText.we_of_week_short_es [self.day_forecast [day_number] .day_of_week]
bestela:
output = output + self.getSpaces (spaces) + WeatherText.day_of_week_es [self.day_forecast [day_number] .day_of_week]
elif self.locale == "fr":
aste laburra bada == Egia:
irteera = irteera + auto.getSpaces (espazioak) + WeatherText.we_of_week_short_fr [self.day_forecast [day_number] .day_of_week]
bestela:
output = output + self.getSpaces (spaces) + WeatherText.day_of_week_fr [self.day_forecast [day_number] .day_of_week]
bestela:
aste laburra bada == Egia:
output = output + self.getSpaces (spaces) + WeatherText.day_of_week_short [self.day_forecast [day_number] .day_of_week]
bestela:
output = output + self.getSpaces (espazioak) + WeatherText.day_of_ weekek [self.day_forecast [day_number] .day_of_week]
elif datatype == "WF": # weather type
output = output + self.getSpaces (espazioak) + WeatherText.conditions_weather_font [self.day_forecast [day_number] .condition_code]
elif datu mota == "LT":
katea = auto.eguna_iragarpena [egun_zenbakia]. baxua
self.isNumeric bada (katea) == Egia:
inperiala bada == Egia:
katea = self.convertCelsiusToFahrenheit (katea)
katea = katea + tenperatura
irteera = irteera + auto.getSpaces (espazioak) + katea
elif datu mota == "HT":
katea = auto.eguna_iragarpena [egun_zenbakia] .high
self.isNumeric bada (katea) == Egia:
inperiala bada == Egia:
katea = self.convertCelsiusToFahrenheit (katea)
katea = katea + tenperatura
irteera = irteera + auto.getSpaces (espazioak) + katea
elif datu mota == "CC":
self.locale == "bada":
output = output + self.getSpaces (spaces) + WeatherText.conditions_text_es [self.day_forecast [day_number] .condition_code]
elif self.locale == "fr":
output = output + self.getSpaces (spaces) + WeatherText.conditions_text_fr [self.day_forecast [day_number] .condition_code]
bestela:
output = output + self.getSpaces (espazioak) + WeatherText.conditions_text [self.day_forecast [day_number] .condition_code]
elif datu mota == "CT":
output = output + self.getSpaces (espazioak) + self.day_forecast [day_number] .condition_text
elif datu mota == "PC":
string = self.day_forecast [day_number] .precip
self.isNumeric bada (katea) == Egia:
katea = katea + u »%»
irteera = irteera + auto.getSpaces (espazioak) + katea
elif datu mota == "HM":
katea = auto.eguna_iragarpena [egun_zenbakia]. hezetasuna
self.isNumeric bada (katea) == Egia:
katea = katea + u »%»
irteera = irteera + auto.getSpaces (espazioak) + katea
elif datu mota == "WD":
katea = auto.eguna_iragarpena [egun_zenbakia] .wind_dirself.locale == "bada":
output = output + self.getSpaces (espazioak) + WeatherText.bearing_text_es [katea]
elif self.locale == "fr":
output = output + self.getSpaces (espazioak) + WeatherText.bearing_text_fr [katea]
bestela:
irteera = irteera + auto.getSpaces (espazioak) + kateaelif datu mota == "BF":
output = output + self.getSpaces (espazioak) + WeatherText.bearing_arrow_font [self.day_forecast [day_number] .wind_dir]
elif datu mota == "WS":
katea = auto.eguna_iragarpena [egun_zenbakia] .wind_speed
self.isNumeric bada (katea) == Egia:
inperiala bada == Egia:
katea = self.convertKilometresToMiles (katea)
katea = katea + abiadura-unitatea
irteera = irteera + auto.getSpaces (espazioak) + katea
elif datu mota == "WG":
katea = auto.eguna_iragarpena [egun_zenbakia] .wind_gusts
self.isNumeric bada (katea) == Egia:
inperiala bada == Egia:
katea = self.convertKilometresToMiles (katea)
katea = katea + abiadura-unitatea
irteera = irteera + auto.getSpaces (espazioak) + katea
elif datu mota == "CN":
output = output + self.getSpaces (espazioak) + self.day_forecast [day_number] .city
elif datu mota == "SR":
output = output + self.getSpaces (espazioak) + self.day_forecast [day_number] .sunrise
elif datu mota == "SS":
output = output + self.getSpaces (espazioak) + self.day_forecast [day_number] .sunset
elif datu mota == "MP":
output = output + self.getSpaces (espazioak) + self.day_forecast [day_number] .moon_phase
elif datu mota == "MF":
output = output + self.getSpaces (espazioak) + WeatherText.conditions_moon_font [self.day_forecast [day_number] .moon_icon]
elif datu mota == "BR":
output = output + self.getSpaces (espazioak) + self.day_forecast [day_number] .bar_read
elif datu mota == "BD":
output = output + self.getSpaces (espazioak) + self.day_forecast [day_number] .bar_desc
bestela:
output = u »\ nERROR: datu mota ezezaguna eskatu da»
apurtuoutput = u »» + output.strip (u »«) # galdu / amaierako espazioak galdu
itzultzeko irteera# salbu:
#print "getOutputText: Ustekabeko errorea:", sys.exc_info () [0]def getOutputTextFromTemplate (norbera, txantiloia):
# saiakera:# gako txantiloien datuetarako
DATATYPE_KEY = "–datatype ="
STARTDAY_KEY = "–startday ="
ENDDAY_KEY = "–endday ="
NIGHT_KEY = "–gaua"
SHORTWEEKDAY_KEY = "–egun laburra"
IMPERIAL_KEY = "–imperial"
HIDEUNITS_KEY = "– ezkutuko unitateak"
SPACES_KEY = "–spaces ="irteera = u »»
optionfound = Faltsua
#kargatu fitxategia
saiatu:
fileinput = irekia (self.options.template)
template = fileinput.read ()
fileinput.close ()
ezik:
output = u »Txantiloi fitxategia ez da aurkitu!»templatelist = self.getTemplateList (txantiloia)
# aukera ematen du txantiloien zerrendan zehar eta aurkitutako elementu bakoitzaren irteera zehazten
i barrutian (0, len (templatelist) -1):pos = templatelist [i] .find (DATATYPE_KEY)
pos bada! = -1:
optionfound = Egia
pos = pos + len (DATATYPE_KEY)
datatype = templatelist [i] [pos: pos + 4] .strip ("}"). strip ("{"). strip ("-"). strip ("" ")
bestela:
datatype = Bat ere ezpos = templatelist [i] .find (STARTDAY_KEY)
pos bada! = -1:
optionfound = Egia
pos = pos + len (STARTDAY_KEY)
startday = int (templatelist [i] [pos: pos + 4] .strip ("}"). strip ("{"). strip ("-"). strip ("" "))
bestela:
hasiera eguna = Bat ere ezpos = templatelist [i] .find (ENDDAY_KEY)
pos bada! = -1:
optionfound = Egia
pos = pos + len (ENDDAY_KEY)
endday = int (templatelist [i] [pos: pos + 4] .strip ("}"). strip ("{"). strip ("-"). strip ("" "))
bestela:
endday = Bat ere ezpos = templatelist [i] .find (NIGHT_KEY)
pos bada! = -1:
optionfound = Egia
gaua = Egia
bestela:
gaua = Faltsuapos = templatelist [i] .find (SHORTWEEKDAY_KEY)
pos bada! = -1:
optionfound = Egia
shortweekday = Egia
bestela:
aste laburra = Faltsuapos = templatelist [i] .find (IMPERIAL_KEY)
pos bada! = -1:
optionfound = Egia
inperiala = Egia
bestela:
inperiala = Faltsuapos = templatelist [i] .find (HIDEUNITS_KEY)
pos bada! = -1:
optionfound = Egia
hideunits = Egia
bestela:
ezkutalekuak = Faltsuapos = templatelist [i] .find (SPACES_KEY)
pos bada! = -1:
optionfound = Egia
pos = pos + len (SPACES_KEY)
espazioak = int (templatelist [i] [pos: pos + 4] .strip («}»). strip («{«). strip («-«). strip (»«))
bestela:
espazioak = 1aukera aurkitu bada == Egia:
templatelist [i] = self.getOutputText (datu mota, hasiera eguna, amaiera eguna, gaua, aste laburra, inperiala, ezkutuko unitateak, espazioak)
optionfound = Faltsua# joan irteera kateatzen duen zerrendan, orain bete egin da
txantiloien zerrendako elementurako:
irteera = irteera + elementuaitzultzeko irteera
# salbu:
#print "getOutputTextFromTemplate: Ustekabeko errorea:", sys.exc_info () [0]def fetchData (auto):
# Eskuratu beti datu metrikoak, erabili elkarrizketa funtzioak datu horietan
file_path_current = self.TEMP_FILEPATH_CURRENT.replace ("KOKAPENA", self.options.location)
file_path_dayforecast = self.TEMP_FILEPATH_DAYFORECAST.replace ("LOCATION", self.options.location)
file_path_nightforecast = self.TEMP_FILEPATH_NIGHTFORECAST.replace ("LOCATION", self.options.location)self.isConnectionAvailable bada () == Gezurra:
os.path.exists badago (file_path_current):
RefetchData = Gezurra
bestela: # ez konexiorik, ez katxerik, bang!
print "Ez dago Interneteko konexiorik erabilgarri eta ez dago cacheko eguraldiaren daturik."
elif self.options.refetch == Egia:
RefetchData = Egia
bestela:
# datuak berreskuratu behar al dira berriro?
os.path.exists badago (file_path_current):
lastmodDate = time.localtime (os.stat (file_path_current) [ST_MTIME])
expiryDate = (datetime.datetime.today () - datetime.timedelta (minutes = self.EXPIRY_MINUTES)). scheduluple ()expiryDate> lastmodDate bada:
RefetchData = Egia
bestela:
RefetchData = Gezurra
bestela:
RefetchData = Egia# eskuratu uneko baldintzen datuak, webgunetik edo "desegin" eginez.
RefetchData == egia bada:# eskuratu uneko baldintzen datuak xoap zerbitzutik
saiatu:# http://xoap.weather.com/weather/local/UKXX0103?cc=*&dayf=5&link=xoap∏=xoap&par=1061785028&key=e374effbfd74930b
url = 'http://xoap.weather.com/weather/local/' + self.options.location + '? cc = * & dayf = 8 & link = xoap∏ = xoap & par = 1061785028 & key = e374effbfd74930b & unitatea = m '
self.options.verbose bada == Egia:
inprimatu >> sys.stdout, «eguraldiaren datuak eskuratuz», urlUsock = urllib2.urlopen (url)
xml = usock.read ()
Usock.close ()
self.weatherxmldoc = minidom.parseString (xml)
ezik:
print "fetchData: Ustekabeko errorea:", sys.exc_info () [0]
print "Ezin da eguraldi iturriarekin jarri harremanetan uneko baldintzetarako"# esan erabiltzaileari kokapena txarra den ala ez ...
found = xml.find ("Kokapen baliogabea eman da")
aurkitzen bada! = -1:
print "Emandako kokapen baliogabea"# galdetu eguraldiaren datuak, kargatu klasearen egituran eta pikatu
saiatu:# eguraldi datuen zerrendak prestatu
self.current_conditions = []
self.day_forecast = []
self.night_forecast = []# datu orokorrak bildu
weather_n = self.weatherxmldoc.documentElement
location_n = weather_n.getElementsByTagName ('loc') [0]
city_n = location_n.getElementsByTagName ('dnam') [0]
hiria = self.getText (city_n.childNodes)# bildu uneko baldintzen datuak
day_of_week = u »Gaur»
precip = u »N / A»
sunrise_n = location_n.getElementsByTagName ('sunr') [0]
sunrise = self.getText (sunrise_n.childNodes)
sunset_n = location_n.getElementsByTagName ('suns') [0]
sunset = self.getText (sunset_n.childNodes)
current_condition_n = weather_n.getElementsByTagName ('cc') [0]
current_desc_n = current_condition_n.getElementsByTagName ('t') [0]
current_desc = self.getText (current_desc_n.childNodes)
current_code_n = current_condition_n.getElementsByTagName ('ikonoa') [0]
current_code = self.getText (current_code_n.childNodes)
current_temp_n = current_condition_n.getElementsByTagName ('tmp') [0]
current_temp = self.getText (current_temp_n.childNodes)
current_temp_feels_n = current_condition_n.getElementsByTagName ('flik') [0]
current_temp_feels = self.getText (current_temp_feels_n.childNodes)
bar_n = current_condition_n.getElementsByTagName ('barra') [0]
bar_read_n = bar_n.getElementsByTagName ('r') [0]
bar_read = self.getText (bar_read_n.childNodes)
bar_desc_n = bar_n.getElementsByTagName ('d') [0]
bar_desc = self.getText (bar_desc_n.childNodes)
wind_n = current_condition_n.getElementsByTagName ('haizea') [0]
wind_speed_n = wind_n.getElementsByTagName ('s') [0]
wind_speed = self.getText (wind_speed_n.childNodes)
wind_gust_n = wind_n.getElementsByTagName ('bolada') [0]
wind_gusts = self.getText (wind_gust_n.childNodes)
wind_dir_n = wind_n.getElementsByTagName ('d') [0]
wind_direction = self.getText (wind_dir_n.childNodes)
hezetasuna_n = current_condition_n.getElementsByTagName ('hmid') [0]
hezetasuna = self.getText (hezetasuna_n.childNodes)
moon_n = current_condition_n.getElementsByTagName ('moon') [0]
moon_icon_n = moon_n.getElementsByTagName ('ikonoa') [0]
moon_icon = self.getText (moon_icon_n.childNodes)
moon_phase_n = moon_n.getElementsByTagName ('t') [0]
moon_phase = self.getText (moon_phase_n.childNodes)
current_conditions_data = WeatherData (day_of_ week, current_temp_feels, current_temp, current_code, current_desc, precip, hezetasuna, haizearen norabidea, haizearen abiadura, haizearen gustuak, hiria, egunsentia, ilunabarra, ilargiaren fasea, ilargiaren ikonoa, barra_irudia, barra_desc)
self.current_conditions.append (current_conditions_data)# bildu aurreikuspen datuak
barra_irakurri = u »N / A»
bar_desc = u »N / A»
moon_phase = u »N / A»
moon_icon = u »na»
forecast_n = weather_n.getElementsByTagName ('dayf') [0]
day_nodes = forecast_n.getElementsByTagName ('eguna')egunez egun_zenodoetan:
day_of_week = day.getAttribute ('t')
day_of_year = day.getAttribute ('dt')
high_temp_n = day.getElementsByTagName ('hi') [0]
high_temp = self.getText (high_temp_n.childNodes)
low_temp_n = day.getElementsByTagName ('baxua') [0]
low_temp = self.getText (low_temp_n.childNodes)sunrise_n = day.getElementsByTagName ('sunr') [0]
sunrise = self.getText (sunrise_n.childNodes)
sunset_n = day.getElementsByTagName ('eguzkiak') [0]
sunset = self.getText (sunset_n.childNodes)# eguneko datu zehatzak iragartzeko
daytime_n = day.getElementsByTagName ('zatia') [0] # egun
condition_code_n = daytime_n.getElementsByTagName ('ikonoa) [0]
condition_code = self.getText (condition_code_n.childNodes)
condition_n = daytime_n.getElementsByTagName ('t') [0]
baldintza = self.getText (condition_n.childNodes)
precip_n = daytime_n.getElementsByTagName ('ppcp') [0]
precip = self.getText (precip_n.childNodes)
hezetasuna_n = eguneko_n.getElementsByTagName ('hmid') [0]
hezetasuna = self.getText (hezetasuna_n.childNodes)
wind_n = daytime_n.getElementsByTagName ('haizea') [0]
wind_speed_n = wind_n.getElementsByTagName ('s') [0]
wind_speed = self.getText (wind_speed_n.childNodes)
wind_direction_n = wind_n.getElementsByTagName ('t') [0]
wind_direction = self.getText (wind_direction_n.childNodes)
wind_gusts_n = wind_n.getElementsByTagName ('bolada') [0]
wind_gusts = self.getText (wind_gusts_n.childNodes)
day_forecast_data = WeatherData (day_of_ week, low_temp, high_temp, condition_code, condition, precip, hezetasuna, haizearen norabidea, haizearen abiadura, haizearen nahiak, hiria, egunsentia, ilunabarra, moon_fase, moon_icon, bar_read, bar_desc)
self.day_forecast.append (day_forecast_data)# gaueko iragarpen datu zehatzak
daytime_n = day.getElementsByTagName ('part') [1] # gau
condition_code_n = daytime_n.getElementsByTagName ('ikonoa) [0]
condition_code = self.getText (condition_code_n.childNodes)
condition_n = daytime_n.getElementsByTagName ('t') [0]
baldintza = self.getText (condition_n.childNodes)
precip_n = daytime_n.getElementsByTagName ('ppcp') [0]
precip = self.getText (precip_n.childNodes)
hezetasuna_n = eguneko_n.getElementsByTagName ('hmid') [0]
hezetasuna = self.getText (hezetasuna_n.childNodes)
wind_n = daytime_n.getElementsByTagName ('haizea') [0]
wind_speed_n = wind_n.getElementsByTagName ('s') [0]
wind_speed = self.getText (wind_speed_n.childNodes)
wind_direction_n = wind_n.getElementsByTagName ('t') [0]
wind_direction = self.getText (wind_direction_n.childNodes)
wind_gusts_n = wind_n.getElementsByTagName ('bolada') [0]
wind_gusts = self.getText (wind_gusts_n.childNodes)
night_forecast_data = WeatherData (day_of_week, low_temp, high_temp, condition_code, condition, precip, hezetasuna, haizearen norabidea, haizearen abiadura, haize_gusts, hiria, egunsentia, ilunabarra, moon_fase, moon_icon, bar_read, bar_desc)
self.night_forecast.append (night_forecast_data)# datoz hurrengo datuei!
fileoutput = irekia (file_path_current, 'w')
pickle.dump (self.current_conditions, fileoutput)
fileoutput.close ()fileoutput = irekia (file_path_dayforecast, 'w')
pickle.dump (self.day_forecast, fileoutput)
fileoutput.close ()fileoutput = irekia (file_path_nightforecast, 'w')
pickle.dump (self.night_forecast, fileoutput)
fileoutput.close ()ezik:
print "fetchData: Ustekabeko errorea:", sys.exc_info () [0]
print "Ezin dira eguraldiaren datuak galdetu"bestela: # eskuratu eguraldiaren datuak eskabetxeko klaseko fitxategietatik
self.options.verbose bada == Egia:
inprimatu >> sys.stdout, «eguraldiaren datuak fitxategitik eskuratzen:«, file_path_currentfileinput = irekia (file_path_current, 'r')
self.current_conditions = pickle.load (fileinput)
fileinput.close ()self.options.verbose bada == Egia:
inprimatu >> sys.stdout, "eguneko iragarpen datuak fitxategietatik eskuratuz:", file_path_dayforecast, file_path_nightforecastfileinput = irekia (file_path_dayforecast, 'r')
self.day_forecast = pickle.load (fileinput)
fileinput.close ()self.options.verbose bada == Egia:
inprimatu >> sys.stdout, "eguneko iragarpen datuak fitxategietatik eskuratuz:", file_path_nightforecast, file_path_nightforecastfileinput = irekia (file_path_nightforecast, 'r')
self.night_forecast = pickle.load (fileinput)
fileinput.close ()def outputData (auto):
# saiakera:if self.options.template! = Bat ere ez:
output = self.getOutputTextFromTemplate (self.options.template)
bestela:
output = self.getOutputText (self.options.datatype, self.options.startday, self.options.endday, self.options.night, self.options.shortweekday, self.options.imperial, self.options.hideunits, self. aukerak.espazioak)
print output.encode ("utf-8")
# salbu:
#print «outputData: Ustekabeko errorea:«, sys.exc_info () [0]__izena__ == "__ nagusia__" bada:
analizatzailea = CommandLineParser ()
(aukerak, arg) = parser.parse_args ()options.verbose == Egia bada:
inprimatu >> sys.stdout, "kokalekua:", options.location
inprimatu >> sys.stdout, "imperial:", options.imperial
inprimatu >> sys.stdout, "datu mota:", options.datatype
inprimatu >> sys.stdout, "gaua:", aukerak.gaua
inprimatu >> sys.stdout, "hasiera eguna:", options.startday
inprimatu >> sys.stdout, "amaiera eguna:", aukerak.eguna
inprimatu >> sys.stdout, "espazioak:", aukerak.espazioak
inprimatu >> sys.stdout, "verbose:", options.verbose
inprimatu >> sys.stdout, "refetch:", options.refetch# eguraldi globaleko objektu berria sortu
eguraldia = GlobalWeather (aukerak)
weather.fetchData ()
weather.outputData ()
~ / Conky / scripts / myweather.template fitxategia sortzen dugu
gedit ~ / Conky / scripts / myweather.template
honako hau itsatsi dugu barruan:
{–Datatype = DW –startday = 1}: {–datatype = CC –startday = 1}
{–Datatype = HT –startday = 1} / {–datatype = LT –startday = 1} Haizea {–datatype = WD –startday = 1} - {–datatype = WS –startday = 1}
Hezetasuna: {–datatype = HM –startday = 1} Prezipitazioak: {–datatype = PC –startday = 1}
Egunsentia: {–datatype = SR –startday = 1} Ilunabarra: {–datatype = SS –startday = 1}
----------------
{–Datatype = DW –startday = 2}: {–datatype = CC –startday = 2}
{–Datatype = HT –startday = 2} / {–datatype = LT –startday = 2} Haizea {–datatype = WD –startday = 2} - {–datatype = WS –startday = 2}
Hezetasuna: {–datatype = HM –startday = 2} Prezipitazioak: {–datatype = PC –startday = 2}
Egunsentia: {–datatype = SR –startday = 2} Ilunabarra: {–datatype = SS –startday = 2}
----------------
{–Datatype = DW –startday = 3}: {–datatype = CC –startday = 3}
{–Datatype = HT –startday = 3} / {–datatype = LT –startday = 3} Haizea {–datatype = WD –startday = 3} - {–datatype = WS –startday = 3}
Hezetasuna: {–datatype = HM –startday = 3} Prezipitazioak: {–datatype = PC –startday = 3}
Egunsentia: {–datatype = SR –startday = 3} Ilunabarra: {–datatype = SS –startday = 3}
----------------
{–Datatype = DW –startday = 4}: {–datatype = CC –startday = 4}
{–Datatype = HT –startday = 4} / {–datatype = LT –startday = 4} Haizea {–datatype = WD –startday = 4} - {–datatype = WS –startday = 4}
Hezetasuna: {–datatype = HM –startday = 4} Prezipitazioak: {–datatype = PC –startday = 4}
Egunsentia: {–datatype = SR –startday = 4} Ilunabarra: {–datatype = SS –startday = 4}
~ / Conky / scripts / mail / conkyEmail.py fitxategia sortzen dugu (posta karpeta sortu behar dugu)
gedit ~ / Conky / scripts / mail / conkyEmail.py
eta itsatsi barruan honako hau:
inportatu zaitu
inportatu katea# Sartu zure erabiltzaile izena eta pasahitza beheko komatxoen artean
# adib. erabiltzaile izena = »erabiltzaile izena» eta pasahitza = »pasahitza»
erabiltzaile izena = »YOUR_USUARIO_SINARROBA«
pasahitza = »ZURE_GAKOA«com = »wget -O - https: //» + erabiltzaile izena + »:» + pasahitza + »@ mail.google.com / mail / feed / atom –no-check-certificate»
temp = os.popen (com)
msg = temp.read ()
index = string.find (msg, » »)
index2 = string.find (msg, » »)
fc = int (msg [index + 11: index2])fc == 0 bada:
inprimatu "0 berria"
bestela:
print str (fc) + »berria»
Beraz, orain 7 fitxategi dituzu:
Karpetan: ~
-> .startconky << - egin exekutagarria
Karpetan: ~ / Conky
-> conkymain
-> conkyforecast
-> conkymail
eta karpetan: ~ / Conky / scripts
-> conkyForecast.py << - egin exekutagarria
-> myweather.template
eta karpetan: ~ / Conky / scripts / mail
conkyEmail.py << - egin exekutagarria
Eta kitto, argipenak, non / home / user / ... dioen izena zure erabiltzaile izena doa eta Gmail datuak joaten diren zatian, zure datuak jarri behar dituzun koloreetan nabarmendu ditut.
conky prozesua hiltzeko idatzi kontsola batean
Killall Conky
idazteko konky kontsola batera exekutatzeko
./.SartConky
dena egokituta duzunean, saio bakoitza hastea nahi baduzu
Sistema -> Hobespenak -> Saioak eta abiarazteko programetan gehitzen dugu
Izenean Conky idatz dezakegu, Ordena ./.startconky-rekin. Horrekin ordenagailua pizten duzun bakoitzean hasiko da.
Hori da, espero dut lagungarri izatea.
Idatzi lehenengo iruzkina