Convert stageplay into XEP-0227 archive for XMPP testing and client screenshots usage

Clone this repo:

Branches

  1. b74be16 Fix user credentials by PulkoMandy · 5 months ago main
  2. 8defb50 Initial import by PulkoMandy · 6 months ago

What is this thing?

A very specific use tool.

When I make improvements to Renga, I usually want to share some screenshots of it. However, being a chat client, the easiest thing I can do is taking screenshots of existing chatrooms that I take part in. Which means I would need approval from every participants to make a screenshot.

I heard that other XMPP client developers have similar problems. Everyone either does this, or spend a considerable amount of time running fake accounts and creating fake conversations just for a few screenshots.

As I am lazy, I decided to write a tool to automate this. And since I'm very lazy, I based it on public domain text from a screenplay. XMPP traditions would point to using a Shalespeare play, but I think it's time to have some more cultural diversity, so I picked something else, namely Karel Capek's R.U.R (Rossum's Univeral Robots), which involves human-looking robots and some confusion about who's a robot or not. Also it ends up with the robots extracting all resources from Earth, and causing the disappearance of the humans. Seems fitting to the modrn day, and also to the fact that this will be chat logs generated from a computer.

How des it work?

I wrote a Python script that parses the HTML from a gutenprint edition of the stageplay script. It manages to skip over everything that's not dialogue, and converts the dialogue into a XEP-0227 XML file, that I understand should be importable into an XMPP server. Then any XMPP client should be able to log to that server and access the dialogue as a MAM archive. I have not tested that yet.

How to use it?

I have not fully figured that out, yet.

Can it be improved?

Here are some ideas:

  • Parse some other works for a bit of variation? The formatting in Gutenprint books seems too inconsistent, the arser will have to be tweaked manually for each one. I don't think that's worth the effort, for now. Maybe when I get bored with RUR and want something else in my screenshots. An option is to use a more streamlined format as an input, Fountain seems like a good candidate, but there does not seem to be much plays available in that format, except, of course, the ones from Shakespeare. Again.
  • Stage directions could be extracted and converted to /me commands. I am a bit confused about how to do it properly with Python XML classes, however. You can iterate either over child element, or over text, but not both. And the stage directions require detecting (<i>...</i>) sequences. Maybe the parentheses would be enough. They are inlined in the dialogue, and sometimes include the name of another character than the one talking. Not sure how much of this can be automated.
  • Adding some more fun things, such as vcard and avatars for each of the characters.

Licensing

The code in main.py is distributed under the WTFPL.

The RUR script is distributed as specified by the Gutenprint license info included therein. I think that applies to the exported file as well?