Tiny script to post Sunrise/Sunset Data for any place on earth to the fediverse
https://fulda.social/@herecomesthesun
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
![]() |
2 months ago | |
---|---|---|
locales | 3 months ago | |
Bot_HereComesTheSun.py | 2 months ago | |
LICENSE.md | 3 months ago | |
Makefile | 3 months ago | |
README.md | 3 months ago | |
babel.cfg | 3 months ago | |
diff.tmpl | 3 months ago | |
i18n.py | 3 months ago | |
registering_pytooter.py | 3 months ago | |
toot.tmpl | 3 months ago |
README.md
Here Comes The Sun
A tiny Fediverse bot posting sunruse, sunset, amount of daylight and the difference in daylight to the day before.
The bot in action: Here Comes The Sun Fulda
It is based on (basically an extended version of) the bot SunofBerlin from Henrik Schoenemann.
Extras
- Reworked helper script to register an app with the Mastodon instance
used. Check
registering_pytooter.py -h
- Commandline support for the bot too, the Latitude, Longitude and Location name as well as language to use for the toot can be set without code changes.
- Uses caching, to not run over the limit of the stormglasss.io API (only real interesting if one runs it more than once a day)
- Translatable, using gettext. Check Weblate if you want to help translate.
Requirements
- Python3 with some modules, on Debian you can run
apt install python3-babel python3-jinja2 python3-humanize python3-requests
for the basic packages. Alsopip3 install Mastodon.py
for the mastodon wrapper.
Usage
- Create a bot account on the instance you want to use. (Ensure the admins like bots!)
- Git clone the bots repository, cd into the new directory.
- Create an account on Stormglass, the bot uses that API to get data. Get the API key and put it into API_KEY.txt in the bots directory.
- Run
./registering_pytooter.py -u emailofthebot@example.com -i instance.url -p botpassword -c
(note that instance.url is just the domain of the instance, without https://) - Find the GPS coordinates for which you want to see the data. You can use https://openstreetmap.org - go find the place and double-click it. The URL will now have the latitude/longitude as the two last numbers.
- Now you can run the bot, supplying the right values for its
parameters. For example, to run it and show information for the
middle of Fulda in German, run
./Bot_HereComesTheSun.py -l 50.549672 -o 9.668899 -c Fulda -t de
- Now you can cron this line to run once a day, e.g. use
crontab -e
and put the following in (adjust the path), to have it run in the morning at 06:01:* 1 6 * * * $HOME/herecomesthesun/Bot_HereComesTheSun.py -l 50.549672 -o 9.668899 -c Fulda -t de