Quantcast
Channel: Rainmeter Forums
Viewing all articles
Browse latest Browse all 473

Help: Rainmeter Skins • Weather skin RegEx error.

$
0
0
It's been working for around 2-3 years now, but all of a sudden it's stopped showing the current temperature and looking at the log I have two errors:
1. Just says "Something Went Wrong"
2. RegExp matching error (-1) (RM\Weather\Weather.ini - [mWeatherParent])

I haven't changed anything and I have no knowledge of how RegEx works. Would somebody please tell me what's happened and how to fix? Thank you so much.

Here's the code in two separate files:
Weather.ini
[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
BackgroundMode=2
SolidColor=0,0,0,1
OnRefreshAction=[!UpdateMeter *] [!UpdateMeter *] [!Redraw]
@Include=WeatherParser.inc

[Metadata]
Name=Weather
Author=sl23
Version=2023-09-18
License=Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
Information=Adapted from JDWS-04 by Jelle Dekkers (github.com/adriaanjelle)

[Variables]
Green=128,255,0
White=255,255,255,200

WeatherLocation=**********
; Just enter your city's name or your address here or whatever. Anything should work here.
; TIP: Check Rainmeter's About/log to see what location it got.

========================================
; STYLES
========================================
[Style]
FontFace=Trebuchet MS
FontColor=#White#
FontSize=12
AntiAlias=1
DynamicVariables=1
UpdateDivider=-1

[sHighlight]
MouseOverAction=[!SetOption #CURRENTSECTION# FontColor "#Green#"] [!UpdateMeter #CURRENTSECTION#] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# FontColor ""] [!UpdateMeter #CURRENTSECTION#] [!Redraw]

========================================
; WEATHER
========================================
[WeatherCurrentTemperature]
Meter=String
MeterStyle=Style | sHighlight
Text=[mWeatherCurrentTemperature]°
LeftMouseUpAction=[!Refresh]
MiddleMouseUpAction=[!EditSkin]
ToolTipIcon=Info
ToolTipTitle=[mWeatherLocationCity]
ToolTipText=L - Refresh#CRLF#M - Set Location
X=2
Y=0
WeatherParser.ini
[Variables]
Language=en-GB
WeatherAPIKey=21d8a80b3d6b444998a80b3d6b1449d3
WeatherUnitsMetric=m
WeatherUnitsImperial=e
WeatherRegExpString=((?(?=null)null|".*"))
WeatherRegExpNumber=((?(?=null)null|.*))
WeatherSubstitute="^null$":"", '^"(.*)"$':"\1", "^\\1$":""
WeatherUnits=Metric
; The units of the weather info. Valid values are "Metric" and "Imperial".

[mInternetConnectivity]
Measure=Plugin
Plugin=SysInfo
SysInfoType=INTERNET_CONNECTIVITY
OnChangeAction=[!CommandMeasure mWeatherLocationParent Update]

; ================================================

[mWeatherLocationParent]
Measure=WebParser
URL=https://nominatim.openstreetmap.org/search?q=#WeatherLocation#&format=geocodejson&limit=1&addressdetails=1
RegExp=(?siU)"features":\[{"type":"Feature","properties":{"geocoding":{.*,"label":"(.*)",.*,"admin":{"level\d+":"(.*)".*}}},"geometry":{"type": "Point","coordinates": \[(.*), (.*)\]}}\]
UserAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36
UpdateRate=(60*15)

FinishAction=[!UpdateMeasureGroup WeatherLocation] [!EnableMeasure mWeatherParent] [!UpdateMeasure mWeatherParent] [!Log "Location found: [mWeatherLocation]" Notice]
OnConnectErrorAction=[!UpdateMeasureGroup WeatherLocation] [!EnableMeasure mWeatherParent] [!UpdateMeasure mWeatherParent] [!Log "Unable to connect to Nominatim." Error]
OnRegExpErrorAction=[!UpdateMeasureGroup WeatherLocation] [!EnableMeasure mWeatherParent] [!UpdateMeasure mWeatherParent] [!Log "No results found for that location." Error]

; ================================================

[mWeatherLocation]
Group=WeatherLocation
Measure=WebParser
URL=[mWeatherLocationParent]
StringIndex=1

[mWeatherLocationCity]
Group=WeatherLocation
Measure=WebParser
URL=[mWeatherLocationParent]
StringIndex=2
Substitute="":"Earth"

[mWeatherLocationLat]
Group=WeatherLocation
Measure=WebParser
URL=[mWeatherLocationParent]
StringIndex=4
Substitute="":"None"

[mWeatherLocationLon]
Group=WeatherLocation
Measure=WebParser
URL=[mWeatherLocationParent]
StringIndex=3
Substitute="":"None"

; ================================================

[mWeatherParent]
Group=Parent
Measure=WebParser

URL=https://api.weather.com/v3/aggcommon/v3-wx-observations-current;v3-wx-forecast-daily-15day?format=json&geocode=[&mWeatherLocationLat],[&mWeatherLocationLon]&units=[#WeatherUnits[#WeatherUnits]]&language=[#Language]&apiKey=#WeatherAPIKey#
RegExp=(?siU)"v3-wx-observations-current":.*{(.*)}.*"v3-wx-forecast-daily-15day":.*{(.*),"daypart":\[{(.*)}\]}
UserAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36
UpdateRate=1

FinishAction=[!EnableMeasureGroup Weather] [!UpdateMeasureGroup Weather] [!UpdateMeter *] [!UpdateMeter *] [!Redraw] [!Log "Finished parsing weather data." Notice]
OnConnectErrorAction=[!EnableMeasureGroup Weather] [!UpdateMeasureGroup Weather] [!UpdateMeter *] [!UpdateMeter *] [!Redraw] [!Log "Unable to connect to Weather.com." Error]
OnRegExpErrorAction=[!EnableMeasureGroup Weather] [!UpdateMeasureGroup Weather] [!UpdateMeter *] [!UpdateMeter *] [!Redraw] [!Log "Something went wrong." Error]

DynamicVariables=1
UpdateDivider=-1
Disabled=1

; ================================================

[mWeatherCurrentTemperature]
Group=Weather
Measure=WebParser
URL=[mWeatherParent]
StringIndex=1
RegExp=(?siU)"temperature":#WeatherRegExpNumber#[,}\]]
StringIndex2=1
RegExpSubstitute=1
Substitute="#WeatherSubstitute#", "^$":"--"

Statistics: Posted by sl23 — Today, 1:18 pm — Replies 1 — Views 57



Viewing all articles
Browse latest Browse all 473

Trending Articles