It is currently March 28th, 2024, 9:30 pm

Creating Script to Determine Weather Code from IP?

Get help with creating, editing & fixing problems with skins
jptiger
Posts: 3
Joined: August 9th, 2017, 5:09 pm

Creating Script to Determine Weather Code from IP?

Post by jptiger »

Hi there, I've been doing some basic coding lessons using CodeAcademy and freeCodeCamp, and I've been looking for a simple project to get my hands dirty. One occurred to me while traveling: modifying Rainmeter skins that use static Yahoo Weather or Weather.com codes so that they instead look up the correct code based on your computer's current IP address. I travel a good deal with my laptop, and it would be great not to have to manually edit the .ini of my weather skin each time I go somewhere new.

So, my questions, knowing very little about the scripting behind skins:

1) Is this possible to do just by editing a skin (somehow declaring a variable and then scripting something within the skin to set the variable to the correct code)?
2) If yes, has it already been done?
3) If not possible, would it be possible to do by using some external service, and if that doesn't yet exist, what would be needed?

If it hasn't been done before, what would be the way to do it? I'm very new to this sort of thing but I don't mind putting in the work to learn.

Thank you!
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Creating Script to Determine Weather Code from IP?

Post by smurfier »

Just want to point out that most of the time when you look up my location based on IP it shows that I'm in Chicago. Actually, I live in Minnesota.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
jptiger
Posts: 3
Joined: August 9th, 2017, 5:09 pm

Re: Creating Script to Determine Weather Code from IP?

Post by jptiger »

smurfier wrote:Just want to point out that most of the time when you look up my location based on IP it shows that I'm in Chicago. Actually, I live in Minnesota.
Fair point - this isn't for everyone. My grandparents out in Eastern WA have satellite internet and their IP shows them as being in Kansas - geographical center of the US, which is as precise as they can get with that IP. That said, I'm not planning on rolling this out to any skins currently online - just offering the raw code I figure out in a place like this forum for people to use at their own risk/leisure.

If you want to see if it works for you, this is a decent site to check: https://ipcim.com/en/?p=where
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Creating Script to Determine Weather Code from IP?

Post by balala »

I also would be very interested to get the weather code, based on the current IP address. I actually had a such try a while ago, but finally couldn't get my code to properly work. The basic idea was to use a site which reads the current IP address and returns, between other information, the weather code, too. I found a such URL (http://www.iplocationtools.com/), but I couldn't get the returned weather code, using the WebParser plugin. Probably the site uses some Java scripts? I'm not sure, but finally I renounced to work on that project. But if anyone could find a good solution, I also still would be interested into a such idea.