Conky, 내 설정

Fecfactor는 어제 아래 스크린 샷에 표시된 conky의 구성을 게시하도록 요청했습니다.

보시다시피 스크립트를 통해 실행되는 3 개의 conkys가 있습니다. 구성은 이 게시물에 게시 한 사람 사용자 Bruce M. 포럼에 우분투-Ar 메일 conky에서 약간의 수정이 있습니다. 제 경우에는 Gmail 용입니다.

레퍼런스 포스트에서는 Bruce가 매우 잘 설명하고 있지만, 저를위한 기억 보조 수단으로 따라야 할 단계와 그것을 가지고있는 사람을 위해 제 conkys의 코드를 복사 할 것입니다.

물론 conky, curl 및 python이 설치되어 있어야 콘솔에 입력합니다.

sudo apt-get 설치 conky curl python

weather.ttf 및 arrows.ttf의 소스 여기에. moon.ttf의 소스 여기에 다운로드 후 / usr / share / fonts에 복사해야합니다.

이제 ~. / Startconky라는 스크립트를 만들어 보겠습니다.

gksudo gedit ~ / .startconky

빈 파일 안에 다음을 붙여 넣습니다.

#! / bin / bash
sleep 0 & # 0 Xfce에 좋음-Gnome에 20 ~ 30 사용
conky -c ~ / Conky / conkymain &
#sleep 0 & # 0 Xfce에 좋음-Gnome에 1 사용
conky -c ~ / Conky / conkyforecast &
#sleep 0 & # 0 Xfce에 좋음-Gnome에 1 사용
conky -c ~ / Conky / conkymail &

이제 ~ / Conky 폴더에 conkymain 파일을 만듭니다. 그렇지 않으면 Conky 폴더를 만들어야합니다.

gedit ~ / Conky / conkymain

Calibri 글꼴을 사용합니다.없는 경우 원하는 글꼴로 바꿉니다.

우리는 다음과 같은 것에 집착합니다.

배경 없음
own_window 예
own_window_transparent 예
own_window_hints undecorated, below, sticky, skip_taskbar, skip_pager
own_window_colour 검정
double_buffer 예
use_spacer 왼쪽
use_xft 예
글꼴 calibri : 크기 = 9
xftfont calibri : 크기 = 9
xft알파 0.5
업데이트 간격 5.0
대문자 아니오 # 모든 텍스트를 대문자로 표시하려면 yes로 설정합니다.
점묘 테두리 3
국경_마진 9
테두리_너비 10
default_color 흰색
default_outline_color 검정
default_shade_color 검정
color0 시안
color1 하늘색
color2 주황색
color3 노란색
color4 밀
color5 화이트
color6 화이트
color7 화이트
color8 화이트
color9 화이트
정렬 top_right # 또는 top_left, bottom_left, bottom_right
갭_x 10
갭 _y 35
text_buffer_size 128 # 예측에 1024 사용
no_buffers yes # 사용 된 메모리에서 파일 시스템 버퍼를 빼시겠습니까?
draw_borders 아니오
draw_outline yes # yes 인 경우 텍스트를 증폭합니다.
draw_shades yes # 음영 색상 검정

