Warning: mysqli_real_connect(): Headers and client library minor version mismatch. Headers:50625 Library:50543 in /sites/rockbox.org/flyspray/adodb/drivers/adodb-mysqli.inc.php on line 108 FS#11506 : Python script to generate .talk clips



FS#11506 - Python script to generate .talk clips

Attached to Project: Rockbox
Opened by Daniel Dalton (ddalton) - Friday, 30 July 2010, 07:47 GMT
Last edited by Rafaël Carré (funman) - Saturday, 28 August 2010, 11:00 GMT
Task Type Patches
Category Utils
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Release 3.6
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


I felt the need for a quick, easy and reliable way to generate .talk
clips from the Linux console. I'm totally blind, and rbutil was not an
option as QT apps aren't accessible under Linux.

I decided to develop a script in python
to do just this. It works reasonably well, though it is basic, but it
does what I want.

This patch creates the file trunk/tools/talkclips.py
python talkclips.py will give usage info, though all you do is supply
one argument, the directory you wish to create talk clips under.

Creates clips for files and directories (recursively)
Logs to a file so usage can be examined.
Validation checks for the command line as well as error checking.

Maybe it might be handy to add functionality so a file can be passed,
but I couldn't see why someone would want this...? A progress
measurement may be useful, but I think this just over complicates the
whole thing.

Requirements should just be python, espeak, and rbspeexenc should be in
the same dir unless you modify the path in my script. You obviously need
some kind of shell to work with os.system(), eg. bash.

Anyway let me know your thoughts (diff attached)
This task depends upon

Closed by  Rafaël Carré (funman)
Saturday, 28 August 2010, 11:00 GMT
Reason for closing:  Accepted
Additional comments about closing:  r27914
Comment by Rafaël Carré (funman) - Saturday, 28 August 2010, 00:29 GMT

I don't use talk clips but just a small comment:

Could you detect espeak/rbspeexenc before running these programs, and fail if they are not accessible?

For example try to run "which espeak", or "espeak -h > /dev/null"

If you prefer I can commit the script as is and you could make another patch later
Comment by Daniel Dalton (ddalton) - Saturday, 28 August 2010, 07:00 GMT

Thanks for the feedback. Attached is a revised version:

1. Set a full path for espeak and check if it exists (using
2. I've done the same for rbspeexenc default path for rbspeexenc is
still in the current working dir (./)
3. Print an error, and abort if rbspeexenc or espeak can't be found.
4. Moved some variables which should be changed by the user if desired
to the top of the file and
added clearer comments. Also noted what shouldn't be touched and moved
this down the file out of the way.
5. Checked that all expected functionality works

I think this is ready to be committed, so I'd be very grateful if you
would commit.:)

Comment by Rafaël Carré (funman) - Saturday, 28 August 2010, 10:42 GMT
I just noticed there is no license header in your script, can you add a GPL header if you want to distribute it under GPL?

Just copy the header from tools/thumb-cc.py for example and don't forget to add your copyright
Comment by Daniel Dalton (ddalton) - Saturday, 28 August 2010, 10:54 GMT
Sure, here it is.