[Clam-devel] Aggregator

David García Garzón dgarcia at iua.upf.edu
Thu Jul 24 19:19:25 PDT 2008

About that patch, some tricks:

Whenever you have to do a conditional with code in each branch that repeats 
too much try to move out the common things and just put in the conditional 
what differs. This way you avoid duplicated code, make it more compact and 
more mantenible (one code in just on place).

In Annotator::computeSongDescriptors the difference between the conditional 
branches is that you add the "-c "+configfile in one side and not in the 

So if you put just:
std::string configurationOption;
if (mProject.Config()!="")
	configurationOption = "-c "+mProject.GetConfig();
then you can keep the code as it was before just apending configurationOption.

You can also simplify the Config method in this way:
First the check for an empty string is not needed. If you return GetConfig and 
it is "" you are returning the same than the static.
Also returning the string by copy could simplify a lot the code by not 
creating an static object (such static objects are good for passing tests but 
not for final code). So:

std::string Config() const
	if (not HasConfig()) return "";
	return GetConfig();

On Divendres 25 Juliol 2008, JunJun wrote:
> Hi,
> Here is a patch of adding Config attribute to Project. Yet the test gives a
> problem, that is, if the extractor is a python script
> (AggregationExtractor.py), shown as below. It can not be launched by
> Annotator. The screenshot showing this problem is also given in the
> attachment. *************************************************************
> Executing 'D:/devel/Annotator/scripts/AggregationExtractor.py
> ../example-data/SongsTest/Debaser- WoodenHouse.mp3 -f .aggregatedPool -c
> D:/devel/Annotator/example-data/AggregatorConfig.conf'
> *************************************************************
> To confirm that the above problem is caused by the python script,
> AggregationExtractor.py is translated to AggregationExtractor.exe (for
> Windows) with the tool py2exe. It works just fine, shown as  below:
> **************************************************************
> Executing 'D:/devel/Annotator/scripts/dist/AggregationExtractor.exe
> ../example-data/SongsTest/Debaser-WoodenHouse.mp3 -f .aggregatedPool -c
> D:/devel/Annotator/example-data/AggregatorConfig.conf' Processing
> ../example-data/SongsTest/Debaser-WoodenHouse.mp3...
> ++ Building aggregation script...
> ++ Querying descriptors from example...
> ++ Querying descriptors from chord...
> ++ Aggregating...
> Done.
> ***************************************************************
> So, I think that's a problem of launching .py script in Annotator. I've no
> idea how to solve this by far. Anybody?

We are using python a lot and we need to decide how to deploy that on Windows. 
Using py2exe on windows is not a bad idea. In fact we used it for BocaClient 
but the problem right now is that i was unable to build the py2exe binaries 
using wine. I should try more but it seemed hard to do. At the end we have 
two options for the windows installer, install Python with the Annotator or 
using py2exe. Nice you know how to use it. :-)

I remember the 'start' command in my old windows times that could be a nice 
temporary solution for your ploblems. Such program just takes a file and 
opens it with the default explorer association. In this case the associated 
program should be the python.exe binary so if you prepend 'start' to the 
command it might work.

David García Garzón
(Work) dgarcia at iua dot upf anotherdot es
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.clam-project.org/pipermail/clam-devel-clam-project.org/attachments/20080725/c5ff2bc6/attachment.sig>

More information about the clam-devel mailing list