Im writing an application oriented to speakers and conferences. Im writing it with Python and focused on Linux.
I would like to know if its possible to control LibreOffice Impress with Python, under Linux in some way.
I want to start an instance of LibreOffice Impress with some .odp file loaded, from my Python app. Then, I would like to be able to receive from the odp some info like: previous, current and next slide. Or somehow generate the images of the slides on the go.
Finally, I want to control LibreOffice in real time. This is: move through the slides using direction keys; right and left.
The idea is to use python alone, but I don't mind using external libraries or frameworks.
Thanks a lot.
Finally, I found a way to solve this using Python, in an elegant and easy way. Instead of libraries or APIs, Im using a socket to connect to Impress and control it.
At the end of the post you can read the full-text that indicates how to control Impress this way. It is easy, and amazing.
You send a message using Python to Impress ( that is listening in some port ), it receives the message and does things based on your request.
You must enable this "remote control" feeature in the app. I solved my problem using this.
Thanks for your replies!.
Communication is over a UTF-8 encoded character stream. (Using RTL_TEXTENCODING_UTF8 in the LibreOffice portion.)
More TCP-specific details on setup and initial handshake to be written, but the actual message protocol is the same as for Bluetooth.
A message consists of one or more lines. The first line is the message description, further lines can add any necessary data. An empty line concludes the message.
I.e. "MESSAGE\n\n" or "MESSAGE\nDATA\nDATA2...\n\n"
You must keep reading a message until an empty line (i.e. double new-line) is reached to allow for future protocol extension.
Once connected the server sends "LO_SERVER_SERVER_PAIRED". (I.e. "LO_SERVER_SERVER_PAIRED\n\n" is sent over the stream.)
Subsequently the server will send either slideshow_started if a slideshow is running, or slideshow_finished if no slideshow is running. (See below for details of.)
The current server implementation then proceeds to send all slide notes and previews to the client. (This should be changed to prevent memory issues, and a preview request mechanism implemented.)
The client should not assume that the state of the server has changed when a command has been sent. All changes will be signalled back to the client. (This is to allow for cases such as multiple clients requesting different changes, etc.)
Any lines in [square brackets] are optional, and should be omitted if not needed.
transition_previous
goto_slide slide_number
presentation_start
presentation_stop
presentation_resume // Resumes after a presentation_blank_screen.
slideshow_finished // (Also transmitted if no slideshow running when started.)
slideshow_started // (Also transmitted if a slideshow is running on startup.) numberOfSlides currentSlideNumber
slide_notes slideNumber [Notes] // The notes are an html document, and may also include \n newlines, // i.e. the client should keep reading until a blank line is reached.
slide_updated // Slide on server has changed currentSlideNumber
slide_preview // Supplies a preview image for a slide. slideNumber image // A Base 64 Encoded png image.