HTTPS SSH

Weather Forecast

This application downloads and displays weather forecasts from the yr.no service.

It is available to install from the F-Droid catalogue: Current package version

A screenshot of the application

Adding, removing and selecting locations

The application is not configured to use any default locations, but a list of preset locations are supplied. Select the text field at the bottom of the screen, start entering a place name, and suggestions for the location will be presented. You can optionally select one of the suggestions. Press the Add button to add the location to the list. Since the list of known locations is limited, your preferred location may not be available; see below for a workaround for this problem.

To remove a location from the list, press and hold the relevant item in the list until the Remove and Cancel buttons appear below the list. Press Remove to remove the item or Cancel to keep it.

To view a forecast for a location, tap the relevant item. If a connection to the yr.no server can be established, the location list will be hidden and the forecast will be shown. Otherwise, a "No connection" message will be displayed.

Adding custom locations

The app contains a list of known locations which I obtained from the yr.no service, but yr.no itself knows about many more places than these. If your preferred location is not recognised by the application but can be found at yr.no then the following workaround can be used to add it to your list of locations.

The app stores its locations in a file in the external storage of your device. If you use a file browser on your phone, you can find a file called locations.txt in the Download/WeatherForecast directory. For example, it might be found in the following location:

SD Card Download WeatherForecast locations.txt

The corresponding path is /sdcard/Download/WeatherForecast/locations.txt if you access it via a shell.

The file contains a list of locations which are taken from parts of the URLs you can visit at yr.no. For example, the forecast for Cairo can be found at this URL:

https://www.yr.no/place/Egypt/Cairo/Cairo/

The locations.txt file contains a location on each line. The part of the above URL that should be included on a line in the locations.txt file is this:

Egypt/Cairo/Cairo

Each line of the file contains an entry like this, with names of countries, regions and cities separated by slashes. Some locations are specified using more than three parts, particularly those in Norway.

Update the file to include the custom locations you want and restart the Weather Forecast application. The new locations should now be available.

Building the application

The application is written in the Serpentine language which requires the DUCK software to be installed or on the PYTHONPATH. Additionally, you will need to have created a key and signing certificate in order to create an installable package unless you are using a separate signing process.

The current version of this application (1.0.6) has been tested to build with DUCK version 1.0.3.

The build.py script supplied with the application can then be run in the following way, where <key.pem> and <cert.pem> are the locations of your key and certificate files:

```\ ./build.py <key.pem> <cert.pem> WeatherForecast.apk

You can then install the package on your Android device in the usual way.

Alternatively, if you are using a separate signing process, you can build the
package without signing it in the following way:

```\
./build.py WeatherForecast.apk

Updating version numbers

When making a new release, the version number of the application needs to be updated. This value is stored in two places: in the previous section of this document and in the build.py file. The value used in the build file will be stored in the application's manifest. It will also be used by the F-Droid build process to ensure that the package version reflects the stated current version.

If the application is updated to require features of a later version of DUCK then the previous section should be updated to specify the version number of DUCK that is required. The metadata for this application in the F-Droid Data repository should also be updated to ensure that the correct version of DUCK is used to build the application.

About the yr.no service and data

The weather forecasts are obtained from the service at yr.no and the application tries to follow the terms, conditions and guidelines for use of that service:

http://om.yr.no/verdata/vilkar/

More information about the data obtained from the service can be found at the following locations:

http://om.yr.no/verdata/free-weather-data/ http://om.yr.no/verdata/xml/ http://om.yr.no/verdata/xml/spesifikasjon/

The place names included with the application were obtained from the following locations:

http://fil.nrk.no/yr/viktigestader/noreg.txt http://fil.nrk.no/yr/viktigestader/verda.txt

This information is presumably provided under the terms of the Creative Commons Attribution 4.0 International (CC BY 4.0) license, as used by the geonames.org service for the data the noreg.txt and verda.txt files are based on.

The symbols supplied were obtained from the following repository and are licensed under the MIT license:

https://github.com/YR/weather-symbols/ https://github.com/YR/weather-symbols/blob/master/LICENSE

License

The source code is licensed under the GNU General Public License version 3 or later. See the COPYING file for more information about this license. A short version of the license is given below:

Copyright (C) 2017 David Boddie david@boddie.org.uk

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.