pyrogas 发表于 2013-3-26 13:44:57

【Weather】Rainmeter国内天气代码详解

本帖最后由 pyrogas 于 2013-7-1 01:07 编辑

以自己的illustro皮肤为例(link:http://bbs.rainmeter.cn/thread-55131-1-1.html )
另外一款Companion套装同样是用这个代码的
这个皮肤的特点就是可以根据时间自动切换白天和夜晚模式,图标和温度都会切换。图标切换是必然的,至于温度,国内的天气网站会在夜晚把白天的最高温删除,如果不作出调整,那么插件预报的明日气温其实是,今日最低温和明日最高温,以此类推后天的气温也不准切了。很多天气皮肤都存在这个问题,所以自己写了一个。2013/6/30更新,重写。

Author=Papa
e-mail:pyrogas7@gmail.com
Update=1000


WeatherCodeLocation=101210101
WeatherUnit=m

Day=[!ShowmeterGroup Day][!HideMeterGroup Night]\\\\ 依旧定义白天隐藏什么组,夜晚显示什么组
Night=[!HidemeterGroup Day][!ShowMeterGroup Night]


Fontface=微软雅黑    \\\\\\\\\\\\\定义字体、大小、颜色,可以直接引用减少代码行
FontColor=255,255,255,180
FontSize=7
StringAlign=RIGHT
StringStyle=BOLD
Antialias=1

;==================================================BG

    \\\\\\\\\\\\\\\\设置背景
Meter=IMAGE            \\\\\\\\\\\\\\\\\\Meter为图片
ImageName=BackgroundAnalog.png          \\\\\\\\\\\\\\图片地址
X=0
Y=0

;=========================================================Weather RSS


Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=600
URL=http://m.weather.com.cn/data//#WeatherCodeLocation#.html
cc=*&unit=#WeatherUnit#&dayf=6
RegExp="{"weatherinfo":{"city":"(.*)","city_en":"(.*)","date_y":"(.*)","date":"(.*)","week":"(.*)","fchh":"(.*)","cityid":"(.*)","temp1":"(.*)℃~(.*)℃","temp2":"(.*)℃~(.*)℃","temp3":"(.*)℃~(.*)℃","temp4":"(.*)℃~(.*)℃","temp5":"(.*)℃~(.*)℃","temp6":"(.*)~(.*)","tempF1":"(.*)","tempF2":"(.*)","tempF3":"(.*)","tempF4":"(.*)","tempF5":"(.*)","tempF6":"(.*)","weather1":"(.*)","weather2":"(.*)","weather3":"(.*)","weather4":"(.*)","weather5":"(.*)","weather6":"(.*)","img1":"(.*)","img2":"(.*)","img3":"(.*)","img4":"(.*)","img5":"(.*)","img6":"(.*)","img7":"(.*)","img8":"(.*)","img9":"(.*)","img10":"(.*)","img11":"(.*)","img12":"(.*)","img_single":"(.*)","img_title1":"(.*)","img_title2":"(.*)","img_title3":"(.*)","img_title4":"(.*)","img_title5":"(.*)","img_title6":"(.*)","img_title7":"(.*)","img_title8":"(.*)","img_title9":"(.*)","img_title10":"(.*)","img_title11":"(.*)","img_title12":"(.*)","img_title_single":"(.*)","wind1":"(.*)","wind2":"(.*)","wind3":"(.*)","wind4":"(.*)","wind5":"(.*)","wind6":"(.*)","fx1":"(.*)","fx2":"(.*)","fl1":"(.*)","fl2":"(.*)","fl3":"(.*)","fl4":"(.*)","fl5":"(.*)","fl6":"(.*)","index":"(.*)","index_d":"(.*)","index48":"(.*)","index48_d":"(.*)","index_uv":"(.*)","index48_uv":"(.*)","index_xc":"(.*)","index_tr":"(.*)","index_co":"(.*)","st1":"(.*)","st2":"(.*)","st3":"(.*)","st4":"(.*)","st5":"(.*)","st6":"(.*)","index_cl":"(.*)","index_ls":"(.*)"}}"   \\\\\\\\\\设定取值格式

;=====================================================Now Temp


Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=1800
Url=http://www.weather.com.cn/data/sk//#WeatherCodeLocation#.html
RegExp="{"weatherinfo":{"city":"(.*)","cityid":"(.*)","temp":"(.*)","WD":"(.*)","WS":"(.*)","SD":"(.*)","WSE":"(.*)","time":"(.*)","isRadar":"(.*)","Radar":"(.*)"}}"
StringIndex=1
;=================================================Now


Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=
StringIndex=3    \\\\\\\\\\\\\\\\\取格式中第3个(.*)代替的数值。


Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=
StringIndex=26\\\\\\\\\\\\\\\\\取格式中第26个(.*)代替的数值。


Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=
StringIndex=32

;==================================================Now Day

\\\\白天天气图标
Group=Day    \\\\\\\\对不同内容进行分组
MeasureName=MeasureWeatherIcon    \\\\\\\\\\\\\\\\\\\获取数值
Meter=IMAGE
Path=#CurrentPATH#/Day/                      \\\\\\\\\\\\\\\\\\\\\\输出Day文件夹下的天气图标
X=15
Y=13
W=40
H=40


Group=Night
MeasureName=MeasureWeatherIcon
Meter=IMAGE
Path=#CurrentPATH#/Night/
X=15
Y=13
W=40
H=40


MeasureName=MeasureWeatherTemp
Meter=STRING
X=200
Y=10
FontColor=255,255,255,205
FontSize=12
StringAlign=RIGHT
StringStyle=BOLD
FontFace=微软雅黑
Antialias=1
Postfix="°"


MeasureName=MeasureWeatherDesc
Meter=STRING
X=100
Y=14
W=100
FontColor=255,255,255,205
FontSize=8
StringAlign=RIGHT
StringStyle=BOLD
FontFace=微软雅黑
Antialias=1

;=================================================Temp
--------------------------------Day

Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=
StringIndex=8


Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=
StringIndex=9


Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=
StringIndex=10


Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=
StringIndex=11


Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=
StringIndex=12


Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=
StringIndex=13

;--------------------------------Night

Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=
StringIndex=9


Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=
StringIndex=10


Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=
StringIndex=11


Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=
StringIndex=12


Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=
StringIndex=13


Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=
StringIndex=14

;================================================Icons
这里需要说明一下,在Weather D&N中有这样一段代码:Substitute="99":    因为在网页数据中,99代表晚上天气图标与白天天气图标相同,所以需要把夜晚时候的99替换为白天数据。


Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=
StringIndex=32

;-------------------------

Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=
StringIndex=34

;-------------------------

Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=
StringIndex=36



;==================================================================ICON

Group=Day
MeasureName=MeasureWeatherIcon1
Meter=IMAGE
Path=#CurrentPATH#/Day/
X=70
Y=37
H=20
W=20


Group=Day
MeasureName=MeasureWeatherIcon2
Meter=IMAGE
Path=#CurrentPATH#/Day/
X=25R
Y=37
H=20
W=20


Group=Day
MeasureName=MeasureWeatherIcon3
Meter=IMAGE
Path=#CurrentPATH#/Day/
X=25R
Y=37
H=20
W=20
--------------------------------------

Group=Night
MeasureName=MeasureWeatherIcon1
Meter=IMAGE
Path=#CurrentPATH#/Night/
X=70
Y=37
H=20
W=20


Group=Night
MeasureName=MeasureWeatherIcon2
Meter=IMAGE
Path=#CurrentPATH#/Night/
X=25R
Y=37
H=20
W=20


Group=Night
MeasureName=MeasureWeatherIcon3
Meter=IMAGE
Path=#CurrentPATH#/Night/
X=25R
Y=37
H=20
W=20

;==============================================DayTemp


Group=Day
MeasureName=MeasureWeatherTempD1
Meter=STRING
MeterStyle=TXT
X=115
Y=35
Postfix="°"


Group=Day
MeasureName=MeasureWeatherTempD2
Meter=STRING
MeterStyle=TXT
X=115
Y=-2R
Postfix="°"


Group=Day
MeasureName=MeasureWeatherTempD3
Meter=STRING
MeterStyle=TXT
X=157
Y=35
Postfix="°"


Group=Day
MeasureName=MeasureWeatherTempD4
Meter=STRING
MeterStyle=TXT
X=157
Y=-2R
Postfix="°"


Group=Day
MeasureName=MeasureWeatherTempD5
Meter=STRING
MeterStyle=TXT
X=199
Y=35
Postfix="°"


Group=Day
MeasureName=MeasureWeatherTempD6
Meter=STRING
MeterStyle=TXT
X=199
Y=-2R
Postfix="°"
;==============================================NightTemp


Group=Night
MeasureName=MeasureWeatherTempN1
Meter=STRING
MeterStyle=TXT
X=115
Y=35
Postfix="°"


Group=Night
MeasureName=MeasureWeatherTempN2
Meter=STRING
MeterStyle=TXT
X=115
Y=-2R
Postfix="°"


Group=Night
MeasureName=MeasureWeatherTempN3
Meter=STRING
MeterStyle=TXT
X=157
Y=35
Postfix="°"


Group=Night
MeasureName=MeasureWeatherTempN4
Meter=STRING
MeterStyle=TXT
X=157
Y=-2R
Postfix="°"


Group=Night
MeasureName=MeasureWeatherTempN5
Meter=STRING
MeterStyle=TXT
X=199
Y=35
Postfix="°"


Group=Night
MeasureName=MeasureWeatherTempN6
Meter=STRING
MeterStyle=TXT
X=199
Y=-2R
Postfix="°"
;=============================================Shift


Measure=Time
Format=%H


Measure=Calc
DynamicVariables=1
Formula=>5 ? (<18 ? 0 : 1 ) : 1            \\\\\\\\\ 判断当前时间是否在 5~18之间,是输出0,否输出1

                  \\\\\\\\\\\\\\当SUNORNIGHT=1时显示Night组
Measure=Calc
Formula=DayOrNight
IfEqualValue=1
IfEqualAction=!execute #Night#[!RainmeterRedraw]

                   \\\\\\\\\\\\\\当SUNORNIGHT=0时显示Day组
Measure=Calc
Formula=DayOrNight
IfEqualValue=0
IfEqualAction=!execute #Day#[!RainmeterRedraw]

pyrogas 发表于 2013-3-26 13:52:11

本帖最后由 pyrogas 于 2013-7-1 00:07 编辑

~~

pyrogas 发表于 2013-3-26 13:53:10

zhujiakai1030 发表于 2013-3-26 13:50 static/image/common/back.gif
支持教程啊...顶一个

少年……沙发抢的太快了……还没发完……

hvzone 发表于 2013-3-26 13:54:41

咱也来支持下,教程贴哇~

pyrogas 发表于 2013-3-26 13:58:53

hvzone 发表于 2013-3-26 13:54 static/image/common/back.gif
咱也来支持下,教程贴哇~

为了发这个贴,把我的活跃值都换完了……好不容易才到高级会员……

萝莉头 发表于 2013-3-26 14:05:03

鲇鱼,评分里我错字了,见谅

许久不见,来个基情的拥抱?

pyrogas 发表于 2013-3-26 14:14:25

萝莉头 发表于 2013-3-26 14:05 static/image/common/back.gif
鲇鱼,评分里我错字了,见谅

许久不见,来个基情的拥抱?

{:10_428:}来一个

mxmenghuan130 发表于 2013-3-26 18:05:13

艾江湖 发表于 2013-3-26 18:42:25

又是一个技术男吗?

尹洛苏 发表于 2013-3-26 18:48:29

很不错,前排支持下。
页: [1] 2 3 4 5 6
查看完整版本: 【Weather】Rainmeter国内天气代码详解