Developer Diary, Fred Korematsu Day
Today, California and other states celebrate Fred Korematsu Day of Civil Liberties and the Constitution, honoring the Japanese-American civil rights activist whose name you may recognize from Korematsu v US, the Supreme Court case attempting to fight the internment of Japanese-Americans during World War II.
Like Martin Luther King earlier in the month, I canât exactly top Korematsu, so letâs move on to software.
Mastodon Tool Trunk
As mentioned last week, I decided that I can improve my workflow for scheduling toots on Mastodonâand, yes, still cross-posting to Twitter, for however long that bridge remainsâby writing the Friday round-up posts first, then parsing the formulaic post for the information to schedule. I also wanted to find my toots so far that day, to fill in the URLs for the final, published version of the post.
I took care of the latter, first, as you can probably guess. Shell script latest.sh
looks at the configured userâs statuses; eliminates anything not posted on that day; gets the URL, creation time, and content of them; and opens a text file listing all that.
Of particular note for people who donât necessarily care about the Mastodon API, the script opens that text file in the systemâs default text editor, in a couple of lines of code to look up the MIME type. But it also makes liberal use of jq
, to query the configuration and resulting JSON objects.
Meanwhile, I havenât yet finished work on schedule.rb
, a Ruby program to schedule the toots, but it looks promising, so far. At this point, it can schedule a toot, but doesnât yet handle attached media, so I couldnât use it for this week.
I should note that I started working on scheduling by retrieving an OAuth access token, based on a client ID/secret pair. The code seems to work, but doesnât return a token that the rest of the API will accept. I assume this happens because I created the application for developmentâthe ârealâ access token shows up on my configuration page, so I used it to replace the retrieved tokenâbut will want to research this later, to make sure that I havenât misunderstood the process. I wasted more time trying to debug that problem than I care to admit.
Next
I expect to finish the Mastodon Tool Trunkâs scheduler before the time comes to schedule the following weekâs toots. To do that, Iâll need to download specified media, convert it to an acceptable formatâIâve seen WebP and AVIF images showing up, increasingly, which disrupts my manual workflowâprobably resize it, upload it to get an ID, and then hand that ID to the toot as I schedule it. Those mostly sound like tasks that I used to complete, fifteen years ago or so, with the Ruby library that wraps ImageMagick, so I donât expect that to pose too much difficulty, assuming that the software already understands the modern formats that Mastodon doesnât yet accept.
Time permitting, I may also create plug-ins to manage the metadata that I add to posts, such as content warnings, the header image, and so forth. While I expect to not use that information in the blog posts, at first, and only use them for parsing, it does give me the option of showing a content warning banner and embedding or linking to those rare images released under a compatible license.
Once I have the scheduler code settled, and figure out the access token issue above, Iâll try to put together a tech-tip post.
Also, I believe that I actually enjoy working with the Mastodon API, so maybe Iâll try my hand at an alternate front-end, too, eventually. For Twitter, I had a nice little setup on Tweetdeck, where I had extra columns for my own activityâto spot-check postsâand for lists of people whose posts I wanted to prioritize higher than the majority of people who I follow. Iâd love something similar with Mastodon, and I donât believe that it would take much more work to do that than it would to create a more conventional client.
Credits: The header image is Baggage of Japanese-Americans evacuated from certain West coast areas under United States Army war emergency order by an unknown photographer, in the public domain as the work of an employee o the United States government.
By commenting, you agree to follow the blog's Code of Conduct and that your comment is released under the same license as the rest of the blog.
Tags: programming project devjournal