#!/usr/bin/env python
print "entering"


from threading import Thread
import threading
from commandsplus import getstatusoutputerror


def dum():
	cmd = ["dcop","amarok","collection","query","select url afrom analysis where url = '/home/rudd-o/Musica/(Themes and soundtracks)/Buffy - the vampire slayer.mp3'"]
	print getstatusoutputerror(cmd)

while True:
	print "Doing loop"
	threads = []
	for a in range(50):
		threads.append(Thread(target=dum))
	for t in threads[:]:
		try: t.start()
		except: threads.remove(t)
	counter = 0
	for t in threads:
		t.join()
		counter = counter + 1
	print "Loop done, %s threads waited" % counter
	

print "exiting"
