How to use the playsound.PlaysoundException function in playsound

To help you get started, we’ve selected a few playsound examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TaylorSMarks / playsound / playsound.py View on Github external
def winCommand(*command):
        buf = c_buffer(255)
        command = ' '.join(command).encode()
        errorCode = int(windll.winmm.mciSendStringA(command, buf, 254, 0))
        if errorCode:
            errorBuffer = c_buffer(255)
            windll.winmm.mciGetErrorStringA(errorCode, errorBuffer, 254)
            exceptionMessage = ('\n    Error ' + str(errorCode) + ' for command:'
                                '\n        ' + command +
                                '\n    ' + errorBuffer.value)
            raise PlaysoundException(exceptionMessage)
        return buf.value
github henry232323 / Pesterchum-Discord / playsound.py View on Github external
def winCommand(*command):
        buf = c_buffer(255)
        command = ' '.join(command).encode()
        errorCode = int(windll.winmm.mciSendStringA(command, buf, 254, 0))
        if errorCode:
            errorBuffer = c_buffer(255)
            windll.winmm.mciGetErrorStringA(errorCode, errorBuffer, 254)
            exceptionMessage = ('\n    Error ' + str(errorCode) + ' for command:'
                                '\n        ' + command.decode() +
                                '\n    ' + errorBuffer.value)
            raise PlaysoundException(exceptionMessage)
        return buf.value
github ugraveknight / Healslut-Master / HealslutMaster.py View on Github external
def do_macro(macro):
			if '$playsound' in macro:
				file = macro.replace('$playsound ','')
				try:
					Filepath = path.abspath('Resources\\Audio\\'+file)
					playsound(Filepath, False)
				except PlaysoundException:
					print(file, 'not found in Resources\\Audio\\')
			if '$playvideo' in macro:
				file = macro.replace('$playvideo ','')
				Filepath = path.abspath('Resources\\Video\\'+file)
				self.p_vid.send(Filepath)
			if '$text' in macro:
				macro=macro+' '
				text = macro.replace('$text','').upper()
				self.p_txt.send(text)
			if '$RandText' in macro:
				text = macro.replace('$RandText-','').upper()
				if 'INSULT' in text:
					line = HP.SetWrittenLine(self.Insults,self.hyp_dom.get(),self.hyp_sub.get(),self.FemSex.get())
					text = text.replace('INSULT','')+' '+line
				elif 'PRAISE' in text:
					line = HP.SetWrittenLine(self.Praise,self.hyp_dom.get(),self.hyp_sub.get(),self.FemSex.get())