💾 Archived View for gemini.cyberbot.space › gemlog › 2021-10-21-offlinegeminiscript.gmi captured on 2022-01-08 at 13:39:15. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-11-30)

-=-=-=-=-=-=-

My Offline Gemini Reading Script

2021-10-21

I have been working on a very simple bash script that I use to read gemini posts offline on my PDA and ereader. DISCLAIMER: I am not a programmer and simple scripts are pretty much the extent of my abilities. But what I love about the simplicity of gemini is that someone like me can throw together a script to do something I want thanks to that simplicity.

Offline Gemini Digest Script

In order to utilize the script I'm assuming a linux system and there are a few dependencies:

UPDATE: If you don't want to compile gmni and already have Python installed (you probably do) you can also replace gmni with gcat. It's a small python program that does not need to be compiled. Just grab the program from the gcat repo and make sure it is in your $PATH and replace the gmni commands in the script with gcat.

gcat

gmni is available in the AUR if you're on an Arch-based distro or on other distros it is easy to compile as it only has a couple dependencies.

gmni

calibre is a very powerful ebook program that has been around for a long time and should be in the repos of just about any linux distro. Whatever version is available in your system's repos should be sufficient. We only need the ebook-convert tool that is part of calibre.

calibre

At the top of the script are the date variables. You can change these or add more date variables to adjust the time period of posts you want to grab. Just below that are the ANTENNA, COMITIUM and NEWS variables. You can change the COMITIUM URL to your own are a different one that you like. You can change the ANTENNA URL to your own personal filter URL if you like (great feature, thanks ew0k!). I'm pointing the NEWS URL to sloum's excellent geminews proxy of NPR's news site. You should be able to change the URL to either of the other two geminews proxies as well. It would need a little tweaking but it should also be pretty easy to adapt to use the proxies on metalune's simplynews.

With Antenna I have a simple filter to exclude mp4 and mp3 files as I've run into issues when someone posts an audio or video file which obviously doesn't translate well to an ebook X-). There will likely be more instances of this that will prompt me to add to that filter list. I've also added a little divider between each post to make it easier on the PDA to clearly see where one post ends and the next begins. The command to parse the list of links that are being compiled into the digest is a little different for each source due to the different formatting of the links between comitium, antenna and simplynews. So keep that in mind if you want to replace the URLs with something formatted differently.

My goal was to have a digest of all the posts for the day in one document making it easy to read the posts or the news in one go on the two offline devices I use. For now I have it generating the digest for the current day and the previous day. This results in a .pdb version that is for syncing to my Palm PDA and a .epub version for my ereader. Just comment out the ebook-convert line for the pdb if you don't need it and you can just change the .epub extension in the other ebook-convert line to whatever format you want that calibre is capable of converting to (basically any ebook format you can think of).

I plan to keep the script updated here if I make any changes. Please remember my amateur skill level when looking at this script :). I'm sure there are better ways of doing this and probably some silly mistakes. If you want to (kindly) make any suggestions that would be fine with me. If you just want to tell me it's a bad script, I know, so you can keep that to yourself ;). Hopefully somebody finds this useful.

back to gemlog index