“Wisdom” Bot for Mastodon

I left the Birdsite about six months ago when the new owner started mucking about.

No regrets! Mastodon has been so much better! I decided to try my hand at creating an automated “robot” to post quotations alongside some of my photographs.

Wisdom in Space Posts Every Four Hours

Mastodon is much more civilized and well organized—including best practices for social media bots. There is even a server dedicated to bots called “botsin.space”–so I called my new bot “Wisdom in Space“.

There are many helpful websites to get started. Most use the mastodon interface package for Python. This is the first time I’ve written code in the python language, but fortunately the learning curve isn’t very steep. The biggest conceptual hurdle for me was understanding and using virtual environments on the shared server. Once I got those pesky details worked out I set up a cron job to post every four hours. The quotes are in a tab-delimited text file and the images are in a nearby directory. Note the development code below works locally on my laptop. The directory paths and other details are different on the server. I hope someone finds this useful!

#
#	wisdombot 0.2
#	quote of the day service for mastodon
#	copyright richard rathe 2023
#	(cc) attrib-noncomm-share-alike
#

import re

import glob

import random

from mastodon import Mastodon

quote_list = []

with open('wisdom.dat') as file:

	for line in file:

		line = line[:-1]  # remove newline

		quote_list.append(line)


qmax = str(len(quote_list))

image_list = glob.glob('images/*.jpg')

imax = str(len(image_list))

qrand = random.randrange(int(qmax))

line = quote_list[qrand]

line = line.replace('—'  , '--')	# fix entities
line = line.replace('"'   , '\"')
line = line.replace('é' , 'e')
line = line.replace('ø' , 'o')
line = line.replace('ö'   , 'o')
line = line.replace('&'    , '&')

data_list = line.split('\t\t')		# double tab delimited

irand = random.randrange(int(imax))	# pick image at random

img = image_list[irand]

match = re.search(r'^images/([a-z0-9-]+)', img, re.I)

if match:
	stem = match.group(1)
else:
	stem = ''

ikeyw = ''

for i in stem.split('-'):
	i = i[0].upper() + i[1:]	# capitalize
	ikeyw += " #" + i

ikeyw = ikeyw[1:]	# nuke leading space

keyw = ''

for i in data_list[2].split('/'):	# keywords are '/' delimited
	i = i.replace(' ', '')
	i = i.replace('-', '')
	keyw += " #" + i

keyw = keyw[1:]		# nuke leading space

quote = data_list[3]

name = data_list[0]				# author name

ntag = re.sub('[^0-9a-zA-Z]+', '', name)	# author hashtag
ntag = '#' + ntag

other = data_list[1]				# source info (if available)

if other == 'None':
	other = '';
else:
	other = ' (' + other + ')'

out = quote + '\n    -- ' + name + other + '\n\n'

out += '⬆ #Quotes ' + ntag + ' ' + keyw + '\n\n⬇ #Photography ' + ikeyw

if len(out) < 500:		# limited to 500 chars

	print('\n' + out + '\n')

	mastodon = Mastodon(
		access_token = 'token.secret',
		api_base_url = 'https://botsin.space/'
	)

	media = mastodon.media_post(img, description="photo by richard rathe")
 	mastodon.status_post(out, media_ids=[media])

Everglades Kayak Trip 2023

map source: nps.gov (click to enlarge)

This year we returned to the northern part of the park. The original plan had been a “grand tour” loop with two beach sites and two chickees. However, the forecast was calling for high winds on the last two days where we would be exposed out on the Gulf of Mexico. On the drive down I called and amended our permit to camp at Lopez River on the last night. [Photo Gallery]

Day 1 (Rabbit Key)

We left a day after the new moon (the beginning of the lunar Year of the Rabbit) so the tide was especially low. We had to motor through the mud with our legs to get out to where there was enough water to float. We would later have to fight an incoming tide going through Sandfly Pass.

Sandfly Island & Pass

We did a bit of walking around the old homestead and saw what was left of the old cistern and artesian well. Also saw our first dolphin fishing along the shore there.

Carl At The Well

Soon afterward my drive failed (while fighting the current of course!). Specifically one of the “flippers” delaminated and pulled away from the steel rod that supports it. Thus started a series of field repairs (outlined below) as we continued to limp along out to Rabbit Key.

Rabbit Key at Sunset

The best campsites have moved around over the years as hurricanes have remodeled the island. Our usual site in front of the sand spit (left point above) was taken so we explored a site further down near the high tide line. The only problem was the central tree was broken and stunted so we were hanging pretty low with ground cloths under our butts. The breeze blew all night so there were no bugs.

Rabbit Key Campsite (click to enlarge)

The next day when the tide was out we took a walk around our little isle. Because of the recent new moon the Horseshoe Crabs (Limulus polyphemus) were about.

Ring of Horseshoe Crab Shells
One Tough Mangrove!

Field Repairs

I used duct tape for my first attempt to repair my drive. This lasted about an hour. The adhesive would not stand up to submersion in salt water. Next I tried a mummy wrap with paracord. This worked better, but the bottom knot kept falling off. On the second day I cut out strips of plastic water bottle and attached these with rope using scaffold knots. [Click for Example] This did the trick and I was able to complete the trip — peddling all the way!

