It is currently April 24th, 2024, 3:55 am

Generate Automatic WeatherCode from IP address in use

Get help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 16164
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Generate Automatic WeatherCode from IP address in use

Post by balala »

Pul53dr1v3r wrote: October 4th, 2019, 7:28 pm Not, absolutely nothing besides the error.
Please check the https://www.iplocationtools.com/ URL in your browser. Does it open this URL?
User avatar
pul53dr1v3r
Posts: 442
Joined: July 30th, 2014, 10:30 am

Re: Generate Automatic WeatherCode from IP address in use

Post by pul53dr1v3r »

balala wrote: October 4th, 2019, 7:31 pm Please check the https://www.iplocationtools.com/ URL in your browser. Does it open this URL?
yes, all the fields are filled out, apart from the Mobile Brand related...
User avatar
balala
Rainmeter Sage
Posts: 16164
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Generate Automatic WeatherCode from IP address in use

Post by balala »

Pul53dr1v3r wrote: October 4th, 2019, 7:37 pm yes, all the fields are filled out, apart from the Mobile Brand related...
In this case I don't know. Maybe try restarting Rainmeter, then check the skin again, but I suppose this won't help.
User avatar
pul53dr1v3r
Posts: 442
Joined: July 30th, 2014, 10:30 am

Re: Generate Automatic WeatherCode from IP address in use

Post by pul53dr1v3r »

balala wrote: October 4th, 2019, 7:40 pm In this case I don't know. Maybe try restarting Rainmeter, then check the skin again, but I suppose this won't help.
no any change whatever i' did
User avatar
balala
Rainmeter Sage
Posts: 16164
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Generate Automatic WeatherCode from IP address in use

Post by balala »

Pul53dr1v3r wrote: October 4th, 2019, 7:55 pm no any change whatever i' did
:confused:
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Generate Automatic WeatherCode from IP address in use

Post by jsmorley »

All I get is a regular expression error in the log. The skin can't return anything, as it is all based on that first WebParser measure.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Generate Automatic WeatherCode from IP address in use

Post by jsmorley »

I'm quite certain that the site for me is returning something slightly different than for you, based on our locations.

It's not important, it's just why I sorta prefer the approach of the original poster, who is going after two sites that both return a standard json/xml format that won't care who or where you are. When possible, it's why I prefer a "feed" to "screen scraping".
User avatar
balala
Rainmeter Sage
Posts: 16164
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Generate Automatic WeatherCode from IP address in use

Post by balala »

jsmorley wrote: October 4th, 2019, 8:09 pm It's not important, it's just why I sorta prefer the approach of the original poster, who is going after two sites that both return a standard json/xml format that won't care who or where you are. When possible, it's why I prefer a "feed" to "screen scraping".
Yeah, probably a better approach.
Can you reply to my last question here: https://forum.rainmeter.net/viewtopic.php?f=5&t=33606#p166268, please?
User avatar
pul53dr1v3r
Posts: 442
Joined: July 30th, 2014, 10:30 am

Re: Generate Automatic WeatherCode from IP address in use

Post by pul53dr1v3r »

I found where's the problem.

RegExp=(?siU)<span class="flag-icon flag-icon-ro tooltips" data-placement="top" title="\[.*] .*"></span>(.*)</td>.*<div><label><strong>Coordinates of City</strong></label></div>.*<i class="fa fa-map-marker"></i> .*&deg;.*".*&nbsp;&nbsp;&nbsp;.*&deg;.*".*<br>\((.*), (.*)\).*<div><label><strong>Local Time</strong></label></div>.*\(UTC (.*)\).*<div><label><strong>Weather Station</strong></label></div>.*(.*) \((.*)\)

So if we set our country initials istead of your ro it should work.
User avatar
balala
Rainmeter Sage
Posts: 16164
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Generate Automatic WeatherCode from IP address in use

Post by balala »

Pul53dr1v3r wrote: October 4th, 2019, 8:27 pm So if we set our country initials istead of your ro it should work.
Yep, right! Sorry for my mistake. Now what about the modified code?

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[Variables]

[MeasureIPinfo]
Measure=WebParser
UpdateRate=3600
Url=https://www.iplocationtools.com/
RegExp=(?siU)<span class=".*" data-placement="top" title="\[.*] .*"></span>(.*)</td>.*<div><label><strong>Coordinates of City</strong></label></div>.*<i class="fa fa-map-marker"></i> .*&deg;.*".*&nbsp;&nbsp;&nbsp;.*&deg;.*".*<br>\((.*), (.*)\).*<div><label><strong>Local Time</strong></label></div>.*\(UTC (.*)\).*<div><label><strong>Weather Station</strong></label></div>.*(.*) \((.*)\)

[MeasureIPCountry]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=1
RegExpSubstitute=1
Substitute="	":"","\n":"","^\s*(.*)$":"\1","\\1":""
Group=Location

[MeasureIPCity]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=5
RegExpSubstitute=1
Substitute="	":"","\n":""
Group=Location

[MeasureIPLatitude]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=2
Group=Location

[MeasureIPLongitude]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=3
Group=Location

[MeasureIPWeatherCode]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=6
Group=Location

[MeasureIPTimeZone]
Measure=WebParser
Url=[MeasureIPinfo]
StringIndex=4
Group=Location
Substitute="+":""
Disabled=1

[MeterLocation]
Meter=STRING
MeasureName=MeasureIPCountry
MeasureName2=MeasureIPCity
MeasureName3=MeasureIPLatitude
MeasureName4=MeasureIPLongitude
MeasureName5=MeasureIPWeatherCode
MeasureName6=MeasureIPTimeZone
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
FontEffectColor=0,0,0
StringEffect=Shadow
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Country: %1#CRLF#City: %2#CRLF#Latitude: %3#CRLF#Longitude: %4#CRLF#Weather code: %5#CRLF#Time zone: %6