[Tutor] : Threads?

Orri Ganel singingxduck at gmail.com
Fri Oct 21 20:33:58 CEST 2005

Hello all,

I've been working on a program for a week or two now that will convert 
all the wav files in a folder to mp3s, filling the id3 tags with the 
correct information as collected from gracenote.com.  This part works 
fine.  However, the actual conversion to mp3 takes between 30 and 50 
seconds per song, so it's usually about 10 minutes per album.  With this 
in mind, I thought, why not try to use threads so all the conversions 
happen simultaneously?  That way, the whole album will take between 30 
and 50 seconds.  Unfortunately, I can't seem to get a working threaded 
version that significantly reduces the time involved . . . The 
unthreaded version is available at 
http://rafb.net/paste/results/Y1DTnW54.html, and the current, only 
slightly time-improved threaded version is available at 
http://rafb.net/paste/results/Lvsjj495.html. Any and all suggestions as 
to how to threadify this are welcome.  I realize the code isn't as 
pretty as it could be, but first I want to make a threaded version that 
works.  Once this has been accomplished, I'll finish commenting the code 
and making it more user-friendly to read.

Thanks in advance,

P.S. - In order to make my code work, it is necessary to download 
several modules. Once the code works, I'll include above the code a 
comment listing all the requirements. Right now, I believe the following 
modules are needed:

ClientForm - http://wwwsearch.sourceforge.net/ClientForm/
id3writer - 
(click the "download link" link)
id3reader - 
(click the "Ned Batchelder's id3Reader" link)
PyID3 - http://sourceforge.net/projects/pyid3
threadpool - http://chrisarndt.de/en/software/python/threadpool.html

I also considered using the following, but decided not to for reasons of 
difficulty of use or lack of desired operations:

PyID3Tag - http://superduper.net/?page=pyid3tag
ID3-Py - http://id3-py.sourceforge.net/

The following non-Python program is also needed:

Lame - http://lame.sourceforge.net/download/download.html

Email: singingxduck AT gmail DOT com
AIM: singingxduck
Programming Python for the fun of it.

More information about the Tutor mailing list