accuweather

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2020 License: GPL-3.0 Imports: 3 Imported by: 1

README

I simple program to get the weather information from a locale using accuweather then to report it to the command line. It is suitable for use in conky. I have a function that retrieves the associated URL from accuwether for the current weather conditions then reports them to the screen. I am releasing this GPLv3 for whoever wants to modify it or use it.

It is pretty easy to use just type weatherReport --help to see the options it currently defaults to my home town...but you can set it anywhere using the syntax for city location from www.accuweather.com. This is utterly dependent on the RSS feed from accuweather which I hope sticks around. I was annoyed that I could not find an easy way to get a weather section to my conky. This is my answer to it.

Functionally run the program like thus.... Usage of ./weatherreport: -cityId string City code. (default "NAM|US|CO|LOVELAND") -forcast int This is how many days from now to obtain a forcast for. -outputType string This is the type of output, can be text, icon, or temp. (default "text") -tempUnit string This can either be imperial or metric. (default "imperial") -version This prints the current version of the software

My example does not have any city code included but to add it just run the command with the following.

weatherReport --cityId="NAM|US|NY"

Will work for New York city. If you want to change to metric degrees (Celsius) then do the following....

weatherReport --cityId="NAM|US|NY" --tempUnit=metric

And finally to retrieve the icon from the rss feed you should do the following....

weatherReport --cityId="NAM|US|NY" --tempUnit=metric --outputType=icon

The program can also produce a forcast for the current day, or for the following day. In order to get a forcast for the current day set the forcast variable to 1 to get the current conditions set it to 0 and for the next day set the variable to 2. If the forcast is set to anything other than 0 then using the "temp" option will still print the full text output.

Note that this software is licensed as GPL 3 but Accuweather only permits the use of their rss feed for "personal use" that means that this cannot be used for commercial projects. That is part of the reason I licensed mine as GPL 3. If you modify this code or use it at all you must license it GPL 3...this effectively rules out non-personal use because most corporations will not want this restriction on their software. In any case respect Accuweather's requirements I am using this for personal purpose which is mostly just to display weather info in my conky every 5 seconds.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IconCurrent

func IconCurrent(cityID string) (icon string)

IconCurrent ... The icon representing the current weather conditions

func IconForForcast

func IconForForcast(cityID string, forcast int) (icon string)

IconForForcast ... This function exports a url for an icon for forcast

func TempCurrent

func TempCurrent(tempUnit string, cityId string) (temp string)

TempCurrent ... This is the temp from the current weather condititions

func TextCurrent

func TextCurrent(tempUnit string, cityID string) (output string)

TextCurrent ... This reports

func TextForForcast

func TextForForcast(tempUnit string, cityID string, forcast int) (output string)

TextForForcast ... This function exports a forcast only with no symbol

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL