All pastes #62943 Raw Edit

Anonymous

public text v1 · immutable
#62943 ·published 2006-06-07 13:55 UTC
rendered paste body
class tools:
	def alsaUsed(self, standard = 2):
		result = []
		f = os.popen("fuser /dev/snd/* /dev/dsp* /dev/snd/*", "r")
		# Count lines of output, if more then standard then sound is used!
		l = len(f.readlines()) 
		if  > standard:
			result = []
		return result


	def pids(self,programm):
		"""Return a list Return a list of process ids for all processes that are running
		"program".  Relies on a particular output format for ps a little
		too much."""
		f = os.popen("ps aux", "r")
		for zeile in f.readlines():
			felder = string.split(zeile)
			if felder[10].find(programm) is not -1:
				result.append(int(felder[1]))
			
		return result