multiposter
1.0.0A small application to post to multiple services at once.
About Multiposter
This is a protocol and small application to allow posting content to multiple providers at once.
How To
Load the providers you want:
(ql:quickload '(multiposter-twitter multiposter-mastodon multiposter-tumblr multiposter-git))
And set them up:
(multiposter:setup)
This will prompt you for a bunch of information for each client. By default it will create a client for each type that you loaded.
It's necessary to note that one client (potentially at random) will be picked as the "primary" client. This means that a post on every other client will contain a link to the post of the primary client. If you would like to set another client to be the primary, you can pass a different list:
(multiposter:setup :clients '(multiposter-tumblr:client multiposter-twitter:client ..))
The first one in the list will be picked as the primary. If you do not want any primary at all, you can set it to NIL explicitly.
(setf (multiposter:primary multiposter:*client*) NIL)
When you set the client up, it will automatically persist all the necessary login information to a configuration file at *config-path*
. In future sessions, you can simply call restore
to get the settings back.
To actually post to the configured services, simply call one of the related functions, text
link
image
video
:
(multiposter:image #p"~/meat.jpg" :description "Some meat." :tags '("meat"))
And that's pretty much it. Note that for services that do not support tags as metadata, or enforce limits on the textual content, Multiposter will attempt to be as smart as possible and shorten or convert things in a sensible manner. It is for this reason too that using a primary client that does not restrict things is a good idea.
Creating New Clients
If there's an additional service you would like to add support for, you can make use of Multiposter's posting protocol. The first step is to create a subclass of client
.
(defclass client (multiposter:client) ())
Next you will need a method on make-load-form
. This is used to persist the client's settings.
(defmethod make-load-form ((client client) &optional env)
(declare (ignore env))
`(make-instance 'client ...))
Another important part of the protocol is the login
function, which takes care of the authentication during the initial setup
. The function accepts arbitrary keywords, which you should use to allow the user to potentially provide default values. For anything that is not specified, use prompt
to ask the user interactively.
(defmethod multiposter:login ((client client) &key some-prop)
(let ((some-prop (or some-prop (multiposter:prompt "Please enter some prop"))))
(setf (some-prop client) some-prop)
...))
Finally you'll need methods on post-text
, post-link
, post-image
, and post-video
that perform the actual posting. You should take care to post as much of the provided information as possible and to only cut content if necessary.
System Information
Definition Index
-
MULTIPOSTER
- ORG.SHIRAKUMO.MULTIPOSTER
No documentation provided.-
EXTERNAL SPECIAL-VARIABLE *CLIENT*
-
EXTERNAL SPECIAL-VARIABLE *CONFIG-PATH*
This variable holds the default path for the configuration file. If XDG_CONFIG_HOME is set, it is: XDG_CONFIG_HOME/multiposter/client.lisp If the system is Windows, it is: ~/AppData/Local/multiposter/client.lisp Otherwise, it is: ~/.config/multiposter/client.lisp
-
EXTERNAL CLASS CLIENT
Superclass for all clients that can post using this protocol. Clients must implement methods for the following functions: LOGIN POST-TEXT POST-LINK POST-IMAGE POST-VIDEO See CLIENT-TYPES See LOGIN See POST See POST-TEXT See POST-LINK See POST-IMAGE See POST-VIDEO
-
EXTERNAL CLASS MULTIPOSTER
-
EXTERNAL FUNCTION CLIENT-TYPES
-
EXTERNAL FUNCTION EXTRACT-LINKS
- TEXT
Extracts all the links from the text. This returns a list of the following structure: PARTS ::= PART* PART ::= string | LINK LINK ::= (:link string) This is useful for systems where links are transformed independent of the rest of the text. Only HTTP/S links are recognised, but the protocol can be absent from a link.
-
EXTERNAL FUNCTION IMAGE
- PATH
- &KEY
- (CLIENT *CLIENT*)
- DESCRIPTION
- TAGS
- LINK
Shorthand to post a new image. See POST-IMAGE See *CLIENT*
-
EXTERNAL FUNCTION LIMIT-TEXT-WITH-LINKS
- TEXT
- LIMIT
- LINK-LENGTH
- &KEY
- (CUTOFF 20)
Truncate the length of a text intelligently. This is useful for services where links are shortened and thus do not constitute the full length to the text's length. The returned string should not contain any truncated links. If a truncation must happen, it will cut before the last character or newline if this character is no farther than CUTOFF many characters from the necessary end of the string. This heuristic is not perfect, especially in a multilingual context, but it should provide a good effort. See EXTRACT-LINKS
-
EXTERNAL FUNCTION LINK
- URL
- &KEY
- (CLIENT *CLIENT*)
- DESCRIPTION
- TAGS
-
EXTERNAL FUNCTION OFFLOAD
- &OPTIONAL
- (PATH *CONFIG-PATH*)
- (CLIENT *CLIENT*)
Save the client to the configuration file. Simply writes the client's make-load-form to the file. Returns the client. See *CLIENT* See *CONFIG-PATH*
-
EXTERNAL FUNCTION PROMPT
- PROMPT
- &KEY
- (CONVERTER #'NOT-EMPTY-CONVERTER)
- (DEFAULT NIL DEFAULT-P)
- (STREAM *QUERY-IO*)
Prompt the user for some information. Writes a prompt for PROMPT to the given stream, defaulting to *QUERY-IO*. It then reads a line from this same stream. If a DEFAULT is given, and the line is empty, then the default is returned. Otherwise, the CONVERTER is called with the line. If the converter signals an error, the error is written to the stream and the user is asked again. Otherwise, the value returned by the converter is returned. By default a converter is used that simply checks that the string is not empty.
-
EXTERNAL FUNCTION RESTORE
- &OPTIONAL
- (PATH *CONFIG-PATH*)
Load the client from the configuration file. Simply LOADs the given path if it exists and returns *client*. See *CLIENT* See *CONFIG-PATH*
-
EXTERNAL FUNCTION SETUP
- &KEY
- (CLIENTS (CLIENT-TYPES))
- (PATH *CONFIG-PATH*)
Constructs a new multiposter client and performs a login. On successful login, the client is OFFLOADed, the *CONFIG-PATH* and *CLIENT* variables are set, and the client is returned. The clients list can be a list of class names, class instances, or CLIENT instances. The first client in the list is picked as the multiposter client's primary client. See CLIENT-TYPES See LOGIN See OFFLOAD See *CLIENT* See *CONFIG-PATH*
-
EXTERNAL FUNCTION TEXT
- TEXT
- &KEY
- (CLIENT *CLIENT*)
- TAGS
- LINK
-
EXTERNAL FUNCTION VIDEO
- PATH
- &KEY
- (CLIENT *CLIENT*)
- DESCRIPTION
- TAGS
- LINK
Shorthand to post a new video. See POST-VIDEO See *CLIENT*
-
EXTERNAL GENERIC-FUNCTION CLIENTS
- OBJECT
Accessor to the list of client instances in the multiposter. See MULTIPOSTER
-
EXTERNAL GENERIC-FUNCTION (SETF CLIENTS)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION LOGIN
- CLIENT
- &KEY
- REPOSITORY
- BASE
- KEY
- SECRET
- ACCESS-TOKEN
- API-KEY
- API-SECRET
- ACCESS-SECRET
- BLOG
- &ALLOW-OTHER-KEYS
Performs the login and setup sequence for the given client. The client may specify custom keyword arguments that can be used to provide default settings. Any missing settings will be interactively queries from the user. Returns the client instance on success. Must signal an error on failure. See CLIENT
-
EXTERNAL GENERIC-FUNCTION POST
- CLIENT
- THING
- &KEY
- DESCRIPTION
- TAGS
- LINK
Post a thing using the given client. By default this delegates to the specific functions based on a heuristic analysis of the thing. See POST-TEXT See POST-LINK See POST-IMAGE See POST-VIDEO See *IMAGE-TYPES* See *VIDEO-TYPES* See EXTRACT-LINKS
-
EXTERNAL GENERIC-FUNCTION POST-IMAGE
- CLIENT
- PATH
- &KEY
- DESCRIPTION
- TAGS
- LINK
Posts a new image update to the client. Depending on the client the text may contain markup and links. Depending on the client the description or tags might be cut short. If LINK is provided, the update must include the full link. See CLIENT
-
EXTERNAL GENERIC-FUNCTION POST-LINK
- CLIENT
- URL
- &KEY
- DESCRIPTION
- TAGS
Posts a new link update to the client. Depending on the client the text may contain markup and links. Depending on the client the description or tags might be cut short. See CLIENT
-
EXTERNAL GENERIC-FUNCTION POST-TEXT
- CLIENT
- TEXT
- &KEY
- TAGS
- LINK
Posts a new textual update to the client. Depending on the client the text may contain markup and links. Depending on the client the text or tags might be cut short. If LINK is provided, the update must include the full link. See CLIENT
-
EXTERNAL GENERIC-FUNCTION POST-VIDEO
- CLIENT
- PATH
- &KEY
- DESCRIPTION
- TAGS
- LINK
Posts a new image update to the client. Depending on the client the text may contain markup and links. Depending on the client the description or tags might be cut short. If LINK is provided, the update must include the full link. See CLIENT
-
EXTERNAL GENERIC-FUNCTION PRIMARY
- OBJECT
Accessor to the primary client of the multiposter. See MULTIPOSTER
-
EXTERNAL GENERIC-FUNCTION (SETF PRIMARY)
- NEW-VALUE
- OBJECT
No documentation provided.