Menu

#11 python 2.4; created mci.py using ctypes

open
nobody
None
5
2005-11-14
2005-11-14
No

Instead of going through the pain of compiling mci.dll
for python 2.4 I created a mci.py module, that calls
mciSendString via ctypes. It works great.

------- mci.py ------------
def mciSendString(str):
import ctypes
wm = ctypes.windll.WINMM
cbuf = ctypes.create_string_buffer('\x00' * 1000)
wm.mciSendStringA(str,cbuf,1000, 0)
return cbuf.value
------- mci.py ------------

Also, make sure to get rid of the os.geteuid call.

And make the example a bit more robust:

---- example.py -------
import CDDB, DiscID

cdrom = DiscID.open()
disc_id = DiscID.disc_id(cdrom)

(query_status, query_info) = CDDB.query(disc_id)

for i in range(len(query_info)):
print query_info[i]['title']

(read_status, read_info) =
CDDB.read(query_info[0]['category'],
query_info[0]['disc_id'])

for i in range(disc_id[1]):
print "Track %.02d: %s" % (i, read_info['TTITLE' + `i`])
---- example.py -------

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.