Shinmera / multiposter

Small application to post to multiple services simultaneously

Home Page:https://shinmera.github.io/multiposter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Scheduled posts

bahmanm opened this issue · comments

One thing that I find can greatly up the usefulness of Multiposter is the idea of scheduled posts.

Use-case

One typical usecase for me is like this:

I work at weird hours of the day/night. More often than not when I've got something to share, it happens to be during those hours when nobody's logged in to their machines (or using their phones.) So I hold back on posting it b/c I know my precious piece of wisdom (:joy:) will be lost in people's feeds in the morning when they check their accounts.

So I've got to postpone sharing to another time of day. And frequently I forget that I wanted to share this or that.

It'd be great if I could tell Multiposter to share a given post at a certain timestamp or after a certain duration.

Thoughts on implementation

I've got a couple of low-tech solutions on my mind. However, as you will notice, they will introduce some non-Lisp bits to the project.

a) 1 Cron job per post

In this approach when i call (schedule post timestamp), Multiposter creates a cron job which would launch Multiposter at timestamp and send out post. This assumes command line options are enough to send out a post.

b) 1 Cron job for all

In this approach a cron job launchs Multiposter every X mins and asks it to send any relevant scheduled posts. This approach doesn't require complex command line options but assumes there's a database (eg a JSON file) of posts to be sent out.
In this approach

c) systemd unit

Similar to (b), this assumes a database of posts of some sort. The advantage over (b) is that the same unit can be used by multiple users. It could also be listening to "dbus" events and updating the database on the fly.


What do you think?

I was thinking of either B or a variant of C, although not using dbus but rather some simple tcp protocol. B is the most attractive at the moment, since we already have a configuration file, so we can just add an entry for scheduled posts and a command to check if there's any past their due date. The user can then set up a cron or systemd timer to run it every minute or whatever, so it would be the easiest to implement.

Makes sense 👍

Now, I just got to thinking, that there should be a way to "cancel" a scheduled post.

That can be easy w/ (a): generate a UUID for each scheduled post and comment the relevant cron entry w/ that UUID. To cancel all you'd need to do is to find the comment in crontab and delete the line.

Is this easily doable w/ (b)/(c)?

don't see why not.

Okey, I've pushed a thing that should allow scheduled posting. I haven't actually tested any of it yet, though and won't tonight, either.

Fastest gun on github 🔫 ⚡

I'll try to test it out either today (PST) or tomorrow and let you know.

Sure, thanks

Can you please take a look at #6?

I read every email I ever get. You don't need to ping me extra.