473,394 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

CD Burning

Hi

Can anybody tell me which windows API or python module they are using
for writing cd's / dvd's with python?

Thanks
Albert

Apr 4 '06 #1
4 5199
Albert Leibbrandt enlightened us with:
Can anybody tell me which windows API or python module they are
using for writing cd's / dvd's with python?


I'd install cygwin and use cdrecord. That seems the easiest way to go
about burning disks to me.

Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
Frank Zappa
Apr 4 '06 #2
Hi,

I used cdrecord, albeit on Linux, to do it. Someone already suggested
to use Cygwin for that.

I'll just drop a piece of code I wrote for getting the percentage of
advance when recording sound, with cdrecord. Here it is (wraps
cdrecord):

#!/usr/bin/env python
"""
Canonizer: will open up a program and try to canonize its output.

Output is program dependent (different information is needed) but
always
canonical (messages are one line long, and parsable through splitting)

Currently only cdrecord will be implemented, but will be tailored for
anything.
Usage:

canonizer.py <myprogram and options>
"""

import re
import sys
import os
track_regexp = re.compile(r"^Track\s+(\d+):\s+(\d+)\s+of\s+(\d+)" )
total_regexp = re.compile(r"^Total size:\s+(\d+)")
fixating_regexp = re.compile(r"^Fixating\.")
done_regexp = re.compile(r"^Fixating time")
def loop_cdrecord(filep):
"""Loop over cdrecord's output"""
mycharbuf = ""
exitstatus = ""
burning = 0

#progress in Mbytes
progress = 0
newinterval = oldinterval = 0

while True:
data = filep.read(1)

if not data:
return exitstatus
mycharbuf+= data

if mycharbuf.endswith("\n") or mycharbuf.endswith("\r"):
#sys.stdout.write(mycharbuf)
#sys.stdout.flush()
mycharbuf = mycharbuf[:-1]

if not burning:
try:
totalsize =
int(total_regexp.match(mycharbuf).group(1))
burning = 1
except:
pass
else:
if (track_regexp.search(mycharbuf)):
reobj = track_regexp.match(mycharbuf)
mytrack, mynum, mydem = reobj.group(1, 2, 3)
oldinterval = newinterval
newinterval = int(mynum)
if (oldinterval <= newinterval):
progress += newinterval - oldinterval
else:
oldinterval = 0

print "CAN_PERCENT = %d"%((progress*98)/totalsize)

elif (fixating_regexp.search(mycharbuf)):
print "CAN_PERCENT = %d"%(98)
print "CAN_FIXATING"

elif (done_regexp.search(mycharbuf)):
progress = 100
print "CAN_PERCENT = %d"%(100)
exitstatus = "ok"
print "CAN_DONE"

sys.stdout.flush()

mycharbuf = ""

commandline = ""

#for i in sys.argv:
# print i

#Get the intended commandline
for i in sys.argv[1:]:
commandline += " " + i

pipe_filep = os.popen (commandline, "r")

exitstatus = loop_cdrecord(pipe_filep)

if (exitstatus != "ok"):
print "CAN_ERROR"

Apr 4 '06 #3
Albert Leibbrandt wrote:
Hi

Can anybody tell me which windows API or python module they are using
for writing cd's / dvd's with python?


Other people have offered sound suggestions about using
cdrecord etc. under Cygwin. Just to make the point, though,
XP (and above, presumably) does have an inbuilt interface
for burning CDs. I've never used it, and I don't know how feasible
it would be to access it from Python. (Helpful, eh?)

The interface is ICDBurn and it should be possible to wrap
it with ctypes / ctypes.com but I haven't the time at the
moment to try it out. (And I haven't a CD writer in this machine
either!)

Ultimately, it might still be easier to install Cygwin and use
the cdrecord approach. I just wanted to make the point that
there *was* an in-built mechanism.

ICDBurn:
http://msdn.microsoft.com/library/de...rn/icdburn.asp
ctypes.com: http://starship.python.net/crew/theller/ctypes/com.html

TJG

Apr 5 '06 #4
Nero has a commandline utility called NeroCMD.exe (not sure if you
needed a free solution or not)

Here's some sample code and write-up using NeroCMD.exe with Python:
http://www.answermysearches.com/inde...ng-process/10/

-Greg

On 5 Apr 2006 00:46:16 -0700, Tim Golden
<ti********@viacom-outdoor.co.uk> wrote:
Albert Leibbrandt wrote:
Hi

Can anybody tell me which windows API or python module they are using
for writing cd's / dvd's with python?


Other people have offered sound suggestions about using
cdrecord etc. under Cygwin. Just to make the point, though,
XP (and above, presumably) does have an inbuilt interface
for burning CDs. I've never used it, and I don't know how feasible
it would be to access it from Python. (Helpful, eh?)

The interface is ICDBurn and it should be possible to wrap
it with ctypes / ctypes.com but I haven't the time at the
moment to try it out. (And I haven't a CD writer in this machine
either!)

Ultimately, it might still be easier to install Cygwin and use
the cdrecord approach. I just wanted to make the point that
there *was* an in-built mechanism.

ICDBurn:
http://msdn.microsoft.com/library/de...rn/icdburn.asp
ctypes.com: http://starship.python.net/crew/theller/ctypes/com.html

TJG

--
http://mail.python.org/mailman/listinfo/python-list

--
Gregory Piñero
Chief Innovation Officer
Blended Technologies
(www.blendedtechnologies.com)
Apr 5 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Hendrik Christian | last post by:
Hi all, Is it possible to programmatically using C# burn a bunch of files in a predefined location to CD-R ? The application will be run in Windows 2000 environments. If it's possible, I would...
0
by: cyberkoks | last post by:
Hi all, I have a problem, may be you are able to help me ;) We wrote an application that burns audio CDs and everything works fin (we're using IMAPI for burning). But if burn process finishes...
1
by: Matt | last post by:
Morning all, I'm writing an app to speed up distribution of updates to remote users for some of our software. At the moment, it works like this: 1) CD Images (in the form of ISOs) exist in a...
4
by: =?Utf-8?B?Sm9hY2hpbQ==?= | last post by:
How can you easily burn CDs and DVDs using C# and .NET?
1
by: =?Utf-8?B?ZWxsYW52YW5uaW4=?= | last post by:
Hi I used to be able to send pictures or music to my CD-RW drive using Windows XP. Now I am unable to do this because when I right click to send to the drive it is not an option. Also I notice...
3
by: hambone2123 | last post by:
hi, im using windows vista and i tried burning a movie to dvd and when i play the dvd in my dvd player its in black and white and the screen jumps up and down what should i do
3
by: dmeglio | last post by:
Hello, I'm wondering if anyone out there is aware of any .NET CD/DVD burning component. I'm really just interested in burning files to CD/DVD do I don't care about MP3/MPEG-2 support or anything...
5
by: drabina | last post by:
Hi, I am looking for a way to burn CDs from VB.NET application. I have found a lot of posts asking about that but the links provided are mostly dead. There is IMAPI but as far as I know, it is...
1
by: =?Utf-8?B?cnNoZXBwMDY=?= | last post by:
im kinda new to burning dvds. im using windows dvd maker. i have gotten it to work and can play movie on my standalone dvd player. but when it displays on my tv the movie is scruched up . peoples...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.