This is a project rename of the project application called Wunderground
Hi everyone,
Due to google weather api going down, i had to switch my website weather widget from google to an other one. I chose Wunderground because of it's great API.
With our module you'll be able to create a block which will query Wunderground for data about the city. You can administer the plugin by choosing the city, the country, the wind speed and temperature settings (ex: celsius or fahrenheit) and the cache duration.
Screenshots are available on the sandbox project : http://drupal.org/sandbox/alpixel/1781982 ( git.drupal.org:sandbox/alpixel/1781982.git )
git clone http://git.drupal.org/sandbox/alpixel/1781982.git wunderground_api
Have fun testing it and i'm up to answer any question you have.
Cheers
Comment | File | Size | Author |
---|---|---|---|
#20 | Selection_002.png | 152.13 KB | vladimir-m |
#16 | weather.json_.zip | 886 bytes | rickumali |
#17 | weather-corrected.json_.zip | 1.2 KB | rickumali |
Comments
Comment #1
sreynen CreditAttribution: sreynen commentedSorry, I should have been clearer in the other issue. While you've renamed the project, your module name in code is still the same as the other non-API wunderground module, which can cause big problems. If the current "wunderground" module ever gets a D7 release, and someone installs both on the same site, the site will have two functions both named wunderground_block_info(). This will cause a fatal error in PHP, crashing the whole site. So in addition to renaming the project, you should rename the module in code, e.g. change wunderground_block_info() to wunderground_api_block_info(), change wunderground.module to wunderground_api.modue, etc. Make sense?
Comment #2
alpixel CreditAttribution: alpixel commentedyeah, not your fault, i had to think about that.
Gonna do it right now
Comment #3
alpixel CreditAttribution: alpixel commenteddone, renamed the module to wunderground_api
Comment #4
Ciraxis CreditAttribution: Ciraxis commentedit is not the right way to add css in the template file.
Proper way is to add your css in your hook_block_view() with drupal_add_css() or you create a template_preprocess_TEMPLATENAME() and then add the css via drupal_add_css().
PAReview.sh just find that
is not right prefixed but in my eyes its okay ;-)
Comment #5
alpixel CreditAttribution: alpixel commentedBoth issues are solved.
Comment #6
cubeinspire CreditAttribution: cubeinspire commentedI cannot checkout using
git clone http://git.drupal.org/sandbox/alpixel/1781982.git wunderground_api
warning: remote HEAD refers to nonexistent ref, unable to checkout.
I read from http://drupal.org/node/1074584 that it could be caused by an unexisting master branch.
I would like to test the module... could you solve this ?
Comment #7
alpixel CreditAttribution: alpixel commentedThere is no master branch on drupal's modules.
Checkout the 7.x-1.x branch like that :
- cd wunderground_api
- git checkout 7.x-1.x
Comment #8
Ciraxis CreditAttribution: Ciraxis commentedwuups sorry my hint with the css was a better way than yours but there is a real drupal way ;-)
The block is a render element so you can just attache the css file. So the css file would be cached with its block and it would be considerably easier to interact with hook_page_alter().
you can find more information at http://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_r...
and a deeper look to drupal_process_attached()
unfortunately there is no example in the example_modules or i can't find it.
Comment #9
sreynen CreditAttribution: sreynen commentedAll the variables set in wunderground_api_settings_admin_form() need to be deleted with hook_uninstall(), which you should put in a new wunderground_api.install file.
Comment #10
alpixel CreditAttribution: alpixel commentedBoth #8 and #9 : Done :)
Comment #11
Ciraxis CreditAttribution: Ciraxis commentedi see that you attached taxonomy.js. Do you really need it? And the css file is still not attached as css file :p
attached like
Comment #12
alpixel CreditAttribution: alpixel commentedpfff... my bad... quick fix is a stupid fix.
Just changed it.
Comment #13
DmitriyMakeev CreditAttribution: DmitriyMakeev commentedHi, i had some manual review for your module.
1.
Fatal error: Call to undefined function _wunderground_get_countries() in Z:\home\card_maker\www\sites\all\modules\1781982-cdf639e\wunderground_api.admin.inc on line 84
You need to rename
wunderground_get_countries()
function towunderground_api_get_countries()
on the line 84 and 103 in wunderground_api.admin.inc.
2. You can place module settings on block configure page. See hook_block_configure().
3. Add
t()
for almost all#options
in wunderground_api.admin.inc. And in the functionwunderground_api_get_countries()
too.Use
t()
for the watchdog messages in WundergroundAPICall.php.4. In "wunderground_block.tpl.php" on the line 72 use
t()
for "km/h".You need to set measurement units from configure page in "wunderground_block.tpl.php" instead of fixed "°C" or "km/h".
5. And automated review said this
Comment #14
alpixel CreditAttribution: alpixel commentedHi,
Thank's for reviewing the module.
Fixed bug in #1, #3 and #5.
#2 is a choice of mine to use the admin page instead of the block config page. I've some ideas of developpement in the future with will have a use of this page.
#4 isn't also a mistake. I don't want to fix the value to what was defined in back office. If someone want to write "Celsius" instead of "°C" then he should be free to do so.
Comment #15
koppie CreditAttribution: koppie commentedLovely module! A few notes:
Also, please check the automated review at http://ventral.org/pareview/httpgitdrupalorgsandboxalpixel1781982git before you request another "human" review.
Comment #16
rickumali CreditAttribution: rickumali commentedHello,
I enjoyed trying out this module. This is my manual review, and it's more of a usability review than a code review.
1) I had issues with getting the code via Git. My output:
I was able to get past this by doing:
I wonder if there is still some Git manipulation on the remote that needs to be done.
2) Files with the Execute Bit
All your files come down from the repository with the execute bit set. Is this necessary? This is not something I've noticed with other modules.
3) English Measurements are Good
I like how the configuration screen has English as well as Metric measurements.
4) Configuration Doesn't Account for the States of the US
The location section only asks for City and Country. I'm from the United States, so I tried specifying Boston and United States. When I did that, the block didn't work. It produced lots of errors like this:
When I make the web service call (see next item), I observe that the JSON output is a list of all the US states with Boston as a city. There is no current_observation object in the JSON. (See attached JSON.)
When I changed the configuration to Paris (city) and France (country), the wunderground_block.tpl.php worked properly!
5) Use of Watchdog is Excellent
I like that your module uses Watchdog. That enabled me to see the exact web service calls that I made:
http://api.wunderground.com/api/APIKEY/forecast/lang:EN/q/US/Boston.json
http://api.wunderground.com/api/APIKEY/conditions/lang:EN/q/US/Boston.json
Please let me know if there is an issue on my side. If you can enable the configuration to accept US states, it would open up the module for a wider audience.
Good luck with the process!
Comment #16.0
rickumali CreditAttribution: rickumali commentedupdating the git
Comment #17
rickumali CreditAttribution: rickumali commentedFast follow-up: The Wunderground API allows for US states as part of the GET request like so:
http://api.wunderground.com/api/APIKEY/conditions/lang:EN/q/US/MA/Boston...
Note the "MA" before Boston.json. This output contains the attached JSON (with current_observations).
Comment #18
alpixel CreditAttribution: alpixel commentedHi koppie, everything you asked has been done.
rickumali, thank's for the huge feedback from your side. Anyway, i've no time right now to handle US support (and this module has been waiting for like 4 months to be published). I'll wait for the official release to add US support to it :).
Comment #19
heddn#18 - When this module is made usable in the USA, please consider making the tempurature & wind speed as configurable options. Right now they are hard coded in the tpl for Celsius and km/h. Or maybe this isn't related to usability in the USA and is a bug?!? I noticed in WundergroundAPICall.php you provide the means to use either Celsius/Fahrenheit or km/miles.
WundergroundAPICall.php
$request->status == 200
, etc. to give meaningful error messages for 4xx, 5xx?wunderground_api.admin.inc
Comment #20
vladimir-m CreditAttribution: vladimir-m commentedHello
Then I set up the block region and save I get a lot of notice:
See attached screenshot.
Comment #21
PA robot CreditAttribution: PA robot commentedClosing due to lack of activity. Feel free to reopen if you are still working on this application.
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #22
shortspoken CreditAttribution: shortspoken commentedHello. I get the same error messages as mentioned in #20.
Any fix or news on that?
Cheers, Moritz
Comment #23
pazza98 CreditAttribution: pazza98 commentedIs anyone still working on this? It would have been nice to make this one as a "fork?" of the previous version 6 Weather Underground module, even if that one wasn't using the official API. I'd be happy to help if I can.
Comment #24
pazza98 CreditAttribution: pazza98 commentedI'm looking at the code, don't know if I can achieve anything but I hope I can and I hope I'm not treading on any toes.
Do you have the Wunderground API key from Weather Underground? Thanks. Will.
Comment #25
pazza98 CreditAttribution: pazza98 commentedI'm just trying to get my host upgraded to the required version of PHP, so I can test and see what issues I get with the module.
Comment #26
pazza98 CreditAttribution: pazza98 commentedRegarding #20, it seems that for some reason the call isn't returning the expected "current_observation". I'm not yet sure how to capture the request or the resulting JSON file to check for either what is returned in terms or data or error.
Comment #27
sreynen CreditAttribution: sreynen commentedThis issue is an application for full project access for alpixel, and was closed when alpixel stopped responding. pazza98, it looks like you're using this issue as a general discussion thread for your own work on the module, which isn't really what this is for. The project has its own issue queue:
https://drupal.org/sandbox/alpixel/1781982
Please continue any discussion not related to alpixel's full project access there. If alpixel does not return, you might also consider following the abandoned project process: https://drupal.org/node/251466
Comment #28
pazza98 CreditAttribution: pazza98 commentedHi sreynen,
Thanks for letting me know. I wasn't sure what the process was, so appreciate the polite pointer and apologise for not reading all the documentation and therefore also for not following the processes properly.
Kind Regards,
Will.
Comment #28.0
pazza98 CreditAttribution: pazza98 commentedgit info