# Scripting Tryton Tutorial Video

**URL:** https://discuss.tryton.org/t/scripting-tryton-tutorial-video/406
**Category:** Feature
**Created:** [September 12, 2017, 9:19pm UTC](https://discuss.tryton.org/t/scripting-tryton-tutorial-video/406 "2017-09-12T21:19:19Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [September 12, 2017, 9:19pm UTC](https://discuss.tryton.org/t/scripting-tryton-tutorial-video/406/1 "2017-09-12T21:19:20Z")

</div>

## Rational

A recurring subject is Tryton tutorial and specifically video. Today, people want to learn by watching video.  
The big difficulty is to create those video in a way that we can maintain them when new versions are releases.

## Proposal

The idea of [Making ERPNext Help Videos with Scripting](https://frappe.io/blog/engineering/making-erpnext-help-videos-with-scripting) is very attractive.  
So we could reuse the libraries: [testcafe](https://devexpress.github.io/testcafe/), [say.js](https://github.com/Marak/say.js) and [dogtail](https://wiki.ubuntu.com/Testing/Automation/DogtailTutorial).

## Implementation

---

<div class="post-metadata">

### Author: ![Fares](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/fares/32/151_2.png) [@Fares](https://discuss.tryton.org/u/Fares)
#### Post date: [March 17, 2018, 6:11pm UTC](https://discuss.tryton.org/t/scripting-tryton-tutorial-video/406/2 "2018-03-17T18:11:38Z")

</div>

> [@ced](#):
>
> The big difficulty is to create those video in a way that we can maintain them when new versions are releases.

we can solve this issue be acting fast, as fast as the development of tryton.  
each version release, there should be video tutorial explaining the new features only.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [March 17, 2018, 8:53pm UTC](https://discuss.tryton.org/t/scripting-tryton-tutorial-video/406/3 "2018-03-17T20:53:13Z")

</div>

> [@Fares](#):
>
> we can solve this issue be acting fast, as fast as the development of tryton.

Experience shows that it is not the case.

> [@Fares](#):
>
> each version release, there should be video tutorial explaining the new features only

The problem is that potentially on each release something may have change in any tutorial. So the goal is to be able to redo a tutorial with the minimum work.

---

<div class="post-metadata">

### Author: ![Fares](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/fares/32/151_2.png) [@Fares](https://discuss.tryton.org/u/Fares)
#### Post date: [March 18, 2018, 9:33am UTC](https://discuss.tryton.org/t/scripting-tryton-tutorial-video/406/4 "2018-03-18T09:33:20Z")

</div>

> [@ced](#):
>
> The problem is that potentially on each release something may have change in any tutorial. So the goal is to be able to redo a tutorial with the minimum work.

The only way out of this problem is designing the tutorial sequence.

Let us make an example, trial is the best way of approval.

---

<div class="post-metadata">

### Author: ![udono](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/udono/32/2114_2.png) [@udono](https://discuss.tryton.org/u/udono)
#### Post date: [August 22, 2018, 6:42pm UTC](https://discuss.tryton.org/t/scripting-tryton-tutorial-video/406/5 "2018-08-22T18:42:51Z")

</div>

Another tool:

> **[xdotool - fake keyboard/mouse input, window management, and more 
 -...](https://www.semicomplete.com/projects/xdotool/)**
>
> What is xdotool? This tool lets you simulate keyboard input and mouse activity, move and resize windows, etc. It does this using X11’s XTEST extension and other Xlib functions.
> Additionally, you can search for windows and move, resize, hide, and...

---

<div class="post-metadata">

### Author: ![jcm](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/jcm/32/344_2.png) [@jcm](https://discuss.tryton.org/u/jcm)
#### Post date: [February 26, 2020, 11:44am UTC](https://discuss.tryton.org/t/scripting-tryton-tutorial-video/406/7 "2020-02-26T11:44:45Z")

</div>

Would it be possible to use test scenarios and build automatically videos from them? So how-to videos would be linked to the test scenarios that theirselves are updated by the developpers. Once existing scenarios are all turned into video, maybe it will be time to think to add more.

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [February 26, 2020, 12:39pm UTC](https://discuss.tryton.org/t/scripting-tryton-tutorial-video/406/8 "2020-02-26T12:39:23Z")

</div>

> [@jcm](#):
>
> Would it be possible to use test scenarios and build automatically videos from them?

Thats a good idea but I think the videos require a more verbose explanation that the tests scenario.  
Also the scenario may test some specific features that may not be relevant to all users.

For me the tests scenarios can be used as a base to create the first videos tutorials but after that they will need to be updated separatly.

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [February 26, 2020, 12:45pm UTC](https://discuss.tryton.org/t/scripting-tryton-tutorial-video/406/9 "2020-02-26T12:45:00Z")

</div>

For example here is [the erpnext videotutorial](https://www.youtube.com/watch?v=3wiIXId6dzg) for the equivalent functionality of the [sale\_advancement’s module scenario](https://hg.tryton.org/modules/sale_payment/file/5eed77be3879/tests/scenario_sale_payment.rst).

---

<div class="post-metadata">

### Author: ![andrew.szydlo](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/andrew.szydlo/32/1108_2.png) [@andrew.szydlo](https://discuss.tryton.org/u/andrew.szydlo)
#### Post date: [October 4, 2020, 11:57am UTC](https://discuss.tryton.org/t/scripting-tryton-tutorial-video/406/10 "2020-10-04T11:57:59Z")

</div>

Although I agree a video tutorial require a more verbose explanation than a test scenario, they would still be a good starting point. Anyway, please don’t give up 😉

---

<div class="post-metadata">

### Author: ![htgoebel](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/htgoebel/32/1256_2.png) [@htgoebel](https://discuss.tryton.org/u/htgoebel)
#### Post date: [September 10, 2022, 10:57am UTC](https://discuss.tryton.org/t/scripting-tryton-tutorial-video/406/11 "2022-09-10T10:57:14Z")

</div>

Two more possible projects:

- **ldtp2** ([Linux Desktop Testing Project - Wikipedia](https://en.wikipedia.org/wiki/Linux_Desktop_Testing_Project)) - basically works like dogtail
- **cypress** ([https://docs.cypress.io](https://docs.cypress.io)) — test-suite for front-end testing.  
Looks mighty but might be complicated though.

---

<div class="post-metadata">

### Author: ![htgoebel](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/htgoebel/32/1256_2.png) [@htgoebel](https://discuss.tryton.org/u/htgoebel)
#### Post date: [September 17, 2022, 11:34am UTC](https://discuss.tryton.org/t/scripting-tryton-tutorial-video/406/12 "2022-09-17T11:34:25Z")

</div>

I did some recherche and testing on this topic. I also discovered a new project „ldtp“.

- **dogtail**

- **ldtp2**

- **xdotool**

- **testcafe**

* * *

_ **text-to-speech options** _

- **say.js** mentioned in the original post
  - written in Javascript, to be used with testcafe — at least this is the idea
  - For Linux: uses the „Festival“ speech engine, does not support exporting the files (thus no caching)  
**Festival seems to support English only** — which is deal-breaker IMHO
  - For Windows: uses the Windows SAPI.SpVoice API
  - For Mac: Uses the Mac tool `say`

For **Python** , there is no package like says.js AFAIK. Anyhow, this can be implemented using a TTS package and some play-back module, eventually caching the synthesized speech. (And indeed I already implemented this)

- **TTS** — offline  
Uses language models by Coqui. Examples for English sound very good, same for the few tests I made for German. HUGE, since all offline.
- **pyttx/pyttx3** — offline  
Uses the operating-system’s mechanisms to generate speech (Windows: sapi5, Mac: nsss - NSSpeechSynthesizer, other: espeak — espeak is lousy AFAIK). Allows setting rate, voice, volume.
- **gTTS** — online  
Used the Google text-to-speech API. Seems to have only one voice per language. (German voice is a bit slow. Both German and English sound a bit tinny.) I also tested other German voices [Supported voices and languages &nbsp;|&nbsp; Cloud Text-to-Speech API &nbsp;|&nbsp; Google Cloud](https://cloud.google.com/text-to-speech/docs/voices), all somewhat tinny.
- **google-tts** — online  
Another package for Google TTS. Seems to allow setting rate, voice, output-encoding, etc.
- **ttw-wrapper** — online or offline depending on used engine/service  
Wrapper for several TTS engines: AWS Polly, Google, Microsoft, IBM Watson, PicoTTS, SAPI
- **tts-watson** — online  
API for accessing the IBM Watson TTS. Requires an API key, so I did not try it. (Registration and service seems to be free of charge)
- **nemo-tts** — NVIDIA Neural Modules, package seems a bit outdated

Unsorted findings:

- RHvoice project — seems to focus on eastern European languages
- sanskrit-tts — python module
- baidu-tts — python module
- liepa-ttts — python module, Lithuanian language synthesizer from LIEPA project
- PyPI list a lot more modules I did not investigate

Links:

- IBM Watson service: [IBM Cloud Docs](https://cloud.ibm.com/docs/text-to-speech)
- AWS Polly: [Amazon Polly](https://docs.aws.amazon.com/polly/latest/dg/)
- Google: [Text-to-Speech documentation &nbsp;|&nbsp; Cloud Text-to-Speech API &nbsp;|&nbsp; Google Cloud](https://cloud.google.com/text-to-speech/docs/)
- Microsoft Cortana: [Text to speech API reference (REST) - Speech service - Azure AI services | Microsoft Learn](https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/rest-text-to-speech) (old link)

And for play-back:

- **playsound** — Python  
could be used to play the exported sound files.

---

<div class="post-metadata">

### Author: ![htgoebel](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/htgoebel/32/1256_2.png) [@htgoebel](https://discuss.tryton.org/u/htgoebel)
#### Post date: [September 24, 2022, 4:56pm UTC](https://discuss.tryton.org/t/scripting-tryton-tutorial-video/406/13 "2022-09-24T16:56:35Z")

</div>

I have created a tooling with which you can create tutorial videos script-driven - in several languages Jfast- automatically. You can admire the first video in English, German and French at [https://dateicloud.de/index.php/s/6fQ9rgcDiSMXoJA](https://dateicloud.de/index.php/s/6fQ9rgcDiSMXoJA) . Also the playbook with which it was generated is attached.

The tooling is far beyond a proof-of-concept and in prototype state already. Anyhow, there is still room for improvements.

This is how it works:

- The playbook contains the texts to be spoken as well as the actions to be performed (clicking buttons, entering text, etc..)
- babel is used to extract the spoken strings and for translation.
- text-to-speech is used for generating speech for each text. Translated texts are used for this.  
Currently coqui TTS is used since it yields much better then Google TTS according to my tests. Anyhow Conqui’s model for French sound terrible, so we might need to improve here.
- A script „record-video.sh” creates a fresh database for each video (subject for optimization), starts trytond, starts the tryton GTK client, runs the playbook.
- The playbook starts (and pauses) the screen-recorder (simplescreenrecorder for now). The playbook decides about whether it starts before or after log-in.
- The playbook „says” the text (synchronous or asynchronous), moves the mouse, clicks and enters texts.
- The Accessibility Interface is used for interacting with the application. Thus it is quite high-level, although due to the technical way this GUI is made, some hurdles had to be taken. And there are still quite some issues to be solved.

As a test I created a French version of the video, which took about 10 minutes to translate the strngs using [deepl.com](http://deepl.com) and a minute to synthesize the speech. Thus within about 15 Minutes there was a translated version — with an all-French GUI.
