Hey all!
07/20: I'm looking for a few weather widget authors that would be willing to update their objects using the component and provide feedback. I'll be providing help and guidance on the use of the component if needed. Widgets that make complete use of weather.com data are preferred (current conditions + forecast with as much info presented to the user as possible).
As of today, the Weather.com provider is mostly complete and should be usable as a replacement for the old script. Weather Underground still needs a bit more work, especially on the parts that aren't available with weather.com (cameras, alerts).
If you're interested, you can PM me or send me an email. I'm also available on IRC (irc.stardock.com) under the nick "Julien".
It seems there wasn't enough Weather threads, so I decided to have my own .
For the past few days, I've been working on a weather script component. It takes the form of an independent .wsc script file that you reference in your widget script (setting up license info and registering callbacks), calling a few methods and getting weather/location/alert data in the form of a script object with several properties.
Using this new script means rewriting a lot of the existing weather objects script, only keeping the UI handling in the widget scripts and delegating all the weather stuff to the component. It's not a short term solution for authors that need to update their widgets in the next few days, but I think it's the easier and more maintainable solution in the long run, as it would finally do away with the duplicated and slightly tweaked weather code in all weather widgets.
Note: This thread is to discuss the weather script component only. If you want to ask questions about the original weather script, existing weather widgets updates or just complain about TWC.com/Stardock/etc..., you can do so here, here and here.
The plan is to support several widget providers in the same script, in a mostly transparent way. Right now, I'm planning to have the following providers (in this order):
Using the script
I've tried to make the API as simple as possible, hiding most of the complexity in the script component. In the following, the Weather Script Component will be called WSC.
To start using the script, you need to create a new instance of the WSC and register callbacks. Those are functions that will be called when new data is available or if an error happened somewhere.
You can then get a list of supported providers to let the user choose the one he wants, of simply hardcode the provider you want. If the provider requires a license key, you can also set it at this time, as well as the unit system to use.
Once your weather object is setup, you can start making queries. The WSC uses a single query object for all requests, so that we don't need to implement a separate method for each type of request.
To get a new query object, you can either create a new instance of a WeatherLocation object, or use the helper method I added to the WSC. You can then set properties on the query object, or use the CustomQueryString property (useful when you want to do a query using a search string entered by the user).
If an error happens after the request has been sent, you will get an error code and message through the OnError callback (for exemple, if there is a parsing error or if the response is empty, etc.)
If all goes well, we should get a response and our OnWeather callback will be called
Contributing
A first test version is now available. Inside the Build folder, you will find 3 files:
The test object is using the minified version and is also a bit pre-processed, so if you want to check the script, you probably want to use the original version.
If you plan to use the script and there is some functionality that seems to be missing, post here or PM me and we'll see if it can be added.
Limitations
Download
Warning: The API is now relatively stable, but it might still change a little bit before 1.0, so know that you might have to slightly adjust your widget script when you get a new version of the component.
The latest version can always be downloaded from here.
Changes
Thanks for the help
I was wondering when you would show up. Thanks.
ZubaZ starts rereading so he can at least fake understanding.
yes, thanks
fyi
It's not a short term solution for authors that need to update their widgets in the next few days,
authors don't need to update within the next few days - thay can take as long they want/need
the next few days is to go in a download a copy of your widget if you don't already have one
even after that, you can still contact and get a copy of what you need
Was looking for this. Thanks Julien.
Not that I understood a single line of that but this looks like the way to go. At least is is a step forward.
I am wondering though... How will provider selection and registration (
if any) be handled if the widget creator chooses not to put TWC logo and links on their work?
To use that service would require a completely different widget that meets TWC requirements,would it not?
I'm afraid this is going to be out of my hands. The component will populate a "promo" links dictionnary, so if there is something there, you know you have to show them in some way. But any specific UI requirements are left to the widget maker, the only limits I'll be able to enforce in the component are update limits per hour (and even that you can bypass by creating a new instance of the component on the fly each time you want to do a request).
As I just told sViz in message, I'm going to make it as easy as possible to respect the license for each provider, but in the end it's the widget maker responsibility to abide by the license. After all, if you do no want to respect the license, you can always get the xml feed directly and do whatever you want with the data...
BTW, either the widget maker or the end user will have to provider their id/key pair to make the component work with the TWC provider, so hopefully they will have a look at the license first.
A widget with drawers for logo/links that you can hide will work too if you want to allow users to switch between providers. Although IIRC most of them require you to show credit information in some form (logo or text with a link to their website).
I can't even fake it
Littleboy
You and sViz are going to save this little part of the world, so many thanks.
"It seems there wasn't enough Weather threads, so I decided to have my own"
It's the weather. Everybody talks about it every day.
Hint...when you read....lip movements are a good indicator you aren't following it...
Weather Underground should now be complete enough to use in a proper weather widget.
Download here and let me know if something isn't working properly or if you are missing some key functionality.
I must be stoopid, I can't download it.
Got it via right click "enregistrer la cible du lien sous..." "Save the link's cible under..." (can't translate this correctly )
But when launch the dxpack i get a DX error: "This file doesn't appear to be a valid DesktopX package"
Anyhow thanks for the work you're doing Julien
La prochaine fois que tu reviens en France et que tu passe par Paris faudra que je t'offre un verre.
That's because it's a link to a page in the source tracker, not a direct link to the file (BTW I'll make a proper package once it's stabilized a bit more).
You need to first click on the link and then on the next page, click on View raw file. Note that the package contains fully processed files, so they aren't easy to look at or study.
Proper links to all files
You have to import the zip into DX, or you can change the extention to .dxpack.
Julien, is it possible to allow simple syntax like "London" or "New York" and then return the list of matches? It only retreives locations via city/state or city/country.
After looking at what happens when you put a city only, it accepts it just fine and does the request, but sometimes the xml we receive is completely different from what is written in the specs.
It's basically just a list of (city, state) pairs with links to the webpage for that city. It doesn't have the info necessary for a weather request and you need to do another request for locations using one of the entry on the list to get proper airport or weather station codes.
I'm going to add some code to parse that list correctly and give you the list of city names.
Update: new build should show the list of cities correctly.
Monday morning update: weather.com is mostly complete, some work on dates is still needed (mainly to make sure they're all using the same time zone in all providers).
If you want to start looking into it to update your widgets, now is the time . Let me know if you have any questions or feedback on the component API.
There are many great features available to you once you register, including:
Sign in or Create Account