Michel, This is perfect. Works like a charm, and I assume it's not due to my installing anything already besides Python itself. Thank you very much!
I'll go put this into a simple "mp3play" module, and put a recipe in the Cookbook, to up the chance that people find this. Perhaps the module will grow to detect your OS and then Just Work for Linux/Mac/Windows. Thanks again :D Michael On Tue, Aug 12, 2008 at 3:38 PM, Michel Claveau <[EMAIL PROTECTED]> wrote: > Hi! > > You can use MCI (include inWindows). > Example: > > > # -*- coding: utf-8 -*- > > import time > from ctypes import windll, c_buffer > > class mci: > def __init__(self): > self.w32mci = windll.winmm.mciSendStringA > self.w32mcierror = windll.winmm.mciGetErrorStringA > > def send(self,commande): > buffer = c_buffer(255) > errorcode = self.w32mci(str(commande),buffer,254,0) > if errorcode: > return errorcode, self.get_error(errorcode) > else: > return errorcode,buffer.value > > def get_error(self,error): > error = int(error) > buffer = c_buffer(255) > self.w32mcierror(error,buffer,254) > return buffer.value > > def directsend(self, txt): > (err,buf)=self.send(txt) > if err != 0: > print'Erreur',str(err),'sur',txt,':',buf > return (err,buf) > > mci=mci() > mci.directsend('open "c:\\myMusicFile.mp3" alias toto') > mci.directsend('set toto time format milliseconds') > err,buf=mci.directsend('status toto length ') > print 'Duree du fichier : ',buf,' millisecondes' > err,buf=mci.directsend('play toto from 0 to '+str(buf)) > time.sleep(int(buf)/1000) > mci.directsend('close toto') > > > > > > @-salutations > -- > Michel Claveau > > _______________________________________________ > python-win32 mailing list > python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32