TEXT
$ {font calibri : size = 12} $ {alignc} $ {color1} $ sysname $ kernel on $ machine} $ color $ font
$ {font calibri : size = 12} $ {alignc} $ {color2} $ {exec whoami} @ $ nodename $ color $ font
$ {color0} $ {hr 1} $ 색상
$ {font calibri : size = 20} $ {alignc} $ {time % H : % M} $ font
$ {font calibri : size = 12} $ {color1} $ {alignc} $ {time % A, % d % b. % Y} $ 색상 $ 글꼴
$ {color3} 가동 시간 : $ {정렬 기 2} $ 가동 시간 $ 색상
$ {color0} $ {hr 1} $ 색상
$ {voffset 5} $ {color2} CPU : $ {alignc} $ color $ running_processes $ {color1} / $ color $ 프로세스 $ {alignr 2} $ {color2} $ {cpubar cpu0 14,80} $ color
$ {color1} $ {voffset -16} $ {alignr 5} $ cpu % $ 색상
$ {voffset 2} $ {color1}로드 평균 ($ {color3} 최소 $ {color1}) : $ {alignr 2} $ {color3} 1 : $ color $ {loadavg 1} $ {color3} 5 : $ color $ {loadavg 2} $ {color3} 15 : $ 색상 $ {loadavg 3}
$ {voffset 5} $ {color2} RAM : $ color $ mem $ {color2} / $ color $ memmax $ {alignr 2} $ {color2} $ {membar 14,80} $ color
$ {color1} $ {voffset -16} $ {alignr 5} $ memperc % $ 색상
$ {voffset 2} $ {color1} 버퍼링 됨 : $ color $ {buffers} $ {alignr 2} $ {color1} 캐시 됨 : $ 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} $ 색상
$ {voffset 5} $ {color2} HD 정보 $ {color1}-$ color 무료 $ {color1}-중고-$ {color2} 합계
$ {voffset 5} $ {color1} 루트 : $ color $ {fs_free_perc /} % $ {alignr 2} $ {fs_free /} $ {color2} / $ {color1} $ {fs_used /} $ color / $ {color2} $ {fs_size /} $ 색상
$ {color1} 집 : $ color $ {fs_free_perc / 집 / 사용자} % $ {alignr 2} $ {fs_free / 집 / 사용자} $ {color2} / $ {color1} $ {fs_used / 집 / 사용자} $ color / $ {color2} $ {fs_size / 집 / 사용자} $ 색상
$ {color0} $ {hr 1} $ 색상
$ {color1} 보낸 사람 : $ color 아르헨티나 부에노스 아이레스
$ {color1} Lat : $ {color2} 34 ° 35 'S $ {color1} Long : $ {color2} 58 ° 21'W $ {color1} Alt : $ {color2} 25 m $ color
$ {voffset 5} $ {color2} $ {font calibri : size = 12} 오늘 : $ font $ {color3} $ {execi 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = CC} $ color $ {alignr 2} $ {color1} ST : $ {color2} $ {execi 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = LT}
$ {color3} $ {font 날씨 : 크기 = 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 $ 폰트
$ {alignc 10} $ {voffset 5} $ {color4} 바람 : $ {execi 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = WS} $ color
$ {color1} 습도 : $ {color3} $ {execi 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = HM} $ {alignr 2} $ {color1} 강수량 : $ {color3} $ { execi 3600 python ~ / Conky / 스크립트 / conkyForecast.py –location = ARBA0009 –datatype = PC} $ color
$ {alignc} $ {color1} 압박 : $ {color3} $ {execi 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = BR}-$ {color3} $ {execi 3600 python ~ / Conky /scripts/conkyForecast.py – 위치 = ARBA0009 – 데이터 유형 = BD} $ 색상
$ {color4} $ {hr} $ 색상
$ {color1} 일출 : $ {color3} $ {execi 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –datatype = SR} $ {alignr 2} $ {color1} 일몰 : $ {color3} $ { execi 3600 python ~ / Conky / 스크립트 / conkyForecast.py –location = ARBA0009 –datatype = SS} $ color
$ {voffset 15} $ {color1} 달 : $ {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 $ 색상
$ {color0} $ {hr} $ 색상
$ {voffset 5} $ {color2} IP : $ {alignc} $ color $ {addr eth0}
$ {color1} 아래 : $ color $ {downspeed eth0} k / s $ {alignr 2} $ {color1} 위로 : $ color $ {upspeed eth0} k / s
$ {color1} 합계 : $ color $ {totaldown eth0} $ {alignr 2} $ {color1} 합계 : $ color $ {totalup eth0}
$ {color1} 인바운드 : $ color $ {tcp_portmon 1 32767 count} $ {color1} 아웃 바운드 : $ color $ {tcp_portmon 32768 61000 count} $ {alignr 2} $ {color1} 합계 : $ color $ {tcp_portmon 1 65535 count}
$ {voffset 5} $ {color2} 연결 : $ color $ {tcp_portmon 32768 61000 count} $ {alignr 2} $ {color2} 서비스 / 포트 $ 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} $ 색상

~ / Conky / conkyforecast 파일을 만듭니다.

gedit ~ / Conky / conkyforecast

내부에 다음을 붙여 넣습니다

배경 없음
own_window 예
own_window_transparent 예
own_window_hints undecorated, below, sticky, skip_taskbar, skip_pager
own_window_colour 검정
double_buffer 예
use_spacer 왼쪽
use_xft 예
글꼴 calibri : 크기 = 8
xftfont calibri : 크기 = 8
xft알파 0.5
업데이트 간격 5.0
대문자 아니오 # 모든 텍스트를 대문자로 표시하려면 yes로 설정합니다.
점묘 테두리 3
국경_마진 9
테두리_너비 10
default_color 흰색
default_outline_color 검정
default_shade_color 검정
color0 시안
color1 하늘색
color2 주황색
color3 노란색
color4 밀
color5 화이트
color6 화이트
color7 화이트
color8 화이트
color9 화이트
정렬 bottom_left # 또는 top_left, bottom_left, bottom_right
갭_x 10
갭 _y 35
text_buffer_size 1024 # 예측에 1024 사용
no_buffers yes # 사용 된 메모리에서 파일 시스템 버퍼를 빼시겠습니까?
draw_borders 아니오
draw_outline yes # yes 인 경우 텍스트를 증폭합니다.
draw_shades yes # 음영 색상 검정

TEXT
$ {color4} $ {font calibri : size = 11} Extended Forecast $ font $ color
$ {color0} $ {hr} $ 색상
$ {color4} $ {font calibri : size = 9} $ {execi 3600 python ~ / Conky / scripts / conkyForecast.py –location = ARBA0009 –template = / home / user / Conky / scripts / myweather.template} $ font $ 색깔

~ / Conky / conkymail 파일을 만듭니다.

gedit ~ / Conky / conkymail

다음을 파일에 붙여 넣습니다.

배경 없음
own_window 예
own_window_transparent 예
own_window_hints undecorated, below, sticky, skip_taskbar, skip_pager
own_window_colour 검정
double_buffer 예
use_spacer 왼쪽
use_xft 예
글꼴 calibri : 크기 = 8
xftfont calibri : 크기 = 8
xft알파 0.5
업데이트 간격 5.0
대문자 아니오 # 모든 텍스트를 대문자로 표시하려면 yes로 설정합니다.
점묘 테두리 3
국경_마진 9
테두리_너비 10
default_color 흰색
default_outline_color 검정
default_shade_color 검정
color0 시안
color1 하늘색
color2 주황색
color3 노란색
color4 밀
color5 화이트
color6 화이트
color7 화이트
color8 화이트
color9 화이트
정렬 bottom_left # 또는 top_left, bottom_left, bottom_right
갭_x 565
갭 _y 35
text_buffer_size 128 # 예측에 1024 사용
no_buffers yes # 사용 된 메모리에서 파일 시스템 버퍼를 빼시겠습니까?
draw_borders 아니오
draw_outline yes # yes 인 경우 텍스트를 증폭합니다.
draw_shades yes # 음영 색상 검정

TEXT
$ {font calibri : size = 11} $ {alignc} $ {color4} Gmail
$ {color0} $ {hr} $ 색상
$ {font calibri : size = 11} $ {color4} $ {color3} $ {execi 300 python ~ / Conky / scripts / mail / conkyEmail.py} $ {color4} email (s) $ font

~ / Conky / scripts / conkyForecast.py에 파일을 생성합니다 (scripts 폴더를 생성해야합니다).

gedit ~ / Conky / 스크립트 / conkyForecast.py

#! / usr / bin / python
#-*-코딩 : utf-8-*-
############################################### ##############################
# conkyForecast.py는 수집 할 수있는 (그렇지 않은) 간단한 (더 이상) 파이썬 스크립트입니다
# conky에서 사용할 현재 날씨의 세부 정보입니다.
#
# 저자 : Kaivalagi
# 만든 날짜 : 13 년 04 월 2008 일
# 수정 :
# 14/04/2008 예측 데이터에 대한 날짜 범위 허용
# 14/04/2008 xoap 서비스에 대한 연결 확인
# 18/04/2008 범위 출력을위한 공백 설정 허용
# 18/04/2008 야간 및 주간 예측 출력 허용
# 18/04/2008 조건 코드 텍스트«CC»옵션에 대한 로케일 지원, 스페인어 번역 대기
# 18/04/2008 xml을 여는 대신 클래스 데이터에 피클 링을 사용하면 캐시 된 데이터를 조사 할 필요가 없습니다.
# 19/04/2008 스페인어 조건 텍스트 추가-감사 Bruce M
# 19/04/2008 단위 접미사가있는 모든 숫자 출력에 isnumeric 검사 추가
# 19/04/2008 위치 코드를 포함하도록 변경된 pickle 파일 이름
# 19/04/2008 로케일을 통한 스페인어 평일 변환 추가
# 20/04/2008 괜찮은 명령 인수 파서 추가
# 20/04/2008 –shortweekday 옵션 추가 (요일이 주어지면 데이터 유형이 3 자로 단축 됨)
# 21/04/2008 예측 출력을위한 고정 로케일 옵션
# 21/04/2008 단일 exec 호출을 사용하여 사용자 정의 출력을 허용하는 –template 옵션 추가 🙂
# 21/04/2008 출력에서 ​​mph 및 C를 제거하는 –hideunits 옵션 추가
# 23/04/2008 템플릿에서 –imperial 옵션이 제거되었습니다.이 옵션은 스크립트 호출에서 표준 옵션으로 설정되어야하며 템플릿 파일에서 사용되지 않아야합니다.
# 23/04/2008 Readded –imperial option to template, enable metric or imperial values ​​per datatype. 템플릿을 사용할 때 명령 줄 옵션이 작동하지 않습니다.
# 23/04/2008 주어진 위치가 잘못된 경우 사용자에게 알리는 출력 추가
# 24/04/2008 연결 없음에 대한 처리가 추가되었습니다. 이제 캐시 된 데이터로 되돌아갑니다 (캐시가 없으면 오류 발생). xoap.weather.com을 열어서 테스트합니다.
# 24/04/2008 고정 섭씨에서 화씨로 변환
# 06/05/2008 웹 서비스 업데이트 후 사용 된 URL 업데이트
# 09/05/2008 통합 된 현재 상태 및 예측 데이터를 하나의 호출로 가져옴
# 09/05/2008 데이터 유형에 일출 및 일몰이 추가되었습니다. 이들은 현재 상태와 예측 데이터에 모두 적용됩니다.
# 09/05/2008 데이터 유형에 달의 위상, 기압계 판독 및 기압계 설명이 추가되었습니다. 이들은 현재 상태에만 해당되며 예측 된 출력에서 ​​해당 없음
# 09/05/2008 기압계의 단위 변환을 mb에서 인치 (영국식)로 추가했습니다.
# 09/05/2008 업데이트 된 스페인어 조건 텍스트-감사 Bruce M
# 10/05/2008 프랑스어 로케일 데이터 추가-감사합니다 benpaka
# 12/05/2008 WD (바람 방향)의 NSEW 출력 대신 화살표 문자 (Aarrow.ttf 글꼴과 함께 사용)를 제공하는 새로운 BF (베어링 글꼴) 데이터 유형 추가
# 12/05/2008 로케일별로 업데이트 된 WD 출력, 현재 기본 영어 및 스페인어 지원-감사합니다 Bruce M
# 18/05/2008 달 글꼴 문자를 제공하기 위해 새로운 MF (달 글꼴) 데이터 유형이 추가되었습니다 (문자가 올바르지 않고 전용 글꼴이 아직 없음).
# 21/05/2008 현재 상태의 경우 –datatype = LT 옵션은 이제 현재 온도가 아닌«feels like»온도를 표시합니다.
#
# 모든 것 :
# pkl 파일을 하나의 파일 / 클래스로 통합
# 달 아이콘 데이터를 기반으로 한 달의 위상 출력을 기반으로 날씨 글꼴 추가
# ??? 더 많은 요구 사항이 있습니까?

sys, os, 소켓, urllib2, 날짜/시간, 시간 가져오기
xml.dom에서 가져 오기 minidom
통계 가져 오기에서 *
optparse import OptionParser에서
로케일 가져 오기
gettext 가져 오기
수입 피클
수학 가져 오기에서 *

APP =»conkyForecast.py»
DIR = os.path.dirname (__file__) + '/ locale'
gettext.bindtextdomain (APP, DIR)
gettext.textdomain (APP)
_ = gettext.gettext

CommandLineParser 클래스 :

파서 = 없음

def __init __ (자체) :

self.parser = OptionParser ()
self.parser.add_option («-l»,»-location», dest =»location», 기본값 =»UKXX0103 ″, type =»string», metavar =»CODE», help = u»날씨 데이터의 위치 코드 [ default : % default], 다음 URL을 사용하여 도시 이름으로 위치 코드를 확인하세요. http://xoap.weather.com/search/search?where=Norwich»)
self.parser.add_option ( "-d", "-datatype", dest = "datatype", 기본값 = "HT", type = "string", metavar = "DATATYPE", help = u "[default : % default]] 데이터 유형 옵션은 다음과 같습니다. DW (요일), WF (날씨 글꼴 출력), LT (예측 : 저온, 전류 : 느낌 온도), HT (예측 : 고온, 전류 : 현재 온도), CC (현재 조건), CT (조건 텍스트), PC (강수 확률), HM (습도), WD (풍향), WS (풍속), WG (바람 돌풍), CN (도시 이름), SR (일출), SS (일몰), MP (달의 위상), MF (달 모양), BR (기압계 판독 값), BD (기압계 설명) 템플릿을 사용할 때 명령 줄에 적용되지 않습니다.»)
self.parser.add_option («-s»,»-startday», dest =»startday», type =»int», metavar =»NUMBER», help = u»생략 된 경우 현재 조건이 출력되는 경우 시작일 번호 정의 . 템플릿을 사용하는 경우 명령 줄에는 적용되지 않습니다.»)
self.parser.add_option ( "-e", "-endday", dest = "endday", type = "int", metavar = "NUMBER", help = u "시작일 데이터 만 생략하면 종료일 번호 정의 출력입니다. 템플릿을 사용할 때 명령 줄에 적용 할 수 없습니다.»)
self.parser.add_option («-S»,»-공백», dest =»spaces», type =»int», 기본값 = 1, metavar =»NUMBER», help = u»[기본값 : % 기본값] 범위가 지정된 출력 사이의 공백 수입니다. 템플릿을 사용할 때 명령 줄에 적용 할 수 없습니다.»)
self.parser.add_option («-t»,»-template», dest =»template», type =»string», metavar =»FILE», help = u»한 번의 호출로 출력을 생성 할 템플릿 파일을 정의합니다. 파일에서 표시 가능한 항목은 {–datatype = HT –startday = 1} 형식입니다. 다음은 각 항목에서 가능한 옵션입니다. –datatype, –startday, –endday, –night, –shortweekday, –imperial, –hideunits, –Spaces. 짧은 형식의 옵션은 현재 지원되지 않습니다. 템플릿을 사용할 때 명령 줄에서 적용 할 수있는 옵션이 없습니다.»)
self.parser.add_option («-L»,»-locale», dest =»locale», type =»string», help = u»언어 출력을위한 시스템 로케일 재정의 (en = 영어, es = 스페인어, fr = 프랑스어, 추가 예정)»)
self.parser.add_option ( "-i", "-imperial", dest = "imperial", 기본값 = False, action = "store_true", help = u "제외 된 출력이 미터법에있는 경우 영국식 단위를 요청합니다. 템플릿 사용시 명령 줄.»)
self.parser.add_option («-n»,»-night», dest =»night», 기본값 = False, action =»store_true», help = u»출력을 야간 데이터로 전환합니다. 생략 된 경우 낮 출력이 출력됩니다. 템플릿을 사용할 때 명령 줄에서 적용 할 수 없습니다.»)
self.parser.add_option («-w»,»-shortweekday», dest =»shortweekday», 기본값 = False, action =»store_true», help = u»요일 데이터 유형을 3 자로 단축. 템플릿 사용시 명령 줄.»)
self.parser.add_option («-u»,»-hideunits», dest =»hideunits», 기본값 = False, action =»store_true», help = u»mph 또는 C와 같은 단위 숨기기,도 기호 (°)는 여전히 표시됩니다. 템플릿을 사용할 때 명령 줄에서 적용 할 수 없습니다.»)
self.parser.add_option ( "-v", "-verbose", dest = "verbose", default = False, action = "store_true", help = u "verbose output 요청, conky를 통해 실행할 때 좋은 생각이 없습니다!" )
self.parser.add_option ( "-r", "-refetch", dest = "refetch", 기본값 = False, action = "store_true", help = u "데이터 만료에 관계없이 데이터 가져 오기")

def parse_args (자체) :
(옵션, 인수) = self.parser.parse_args ()
반환 (옵션, 인수)

def print_help (자체) :
return self.parser.print_help ()

WeatherData 클래스 :
def __init __ (self, day_of_week, low, high, condition_code, condition_text, precip, 습도, wind_dir, wind_speed, wind_gusts, city, sunrise, sunset, moon_phase, moon_icon, bar_read, bar_desc) :
self.day_of_week = u»»+ day_of_week
self.low = u»»+ 낮음
self.high = u»»+ 높음
self.condition_code = u»»+ condition_code
self.condition_text = u»»+ condition_text
self.precip = u»»+ 강수량
self.humidity = u»»+ 습도
self.wind_dir = u»»+ wind_dir
self.wind_speed = u»»+ wind_speed
self.wind_gusts = u»»+ wind_gusts
self.city = u»»+ 도시
self.sunrise = u»»+ 일출
self.sunset = u»»+ 일몰
self.moon_phase = u»»+ moon_phase
self.moon_icon = u»»+ moon_icon
self.bar_read = u»»+ bar_read
self.bar_desc = u»»+ bar_desc

WeatherText 클래스 :

condition_text = {
«0»: _ (u»토네이도»),
«1»: _ (u»열대 폭풍»),
«2»: _ (u»허리케인»),
«3»: _ (u»심각한 뇌우»),
«4»: _ (u»뇌우»),
«5»: _ (u»비와 눈 혼합»),
«6»: _ (u»비와 진눈깨비 혼합»),
«7»: _ (u»혼합 강수»),
«8»: _ (u»동결 이슬비»),
«9»: _ (u»Drizzle»),
«10»: _ (u»동결 비»),
«11»: _ (u»샤워기»),
«12»: _ (u»샤워기»),
«13»: _ (u»Snow Flurries»),
«14»: _ (u»약한 소나기»),
«15»: _ (u»눈보라»),
«16»: _ (u»눈»),
«17»: _ (u»만세»),
«18»: _ (u»슬리 트»),
«19»: _ (u»먼지»),
«20»: _ (u»안개»),
«21»: _ (u»헤이즈»),
«22»: _ (u»연기»),
«23»: _ (u»블러스터 리»),
«24»: _ (u»Windy»),
«25»: _ (u»콜드»),
«26»: _ (u»흐림»),
«27»: _ (u»대부분 흐림»),
«28»: _ (u»대부분 흐림»),
«29»: _ (u»부분적으로 흐림»),
«30»: _ (u»부분적으로 흐림»),
«31»: _ (u»지우기»),
«32»: _ (u»지우기»),
«33»: _ (u»보통»),
«34»: _ (u»보통»),
«35»: _ (u»혼합 된 비와 우박»),
«36»: _ (u»핫»),
«37»: _ (u»격리 된 뇌우»),
«38»: _ (u»산란 된 뇌우»),
«39»: _ (u»산란 된 뇌우»),
«40»: _ (u»산란 소나기»),
«41»: _ (u»폭설»),
«42»: _ (u»흩어진 눈보라»),
«43»: _ (u»폭설»),
«44»: _ (u»부분적으로 흐림»),
«45»: _ (u»천둥 소나기»),
«46»: _ (u»눈 소나기»),
«47»: _ (u»격리 된 뇌우»),
«Na»: _ (u»N / A»),
"-": _(ㅏ")
}

condition_text_es = {
«0»: _ (u»토네이도»),
«1»: _ (u»열대 폭풍»),
«2»: _ (u»Huracá¡n»),
«3»: _ (u»강한 폭풍»),
«4»: _ (u»폭풍우»),
«5»: _ (u»비와 눈 혼합»),
«6»: _ (u»비와 진눈깨비 혼합»),
«7»: _ (u»슬리 트»),
«8»: _ (u»동결 이슬비»),
«9»: _ (u»Drizzle»),
«10»: _ (u»얼어 붙는 비»), # 또는 얼어 붙은 비
«11»: _ (u»샤워기»),
«12»: _ (u»샤워기»),
«13»: _ (u»약한 눈»),
«14»: _ (u»약한 눈»),
«15»: _ (u»눈 블리자드»),
«16»: _ (u»눈»),
«17»: _ (u»만세»),
«18»: _ (u»슬리 트»),
«19»: _ (u»파우더»),
«20»: _ (u»안개»),
«21»: _ (u»헤이즈»),
«22»: _ (u»연기»),
«23»: _ (u»Tempest»),
«24»: _ (u»Windy»),
«25»: _ (u»Fráo»),
«26»: _ (u»매우 흐림»),
«27»: _ (u»대부분 흐림»),
«28»: _ (u»대부분 흐림»),
«29»: _ (u»부분적으로 흐림»),
«30»: _ (u»부분적으로 흐림»),
«31»: _ (u»지우기»),
«32»: _ (u»지우기»),
«33»: _ (u»흐린 것»),
«34»: _ (u»흐린 것»),
«35»: _ (u»우박을 동반 한 비»),
«36»: _ (u»열»),
«37»: _ (u»격리 된 폭풍»),
«38»: _ (u»산란 폭풍»),
«39»: _ (u»산란 폭풍»),
«40»: _ (u»산란 소나기»),
«41»: _ (u»폭설»),
«42»: _ (u»약한 폭설»),
«43»: _ (u»강렬한 네바다»),
«44»: _ (u»흩어진 구름»),
«45»: _ (u»폭풍우»),
«46»: _ (또는»산란 폭설»),
«47»: _ (u»격리 된 폭풍»),
«Na»: _ (u»N / A»),
"-": _(ㅏ")
}

condition_text_fr = {
«0»: _ (u»Tornade»),
«1»: _ (u»Tempête Tropicale»),
«2»: _ (또는»Ouragan»),
«3»: _ (또는»Orages Violents»),
«4»: _ (또는»Orageux»),
«5»: _ (u»Pluie et Neige»),
«6»: _ (u»Pluie et Neige Mouillée»),
«7»: _ (u»Variable avec averses»),
«8»: _ (u»Bruine Givrante»),
«9»: _ (u»브루 인»),
«10»: _ (u»Pluie Glacante»),
«11»: _ (u»어 버스»),
«12»: _ (u»어 버스»),
«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»: _ (또는»Orages Isolés»),
«38»: _ (또는»Orages Localisés»),
«39»: _ (또는»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»: _ (또는»Orages»),
«46»: _ (u»Tempête de Neige»),
«47»: _ (또는»Orages Isolés»),
«Na»: _ (u»N / A»),
"-": _(ㅏ")
}

condition_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»»),
"-": _ (또는 "")
}

condition_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»»),
"-": _ (또는 "")
}

day_of_week = {
"오늘": _ (또는 "오늘"),
«월요일»: _ (u»월요일»),
«화요일»: _ (u»화요일»),
«수요일»: _ (u»수요일»),
«목요일»: _ (u»목요일»),
«금요일»: _ (u»금요일»),
"Saturday": _ (u "Saturday"),
"일요일": _ (u "일요일")
}

day_of_week_short = {
"오늘": _ (u "지금"),
«월요일»: _ (u»월»),
«화요일»: _ (u»화»),
«수요일»: _ (u»수요일»),
«목요일»: _ (u»목»),
«금요일»: _ (u»금»),
"토요일": _ (u "토"),
"일요일": _ (u "일")
}

day_of_week_en = {
"오늘": _ (u "오늘"),
«월요일»: _ (u»월요일»),
«화요일»: _ (u»화요일»),
«수요일»: _ (u»수요일»),
«목요일»: _ (u»목요일»),
«금요일»: _ (u»금요일»),
"Saturday": _ (u "Saturday"),
"일요일": _ (u "일요일")
}

day_of_week_short_en = {
"오늘": _ (u "오늘"),
"월요일": _ (u "mon"),
«화요일»: _ (u»바다»),
«수요일»: _ (u»수요일»),
«목요일»: _ (u»목요일»),
«금요일»: _ (u»금»),
"토요일": _ (u "sat"),
"일요일": _ (u "dom")
}

day_of_week_fr = {
«오늘»: _ (u»Aujourd'hui»),
«월요일»: _ (u»Lundi»),
«화요일»: _ (u»Mardi»),
«수요일»: _ (u»Mercredi»),
«목요일»: _ (u»Jeudi»),
«금요일»: _ (u»Vendredi»),
"토요일": _ (u "Samedi"),
"일요일": _ (u "Dimanche")
}

day_of_week_short_fr = {
«오늘»: _ (u»Auj»),
"월요일": _ (u "월"),
«화요일»: _ (u»XNUMX 월»),
"수요일": _ (u "Mer"),
«목요일»: _ (u»Jeu»),
«금요일»: _ (u»와서»),
"토요일": _ (u "샘"),
"일요일": _ (u "어둡게")
}

베어링_화살표_글꼴 = {
«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»«)
}

베어링_텍스트_es = {
«N»: _ (u»N»),
«NNE»: _ (u»NNE»),
«NE»: _ (u»NE»),
«ENE»: _ (u»ENE»),
«E»: _ (u»E»),
«ESE»: _ (u»ESE»),
«SE»: _ (u»SE»),
"SSE": _ (u "SSE"),
"그들의"),
"SSW": _ (u "SSO"),
«SW»: _ (u»SO»),
"WSW": _ (u "WOW"),
«W»: _ (u»O»),
«WNW»: _ (u»ONO»),
«NW»: _ (u»NO»),
«NNW»: _ (u»NNO»),
«N / A»: _ (u»N \ A»)
}

베어링_텍스트_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"),
"그들의"),
"SSW": _ (u "SSO"),
«SW»: _ (u»SO»),
"WSW": _ (u "WOW"),
«W»: _ (u»O»),
«WNW»: _ (u»ONO»),
«NW»: _ (u»NO»),
«NNW»: _ (u»NNO»),
«N / A»: _ (u»N \ A»)
}

GlobalWeather 클래스 :

현재_조건 = []
일 _ 예측 = []
night_forcast = []

로케일 = "in"

옵션 = 없음
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 __ (자기, 옵션) :

self.options = 옵션

self.options.locale == None 인 경우 :
시도 :
# self.locale = locale.getdefaultlocale () [0] [0 : 2]
self.locale =«es»#이 행의 주석을 제거하여 스페인어 로케일을 강제 실행합니다.
# self.locale = "fr"# 프랑스어 로케일을 강제하기 위해이 줄의 주석을 제거하십시오.
외:
"로케일이 설정되지 않음"인쇄
그밖에:
# self.locale = self.options.locale
self.locale =«es»#이 행의 주석을 제거하여 스페인어 로케일을 강제 실행합니다.
# self.locale = "fr"# 프랑스어 로케일을 강제하기 위해이 줄의 주석을 제거하십시오.

self.options.verbose == True 인 경우 :
print >> sys.stdout, "locale set to", self.locale

def getText (self, nodelist) :
rc =«»
노드 목록의 노드 :
node.nodeType == node.TEXT_NODE 인 경우 :
rc = rc + 노드.데이터
반환 rc

def getSpaces (self, spaces) :
문자열 = u»»
공백 == 없음 인 경우 :
문자열 = self.DEFAULT_SPACING
그밖에:
범위 (0, 공백 + 1)에있는 i의 경우 :
문자열 = 문자열 + u»«
반환 문자열

def isNumeric (자체, 문자열) :
시도 :
더미 = float (문자열)
True 반환
외:
False를 반환

def isConnectionAvailable (self) :
# URL을 열어 weather.com의 서버에 액세스 할 수 있는지 확인
시도 :
Usock = urllib2.urlopen ( 'http://xoap.weather.com')
Usock.close ()
True 반환
외:
False를 반환

def getBearingText (자기, 베어링) :
베어링 = 플로트 (베어링)
베어링 <11.25 인 경우 :
반환 u»N»
elif 베어링 <33.75 :
반환 u»NNE»
elif 베어링 <56.25 :
반환 u»NE»
elif 베어링 <78.75 :
return u»JAN»
elif 베어링 <101.25 :
반환 u»E»
elif 베어링 <123.75 :
반환 u»ESE»
elif 베어링 <146.25 :
반환 u»SE»
elif 베어링 <168.75 :
반환 u»SSE»
elif 베어링 <191.25 :
반환 u»S»
elif 베어링 <213.75 :
반환 u»SSW»
elif 베어링 <236.25 :
반환 u»SW»
elif 베어링 <258.75 :
반환 u»WSW»
elif 베어링 <281.25 :
반환 u»W»
elif 베어링 <303.75 :
반환 u»WNW»
elif 베어링 <326.25 :
반환 u»NW»
elif 베어링 <348.75 :
반환 u»NNW»
그밖에:
반환«N / A»

def convertCelsiusToFahrenheit (self, temp) :
return str (int (floor (((float (temp) * 9.0) /5.0) +32)))

def convertKilometresToMiles (self, dist) :
return str (int (floor (float (dist) * 0.621371192)))

def convertMillibarsToInches (self, mb) :
return str (int (floor (float (mb) /33.8582)))

def getTemplateList (자체, 템플릿) :

템플릿 목록 = []

template.split의 template_part의 경우 («{«) :
template_part! =«»인 경우 :
template_part.split의 template_part ( "}") :
template_part! =«»인 경우 :
templatelist.append (u»»+ template_part)

반환 템플릿 목록

def getOutputText (self, datatype, startday, endday, night, shortweekday, imperial, hideunits, spaces) :
#시험:
출력 = u»»

# 출력을위한 현재 단위 정의
hideunits == False 인 경우 :
imperial == False 인 경우 :
온도 단위 = u»° C»
속도 단위 = u»kph»
압력 단위 = u»mb»
그밖에:
온도 단위 = u»° F»
속도 단위 = u»mph»
압력 단위 = u»in»
그밖에:
임시 단위 = u»°»
속도 단위 = u»»
압력 단위 = 유 »»

startday == None : # 현재 상태

데이터 유형 == "DW"인 경우 :
self.locale == "is"인 경우 :
shortweekday == True 인 경우 :
output = WeatherText.day_of_week_short_es [self.current_conditions [0] .day_of_week]
그밖에:
output = WeatherText.day_of_week_es [self.current_conditions [0] .day_of_week]
elif self.locale == "fr":
shortweekday == True 인 경우 :
output = WeatherText.day_of_week_short_fr [self.current_conditions [0] .day_of_week]
그밖에:
output = WeatherText.day_of_week_fr [self.current_conditions [0] .day_of_week]
그밖에:
shortweekday == True 인 경우 :
output = WeatherText.day_of_week_short [self.current_conditions [0] .day_of_week]
그밖에:
output = WeatherText.day_of_week [self.current_conditions [0] .day_of_week]
elif 데이터 유형 == "WF": # 날씨 글꼴
output = WeatherText.conditions_weather_font [self.current_conditions [0] .condition_code]
elif 데이터 유형 == "LT":
문자열 = self.current_conditions [0] .low
self.isNumeric (문자열) == True 인 경우 :
imperial == True 인 경우 :
string = self.convertCelsiusToFahrenheit (문자열)
문자열 = 문자열 + 임시 단위
출력 = 문자열
elif 데이터 유형 == "HT":
문자열 = self.current_conditions [0] .high
self.isNumeric (문자열) == True 인 경우 :
imperial == True 인 경우 :
string = self.convertCelsiusToFahrenheit (문자열)
문자열 = 문자열 + 임시 단위
출력 = 문자열
elif 데이터 유형 == "CC":
self.locale == "is"인 경우 :
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]
그밖에:
output = WeatherText.conditions_text [self.current_conditions [0] .condition_code]
elif 데이터 유형 == "CT":
출력 = self.current_conditions [0] .condition_text
elif 데이터 유형 == "PC":
문자열 = self.current_conditions [0] .precip
self.isNumeric (문자열) == True 인 경우 :
문자열 = 문자열 + u»%»
출력 = 문자열
elif 데이터 유형 == "HM":
문자열 = self.current_conditions [0] .humidity
self.isNumeric (문자열) == True 인 경우 :
문자열 = 문자열 + u»%»
출력 = 문자열
elif 데이터 유형 == "WD":
문자열 = self.current_conditions [0] .wind_dir
self.isNumeric (문자열) == True 인 경우 :
string = self.getBearingText (문자열)

self.locale == "is"인 경우 :
출력 = WeatherText.bearing_text_es [문자열]
elif self.locale == "fr":
output = WeatherText.bearing_text_fr [문자열]
그밖에:
출력 = 문자열

elif 데이터 유형 == "BF":
문자열 = self.current_conditions [0] .wind_dir
self.isNumeric (문자열) == True 인 경우 :
string = WeatherText.bearing_arrow_font [self.getBearingText (문자열)]
출력 = 문자열
elif 데이터 유형 == "WS":
문자열 = self.current_conditions [0] .wind_speed
self.isNumeric (문자열) == True 인 경우 :
imperial == True 인 경우 :
string = self.convertKilometresToMiles (문자열)
문자열 = 문자열 + 속도 단위
출력 = 문자열
elif 데이터 유형 == "WG":
문자열 = self.current_conditions [0] .wind_gusts
self.isNumeric (문자열) == True 인 경우 :
imperial == True 인 경우 :
string = self.convertKilometresToMiles (문자열)
문자열 = 문자열 + 속도 단위
출력 = 문자열
elif 데이터 유형 == "CN":
출력 = self.current_conditions [0] .city
elif 데이터 유형 == "SR":
출력 = self.current_conditions [0] .sunrise
elif 데이터 유형 == "SS":
출력 = self.current_conditions [0] .sunset
elif 데이터 유형 == "MP":
출력 = self.current_conditions [0] .moon_phase
elif 데이터 유형 == "MF":
output = WeatherText.conditions_moon_font [self.current_conditions [0] .moon_icon]
elif 데이터 유형 == "BR":
문자열 = self.current_conditions [0] .bar_read
self.isNumeric (문자열) == True 인 경우 :
imperial == True 인 경우 :
string = self.convertMillibarsToInches (문자열)
문자열 = 문자열 + 압력 단위
출력 = 문자열
elif 데이터 유형 == "BD":
출력 = self.current_conditions [0] .bar_desc
그밖에:
output = "\ nERROR : 알 수없는 데이터 유형이 요청되었습니다."

else : # 예측 데이터

if endday == None : # endday가 설정되지 않은 경우 startday 사용
endday = 시작일

if night == True : # 야간 예보 필요

범위의 day_number (시작일, 종료일 + 1) :

데이터 유형 == "DW"인 경우 :
self.locale == "is"인 경우 :
shortweekday == True 인 경우 :
output = output + self.getSpaces (공백) + WeatherText.day_of_week_short_es [self.night_forecast [day_number] .day_of_week]
그밖에:
output = output + self.getSpaces (공백) + WeatherText.day_of_week_es [self.night_forecast [day_number] .day_of_week]
elif self.locale == "fr":
shortweekday == True 인 경우 :
output = output + self.getSpaces (공백) + WeatherText.day_of_week_short_fr [self.night_forecast [day_number] .day_of_week]
그밖에:
output = output + self.getSpaces (공백) + WeatherText.day_of_week_fr [self.night_forecast [day_number] .day_of_week]
그밖에:
shortweekday == True 인 경우 :
output = output + self.getSpaces (공백) + WeatherText.day_of_week_short [self.night_forecast [day_number] .day_of_week]
그밖에:
output = output + self.getSpaces (공백) + WeatherText.day_of_week [self.night_forecast [day_number] .day_of_week]
elif 데이터 유형 == "WF": # 날씨 글꼴
output = output + self.getSpaces (공백) + WeatherText.conditions_weather_font [self.night_forecast [day_number] .condition_code]
elif 데이터 유형 == "LT":
문자열 = self.night_forecast [day_number] .low
self.isNumeric (문자열) == True 인 경우 :
imperial == True 인 경우 :
string = self.convertCelsiusToFahrenheit (문자열)
문자열 = 문자열 + 임시 단위
출력 = 출력 + self.getSpaces (공백) + 문자열

elif 데이터 유형 == "HT":
문자열 = self.night_forecast [day_number] .high
self.isNumeric (문자열) == True 인 경우 :
imperial == True 인 경우 :
string = self.convertCelsiusToFahrenheit (문자열)
문자열 = 문자열 + 임시 단위
출력 = 출력 + self.getSpaces (공백) + 문자열
elif 데이터 유형 == "CC":
self.locale == "is"인 경우 :
output = output + self.getSpaces (공백) + WeatherText.conditions_text_es [self.night_forecast [day_number] .condition_code]
elif self.locale == "fr":
output = output + self.getSpaces (공백) + WeatherText.conditions_text_fr [self.night_forecast [day_number] .condition_code]
그밖에:
output = output + self.getSpaces (공백) + WeatherText.conditions_text [self.night_forecast [day_number] .condition_code]
elif 데이터 유형 == "CT":
output = output + self.getSpaces (공백) + self.night_forecast [day_number] .condition_text
elif 데이터 유형 == "PC":
string = self.night_forecast [day_number] .precip
self.isNumeric (문자열) == True 인 경우 :
문자열 = 문자열 + u»%»
출력 = 출력 + self.getSpaces (공백) + 문자열
elif 데이터 유형 == "HM":
문자열 = self.night_forecast [day_number] .humidity
self.isNumeric (문자열) == True 인 경우 :
문자열 = 문자열 + u»%»
출력 = 출력 + self.getSpaces (공백) + 문자열
elif 데이터 유형 == "WD":
string = self.night_forecast [day_number] .wind_dir
self.locale == "is"인 경우 :
출력 = 출력 + self.getSpaces (공백) + WeatherText.bearing_text_es [문자열]
elif self.locale == "fr":
출력 = 출력 + self.getSpaces (공백) + WeatherText.bearing_text_fr [문자열]
그밖에:
출력 = 출력 + self.getSpaces (공백) + 문자열

elif 데이터 유형 == "BF":
output = output + self.getSpaces (공백) + WeatherText.bearing_arrow_font [self.night_forecast [day_number] .wind_dir]
elif 데이터 유형 == "WS":
문자열 = self.night_forecast [day_number] .wind_speed
self.isNumeric (문자열) == True 인 경우 :
imperial == True 인 경우 :
string = self.convertKilometresToMiles (문자열)
문자열 = 문자열 + 속도 단위
출력 = 출력 + self.getSpaces (공백) + 문자열
elif 데이터 유형 == "WG":
string = self.night_forecast [day_number] .wind_gusts
self.isNumeric (문자열) == True 인 경우 :
imperial == True 인 경우 :
string = self.convertKilometresToMiles (문자열)
문자열 = 문자열 + 속도 단위
출력 = 출력 + self.getSpaces (공백) + 문자열
elif 데이터 유형 == "CN":
output = output + self.getSpaces (공백) + self.night_forecast [day_number] .city
elif 데이터 유형 == "SR":
output = output + self.getSpaces (공백) + self.night_forecast [day_number] .sunrise
elif 데이터 유형 == "SS":
output = output + self.getSpaces (공백) + self.night_forecast [day_number] .sunset
elif 데이터 유형 == "MP":
output = output + self.getSpaces (공백) + self.night_forecast [day_number] .moon_phase
elif 데이터 유형 == "MF":
output = output + self.getSpaces (공백) + WeatherText.conditions_moon_font [self.night_forecast [day_number] .moon_icon]
elif 데이터 유형 == "BR":
output = output + self.getSpaces (공백) + self.night_forecast [day_number] .bar_read
elif 데이터 유형 == "BD":
output = output + self.getSpaces (공백) + self.night_forecast [day_number] .bar_desc
그밖에:
output = "\ nERROR : 알 수없는 데이터 유형이 요청되었습니다."
하다

기타 : # 일 예측 구함

범위의 day_number (시작일, 종료일 + 1) :

데이터 유형 == "DW"인 경우 :
self.locale == "is"인 경우 :
shortweekday == True 인 경우 :
output = output + self.getSpaces (공백) + WeatherText.day_of_week_short_es [self.day_forecast [day_number] .day_of_week]
그밖에:
output = output + self.getSpaces (공백) + WeatherText.day_of_week_es [self.day_forecast [day_number] .day_of_week]
elif self.locale == "fr":
shortweekday == True 인 경우 :
output = output + self.getSpaces (공백) + WeatherText.day_of_week_short_fr [self.day_forecast [day_number] .day_of_week]
그밖에:
output = output + self.getSpaces (공백) + WeatherText.day_of_week_fr [self.day_forecast [day_number] .day_of_week]
그밖에:
shortweekday == True 인 경우 :
output = output + self.getSpaces (공백) + WeatherText.day_of_week_short [self.day_forecast [day_number] .day_of_week]
그밖에:
output = output + self.getSpaces (공백) + WeatherText.day_of_week [self.day_forecast [day_number] .day_of_week]
elif 데이터 유형 == "WF": # 날씨 글꼴
output = output + self.getSpaces (공백) + WeatherText.conditions_weather_font [self.day_forecast [day_number] .condition_code]
elif 데이터 유형 == "LT":
문자열 = self.day_forecast [day_number] .low
self.isNumeric (문자열) == True 인 경우 :
imperial == True 인 경우 :
string = self.convertCelsiusToFahrenheit (문자열)
문자열 = 문자열 + 임시 단위
출력 = 출력 + self.getSpaces (공백) + 문자열
elif 데이터 유형 == "HT":
문자열 = self.day_forecast [day_number] .high
self.isNumeric (문자열) == True 인 경우 :
imperial == True 인 경우 :
string = self.convertCelsiusToFahrenheit (문자열)
문자열 = 문자열 + 임시 단위
출력 = 출력 + self.getSpaces (공백) + 문자열
elif 데이터 유형 == "CC":
self.locale == "is"인 경우 :
output = output + self.getSpaces (공백) + WeatherText.conditions_text_es [self.day_forecast [day_number] .condition_code]
elif self.locale == "fr":
output = output + self.getSpaces (공백) + WeatherText.conditions_text_fr [self.day_forecast [day_number] .condition_code]
그밖에:
output = output + self.getSpaces (공백) + WeatherText.conditions_text [self.day_forecast [day_number] .condition_code]
elif 데이터 유형 == "CT":
output = output + self.getSpaces (공백) + self.day_forecast [day_number] .condition_text
elif 데이터 유형 == "PC":
문자열 = self.day_forecast [day_number] .precip
self.isNumeric (문자열) == True 인 경우 :
문자열 = 문자열 + u»%»
출력 = 출력 + self.getSpaces (공백) + 문자열
elif 데이터 유형 == "HM":
문자열 = self.day_forecast [day_number] .humidity
self.isNumeric (문자열) == True 인 경우 :
문자열 = 문자열 + u»%»
출력 = 출력 + self.getSpaces (공백) + 문자열
elif 데이터 유형 == "WD":
문자열 = self.day_forecast [day_number] .wind_dir

self.locale == "is"인 경우 :
출력 = 출력 + self.getSpaces (공백) + WeatherText.bearing_text_es [문자열]
elif self.locale == "fr":
출력 = 출력 + self.getSpaces (공백) + WeatherText.bearing_text_fr [문자열]
그밖에:
출력 = 출력 + self.getSpaces (공백) + 문자열

elif 데이터 유형 == "BF":
output = output + self.getSpaces (공백) + WeatherText.bearing_arrow_font [self.day_forecast [day_number] .wind_dir]
elif 데이터 유형 == "WS":
문자열 = self.day_forecast [day_number] .wind_speed
self.isNumeric (문자열) == True 인 경우 :
imperial == True 인 경우 :
string = self.convertKilometresToMiles (문자열)
문자열 = 문자열 + 속도 단위
출력 = 출력 + self.getSpaces (공백) + 문자열
elif 데이터 유형 == "WG":
문자열 = self.day_forecast [day_number] .wind_gusts
self.isNumeric (문자열) == True 인 경우 :
imperial == True 인 경우 :
string = self.convertKilometresToMiles (문자열)
문자열 = 문자열 + 속도 단위
출력 = 출력 + self.getSpaces (공백) + 문자열
elif 데이터 유형 == "CN":
output = output + self.getSpaces (공백) + self.day_forecast [day_number] .city
elif 데이터 유형 == "SR":
output = output + self.getSpaces (공백) + self.day_forecast [day_number] .sunrise
elif 데이터 유형 == "SS":
output = output + self.getSpaces (공백) + self.day_forecast [day_number] .sunset
elif 데이터 유형 == "MP":
output = output + self.getSpaces (공백) + self.day_forecast [day_number] .moon_phase
elif 데이터 유형 == "MF":
output = output + self.getSpaces (공백) + WeatherText.conditions_moon_font [self.day_forecast [day_number] .moon_icon]
elif 데이터 유형 == "BR":
output = output + self.getSpaces (공백) + self.day_forecast [day_number] .bar_read
elif 데이터 유형 == "BD":
output = output + self.getSpaces (공백) + self.day_forecast [day_number] .bar_desc
그밖에:
출력 = u»\ n 오류 : 알 수없는 데이터 유형이 요청 됨»
하다

output = u»»+ output.strip (u»«) # 선행 / 후행 공백 손실
반환 출력

#외:
#print "getOutputText : 예기치 않은 오류 :", sys.exc_info () [0]

def getOutputTextFromTemplate (자신, 템플릿) :
#시험:

템플릿 데이터에 대한 키 # 개
DATATYPE_KEY = "– 데이터 유형 ="
STARTDAY_KEY = "– 시작일 ="
ENDDAY_KEY = "– 종료일 ="
NIGHT_KEY = "– 밤"
SHORTWEEKDAY_KEY = "–shortweekday"
IMPERIAL_KEY = "– 영국식"
HIDEUNITS_KEY = "–hideunits"
SPACES_KEY = "– 공백 ="

출력 = u»»

optionfound = 거짓

# 파일로드
시도 :
fileinput = 열기 (self.options.template)
템플릿 = fileinput.read ()
fileinput.close ()
외:
output = u»템플릿 파일을 찾을 수 없습니다!»

templatelist = self.getTemplateList (템플릿)

# 템플릿 목록을 살펴보고 발견 된 각 항목에 대한 출력을 결정할 수 있습니다.
(0, len (템플릿 목록) -1) 범위에있는 i의 경우 :

pos = 템플릿 목록 [i] .find (DATATYPE_KEY)
pos! = -1 인 경우 :
optionfound = 참
pos = pos + len (DATATYPE_KEY)
datatype = templatelist [i] [pos : pos + 4] .strip («}»). strip («{«). strip («-«). strip (»«)
그밖에:
데이터 유형 = 없음

pos = 템플릿 목록 [i] .find (STARTDAY_KEY)
pos! = -1 인 경우 :
optionfound = 참
pos = pos + len (STARTDAY_KEY)
startday = int (템플릿 목록 [i] [pos : pos + 4] .strip ( "}"). strip ( "{"). strip ( "-"). strip ( ""))
그밖에:
시작일 = 없음

pos = 템플릿 목록 [i] .find (ENDDAY_KEY)
pos! = -1 인 경우 :
optionfound = 참
pos = pos + len (ENDDAY_KEY)
endday = int (템플릿 목록 [i] [pos : pos + 4] .strip ( "}"). strip ( "{"). strip ( "-"). strip ( ""))
그밖에:
종료일 = 없음

pos = 템플릿 목록 [i] .find (NIGHT_KEY)
pos! = -1 인 경우 :
optionfound = 참
밤 = True
그밖에:
밤 = 거짓

pos = 템플릿 목록 [i] .find (SHORTWEEKDAY_KEY)
pos! = -1 인 경우 :
optionfound = 참
shortweekday = 참
그밖에:
shortweekday = 거짓

pos = 템플릿 목록 [i] .find (IMPERIAL_KEY)
pos! = -1 인 경우 :
optionfound = 참
제국 = 사실
그밖에:
제국 = 거짓

pos = templatelist [i] .find (HIDEUNITS_KEY)
pos! = -1 인 경우 :
optionfound = 참
hideunits = 참
그밖에:
hideunits = 거짓

pos = templatelist [i] .find (SPACES_KEY)
pos! = -1 인 경우 :
optionfound = 참
pos = pos + len (SPACES_KEY)
공백 = int (템플릿 목록 [i] [pos : pos + 4] .strip («}»). strip («{«). strip («-«). strip (»«))
그밖에:
공백 = 1

optionfound == True 인 경우 :
templatelist [i] = self.getOutputText (데이터 유형, 시작일, 종료일, 밤, 짧은 주중, 임페리얼, hideunits, 공백)
optionfound = 거짓

# 이제 채워 졌으므로 출력을 연결하는 목록을 살펴 봅니다.
템플릿 목록의 항목 :
산출물 = 산출물 + 품목

반환 출력

#외:
#print "getOutputTextFromTemplate : 예기치 않은 오류 :", sys.exc_info () [0]

def fetchData (자체) :

# 항상 메트릭 데이터를 가져오고이 데이터에 대화 기능을 사용합니다.
file_path_current = self.TEMP_FILEPATH_CURRENT.replace ( "LOCATION", 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 () == False 인 경우 :
os.path.exists (file_path_current) :
RefetchData = 거짓
else : # 연결도, 캐시도, 쾅!
print "사용 가능한 인터넷 연결이 없으며 캐시 된 날씨 데이터가 없습니다."
elif self.options.refetch == True :
RefetchData = 참
그밖에:
# 데이터를 다시 검색해야합니까?
os.path.exists (file_path_current) :
lastmodDate = time.localtime (os.stat (file_path_current) [ST_MTIME])
expiryDate = (datetime.datetime.today ()-datetime.timedelta (분 = self.EXPIRY_MINUTES)). timetuple ()

expiryDate> lastmodDate 인 경우 :
RefetchData = 참
그밖에:
RefetchData = 거짓
그밖에:
RefetchData = 참

# 웹 사이트에서 또는 'unpickling'으로 현재 상태 데이터를 가져옵니다.
RefetchData == True 인 경우 :

# xoap 서비스에서 현재 상태 데이터 가져 오기
시도 :

# 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 & 링크 = xoap∏ = xoap & par = 1061785028 & key = e374effbfd74930b & 단위 = m '
self.options.verbose == True 인 경우 :
print >> sys.stdout,«날씨 데이터 가져 오기«, url

Usock = urllib2.urlopen (URL)
xml = usock.read ()
Usock.close ()
self.weatherxmldoc = minidom.parseString (xml)
외:
print "fetchData : 예기치 않은 오류 :", sys.exc_info () [0]
print "현재 상태에 대해 기상 소스에 연결할 수 없음"

# 위치가 잘못된 경우 사용자에게 알립니다…
found = xml.find ( "잘못된 위치 제공")
발견되면! = -1 :
print "잘못된 위치 제공됨"

# 날씨 데이터를 조사하고, 클래스 구조에로드하고 피클
시도 :

# 날씨 데이터 목록 준비
self.current_conditions = []
self.day_forecast = []
self.night_forecast = []

# 일반 데이터 수집
Weather_n = self.weatherxmldoc.documentElement
location_n = weather_n.getElementsByTagName ( 'loc') [0]
city_n = location_n.getElementsByTagName ( 'dnam') [0]
도시 = self.getText (city_n.childNodes)

# 현재 상태 데이터 수집
day_of_week = u»오늘»
강수량 = 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 ( 'icon') [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 ( 'bar') [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 ( 'wind') [0]
wind_speed_n = wind_n.getElementsByTagName ( 's') [0]
wind_speed = self.getText (wind_speed_n.childNodes)
wind_gust_n = wind_n.getElementsByTagName ( 'gust') [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)
습도 _n = current_condition_n.getElementsByTagName ( 'hmid') [0]
습도 = self.getText (humidity_n.childNodes)
moon_n = current_condition_n.getElementsByTagName ( 'moon') [0]
moon_icon_n = moon_n.getElementsByTagName ( 'icon') [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 = 날씨 데이터 (요일, 현재 _ 온도 _ 느낌, 현재 _ 온도, 현재 _ 코드, 현재 _desc, 강수, 습도, 풍향, wind_speed, wind_gusts, 도시, 일출, 일몰, moon_phase, moon_icon, bar_read, bar_desc)
self.current_conditions.append (current_conditions_data)

# 예측 데이터 수집
bar_read = u»N / A»
bar_desc = u»N / A»
moon_phase = u»N / A»
moon_icon = 유 »나»
Forecast_n = weather_n.getElementsByTagName ( 'dayf') [0]
day_nodes = Forecast_n.getElementsByTagName ( 'day')

day_nodes의 일 :
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 ( 'low') [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 ( 'suns') [0]
sunset = self.getText (sunset_n.childNodes)

# 일 예측 특정 데이터
daytime_n = day.getElementsByTagName ( 'part') [0] # 일
condition_code_n = daytime_n.getElementsByTagName ( 'icon') [0]
condition_code = self.getText (condition_code_n.childNodes)
condition_n = daytime_n.getElementsByTagName ( 't') [0]
condition = self.getText (condition_n.childNodes)
precip_n = daytime_n.getElementsByTagName ( 'ppcp') [0]
precip = self.getText (precip_n.childNodes)
습도 _n = daytime_n.getElementsByTagName ( 'hmid') [0]
습도 = self.getText (humidity_n.childNodes)
wind_n = daytime_n.getElementsByTagName ( 'wind') [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 ( 'gust') [0]
wind_gusts = self.getText (wind_gusts_n.childNodes)
day_forecast_data = WeatherData (요일 _ 주, 낮 _ 기온, 고온, 조건 _ 코드, 조건, 강수, 습도, 풍향, 풍속, 바람 _ 돌풍, 도시, 일출, 일몰, 달 _ 위상, 달 _ 아이콘, bar_read, bar_desc)
self.day_forecast.append (일 _ 예측 _ 데이터)

# 야간 예보 관련 데이터
daytime_n = day.getElementsByTagName ( 'part') [1] # 밤
condition_code_n = daytime_n.getElementsByTagName ( 'icon') [0]
condition_code = self.getText (condition_code_n.childNodes)
condition_n = daytime_n.getElementsByTagName ( 't') [0]
condition = self.getText (condition_n.childNodes)
precip_n = daytime_n.getElementsByTagName ( 'ppcp') [0]
precip = self.getText (precip_n.childNodes)
습도 _n = daytime_n.getElementsByTagName ( 'hmid') [0]
습도 = self.getText (humidity_n.childNodes)
wind_n = daytime_n.getElementsByTagName ( 'wind') [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 ( 'gust') [0]
wind_gusts = self.getText (wind_gusts_n.childNodes)
night_forecast_data = WeatherData (요일 _ 주간, 저온 _ 기온, 고온 _ 기온, 조건 _ 코드, 조건, 강수, 습도, 풍향, 풍속, 풍향, 도시, 일출, 일몰, 달 _ 위상, 달 _ 아이콘, bar_read, bar_desc)
self.night_forecast.append (야간 _ 예측 _ 데이터)

# 다음 번에 데이터 피클!
fileoutput = 열기 (file_path_current, 'w')
pickle.dump (self.current_conditions, 파일 출력)
fileoutput.close ()

fileoutput = 열기 (file_path_dayforecast, 'w')
pickle.dump (self.day_forecast, 파일 출력)
fileoutput.close ()

fileoutput = 열기 (file_path_nightforecast, 'w')
pickle.dump (self.night_forecast, 파일 출력)
fileoutput.close ()

외:
print "fetchData : 예기치 않은 오류 :", sys.exc_info () [0]
print "날씨 데이터를 조사 할 수 없음"

else : # 피클 클래스 파일에서 날씨 데이터 가져 오기
self.options.verbose == True 인 경우 :
print >> sys.stdout,«파일에서 날씨 데이터 가져 오기 :«, file_path_current

fileinput = 열기 (file_path_current, 'r')
self.current_conditions = pickle.load (파일 입력)
fileinput.close ()

self.options.verbose == True 인 경우 :
print >> sys.stdout, "파일에서 하루 예보 데이터 가져 오기 :", file_path_dayforecast, file_path_nightforecast

fileinput = 열기 (file_path_dayforecast, 'r')
self.day_forecast = pickle.load (파일 입력)
fileinput.close ()

self.options.verbose == True 인 경우 :
print >> sys.stdout, "파일에서 하루 예보 데이터 가져 오기 :", file_path_nightforecast, file_path_nightforecast

fileinput = 열기 (file_path_nightforecast, 'r')
self.night_forecast = pickle.load (파일 입력)
fileinput.close ()

def outputData (자체) :
#시험:

self.options.template! = 없음 :

output = self.getOutputTextFromTemplate (self.options.template)

그밖에:

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. options.spaces)

print output.encode ( "utf-8")

#외:
#print«outputData : 예기치 않은 오류 :«, sys.exc_info () [0]

__name__ == "__main__"인 경우 :

파서 = CommandLineParser ()
(옵션, 인수) = parser.parse_args ()

options.verbose == True 인 경우 :
print >> sys.stdout, "위치 :", options.location
print >> sys.stdout, "imperial :", options.imperial
print >> sys.stdout, "datatype :", options.datatype
print >> sys.stdout, "night :", options.night
print >> sys.stdout, "시작일 :", options.startday
print >> sys.stdout, "종료일 :", options.endday
print >> sys.stdout, "spaces :", options.spaces
print >> sys.stdout, "verbose :", options.verbose
print >> sys.stdout, "refetch :", options.refetch

# 새로운 글로벌 날씨 객체 생성
weather = GlobalWeather (옵션)
weather.fetchData ()
weather.outputData ()

~ / Conky / scripts / myweather.template 파일을 만듭니다.

gedit ~ / Conky / 스크립트 / myweather.template

내부에 다음을 붙여 넣습니다.

{– 데이터 유형 = DW – 시작일 = 1} : {– 데이터 유형 = CC – 시작일 = 1}
{– 데이터 유형 = HT –startday = 1} / {–datatype = LT –startday = 1} {–datatype = WD –startday = 1}에서 {–datatype = WS –startday = 1}로 바람
습도 : {–datatype = HM –startday = 1} 강수량 : {–datatype = PC –startday = 1}
일출 : {–datatype = SR –startday = 1} 일몰 : {–datatype = SS –startday = 1}
----------------
{– 데이터 유형 = DW – 시작일 = 2} : {– 데이터 유형 = CC – 시작일 = 2}
{– 데이터 유형 = HT –startday = 2} / {–datatype = LT –startday = 2} {–datatype = WD –startday = 2}에서 {–datatype = WS –startday = 2}로 바람
습도 : {–datatype = HM –startday = 2} 강수량 : {–datatype = PC –startday = 2}
일출 : {–datatype = SR –startday = 2} 일몰 : {–datatype = SS –startday = 2}
----------------
{– 데이터 유형 = DW – 시작일 = 3} : {– 데이터 유형 = CC – 시작일 = 3}
{– 데이터 유형 = HT –startday = 3} / {–datatype = LT –startday = 3} {–datatype = WD –startday = 3}에서 {–datatype = WS –startday = 3}로 바람
습도 : {–datatype = HM –startday = 3} 강수량 : {–datatype = PC –startday = 3}
일출 : {–datatype = SR –startday = 3} 일몰 : {–datatype = SS –startday = 3}
----------------
{– 데이터 유형 = DW – 시작일 = 4} : {– 데이터 유형 = CC – 시작일 = 4}
{– 데이터 유형 = HT –startday = 4} / {–datatype = LT –startday = 4} {–datatype = WD –startday = 4}에서 {–datatype = WS –startday = 4}로 바람
습도 : {–datatype = HM –startday = 4} 강수량 : {–datatype = PC –startday = 4}
일출 : {–datatype = SR –startday = 4} 일몰 : {–datatype = SS –startday = 4}

~ / Conky / scripts / mail / conkyEmail.py 파일을 만듭니다 (메일 폴더를 만들어야합니다).

gedit ~ / Conky / 스크립트 / 메일 / conkyEmail.py

내부에 다음을 붙여 넣습니다.

운영 체제 가져 오기
가져 오기 문자열

# 큰 따옴표 안에 사용자 이름과 비밀번호를 입력하세요.
# 예. 사용자 이름 =»사용자 이름»및 비밀번호 =»비밀번호»
사용자 이름 =»YOUR_USUARIO_SINARROBA«
비밀번호 =»YOUR_KEY«

com =»wget -O-https : //»+ 사용자 이름 +»:»+ 비밀번호 +»@ 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 인 경우 :
"0 new"인쇄
그밖에:
print str (fc) +»new»

이제 7 개의 파일이 있습니다.

폴더에서 : ~
-> .startconky <<-실행 가능하게 만들기

폴더에서 : ~ / Conky
-> 콩키 메인
-> conkyforecast
-> conkymail

그리고 폴더에서 : ~ / Conky / scripts
-> conkyForecast.py <<-실행 가능하게 만들기
-> myweather.template

그리고 폴더에서 : ~ / Conky / scripts / mail
conkyEmail.py <<-실행 가능하게 만들기

그게 전부입니다. / home / user / ... 사용자 이름이 표시되고 Gmail 데이터가가는 부분은 데이터를 입력해야하는 부분을 색상으로 강조 표시했습니다.

conky 프로세스를 종료하려면 콘솔에 쓰기

죽이는 콩키

콘솔에 conky 쓰기를 실행하려면

./.스타트콘키

일단 모든 것이 조정되면 각 세션을 시작하려면

시스템-> 환경 설정-> 세션 및 시작 프로그램에서 추가합니다.

Name에 Conky를 쓸 수 있습니다. ./.startconky 순서대로 PC를 켤 때마다 시작됩니다.

그게 도움이 되길 바랍니다.


코멘트를 남겨주세요

귀하의 이메일 주소는 공개되지 않습니다. 필수 필드가 표시되어 있습니다 *

*

*

  1. 데이터 책임자 : Miguel Ángel Gatón
  2. 데이터의 목적 : 스팸 제어, 댓글 관리.
  3. 합법성 : 귀하의 동의
  4. 데이터 전달 : 법적 의무에 의한 경우를 제외하고 데이터는 제 XNUMX 자에게 전달되지 않습니다.
  5. 데이터 저장소 : Occentus Networks (EU)에서 호스팅하는 데이터베이스
  6. 권리 : 귀하는 언제든지 귀하의 정보를 제한, 복구 및 삭제할 수 있습니다.