Selected Video Clips

Day 2 (Crooked Creek Chickee)

We waited for the tide to turn and start rising before we left Rabbit Key. This lead to an easy passage through Rabbit Key Pass and up the Lopez River to Crooked Creek Chickee. We had a nice swim, started cooking dinner, and hung our hammocks before the wind died and it got buggy.

Crooked Creek Chickee

Day 3 (Sweetwater Chickee)

The next day was mostly spent crossing four large bays. We had a bit of a cross/tailwind but no real problems. When we got to the chickee however we had a bit of unwelcome attention from an eight foot alligator that was acting like it expected to be fed. Normally gators will be curious but generally do not hang around and get progressively closer!

Sweetwater Chickee with Gator

The evening was nice with a bit of breeze and only a few bugs. We had a comfortable night except for the heavy breathing! I woke upseveral times in the night and could hear wet, sonorous breathing a few feet away from the chickee. It was not a dolphin. Every ten minutes or so there would be 2-3 breaths in exactly the same place! I thought “Gee, is that gator stalking us?!” I looked several times with a flashlight and never saw a thing. If a gator was there on the surface I should have seen its eyes reflecting orange. Very strange! In the morning the breathing was occuring and the mystery was solved. A small manatee had come to sleep next to us overnight! Very cool!!

Well-Pitched Hammocks
Sweetwater Chickee

Day 4 (Lopez River)

Apparently the Park Service has a new rule that you can’t stay on the same chickee twice in one trip, so we camped at the Lopez River ground site on our last night. I had stopped there for lunch before but never stayed overnight. There was a party already on the primary site, so we took the secondary next to the large ruin of the cistern. Both sites have nice deep shell mound approaches, and we sat down by the water while we ate our dinner and finished our box of wine. There was a breeze and it was about ten degrees cooler so bugs were few.

Lopez River Campsite Shell Mound Landing

The site itself is small and set within mangroves, with a compacted mud surface and a picnic table. The hammocks were perfect in this setting!

Hanging in the Mangrove

Day 5 (Return to Civilization)

We got up before dawn the next day to beat the incoming tide. We circled around Chokoloskee Island rather than take the narrow canal behind the causeway. As predicted the wind rose and was probably every bit of 12-15 mph with gusts. We were glad not to be out on the Gulf!

Chokoloskee Island

Even after all these years this was the first time I’d gone this way, giving us a chance to see the Smallwood Store from the water. This is where, in 1910 the alleged murderer Edgar J. Watson (see “The Watson Place” campsite within the Park) met his end at the hands of a local posse who had gathered to arrest him. The excellent historical novel “Killing Mister Watson” is based on these events.

Smallwood Store

We peddled across the lagoon and back to the ranger station without difficulty. And thus ended an eventful but enjoyable trip!

Home Again!

More Photos…

BWCA Canoe Trip 2022

This was a return to a familiar area with lots of options. Gaskin and Winchell are particularly nice lakes accessible from the Gunflint Trail. This area has also been burned more than once in recent times. [Full Gallery] [2019 Trip]

Click to Enlarge (source:google)
Our Group Overlooking Grand Marais

After driving most of the day we pulled up to the Bunkhouse at Rockwood Lodge on Poplar Lake. In addition to an economical place to stay we left our vehicle there while we were in the backcountry.

Short Video with Loon Calls, Snake Hunting, and Slo-Mo Waterfall!

We got a reasonably early start the next day, entering via the portage to skinny little Lizz Lake. We proceeded to portage thru Caribou and Horseshoe Lakes before snagging the primo campsite on Gaskin (located on an island with 180º views down the lake).

Gaskin Campsite View
Gaskin Campsite Landing
Gaskin Kitchen Area (Ross Cooking Veggie Burgers)

We then proceeded to take day trips all around the area lakes.

Lake Henson (Click to Enlarge)
Snake vs Toad
Large Spider in Its “Tent”
Rückenfigur on Lake Winchell
Waterfall on Winchell (Click to Enlarge)
Lake Gaskin at the End of the Day

Each evening a group of large flat rocks provided a commodious spot for our happy hour before we sat down to delicious vegetarian meals prepared by Ross. (Did I mention our food pack weighed over sixty pounds?!)

Happy Hour

Our sojourn had an unfortunate coda however. Terese slipped on rocks and twisted her ankle on the last afternoon. After resting it for twelve hours she bravely walked the four portages back to civilization using the spare paddle as a crutch. Xrays later revealed a non-displaced fracture!

Broken Ankle

We had excellent weather throughout our stay, but it got windy on the day we left and thunderstorms rolled in that night, perfect timing!

Environmental Notes: Many of the small Fir and Spruce trees on our site were either dead or dying from disease. The White Pines in the area looked very healthy. The Burned Areas appeared to be recovering slowly. The Loons remained active and we saw at least one Bald Eagle. The “Tent Spider” was something new. We saw two of them on different lakes, so probably not an anomaly.