473,749 Members | 2,463 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5254
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"^T rack\s+(\d+):\s +(\d+)\s+of\s+( \d+)")
total_regexp = re.compile(r"^T otal size:\s+(\d+)")
fixating_regexp = re.compile(r"^F ixating\.")
done_regexp = re.compile(r"^F ixating time")
def loop_cdrecord(f ilep):
"""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.endsw ith("\n") or mycharbuf.endsw ith("\r"):
#sys.stdout.wri te(mycharbuf)
#sys.stdout.flu sh()
mycharbuf = mycharbuf[:-1]

if not burning:
try:
totalsize =
int(total_regex p.match(mycharb uf).group(1))
burning = 1
except:
pass
else:
if (track_regexp.s earch(mycharbuf )):
reobj = track_regexp.ma tch(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_PERCEN T = %d"%((progress* 98)/totalsize)

elif (fixating_regex p.search(mychar buf)):
print "CAN_PERCEN T = %d"%(98)
print "CAN_FIXATI NG"

elif (done_regexp.se arch(mycharbuf) ):
progress = 100
print "CAN_PERCEN T = %d"%(100)
exitstatus = "ok"
print "CAN_DONE"

sys.stdout.flus h()

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(p ipe_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********@via com-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
10917
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 like it NOT to use third party like Nero SDK, but only the main Windows 2000 and VS.NET 2003. I've googled and found samples for use with WinXP, Linux, KDE, etc etc, but none are meant for Windows 2000? I'll appreciate very much samples and help.
0
1282
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 there is an event raised, something lik "media inserted". This event leads to an Dialog, that asks if user wan to play this CD.
1
3927
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 folder on a server 2) CD Image is burnt to disc 3) CD is dispatched. What I want to do is have the user select the software package and then
4
3351
by: =?Utf-8?B?Sm9hY2hpbQ==?= | last post by:
How can you easily burn CDs and DVDs using C# and .NET?
1
1349
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 that when the CD-RW is in the drive I don't get the option to erase. can Anyone help? Kind regARDS ev
3
2124
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
6080
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 like that. What I basically need is the ability to put files and folders onto the CD/ DVD. Ideally it would work on IOStreams so that I could do it all in memory with MemoryStream's. Some of the things I would like but are not necessary:
5
3532
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 not easy to use with VB.NET. So I am looking for a library or any method that will allow me to burn CDs including burning multiple copies of one CD.
1
1486
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 heads and bodies are really long. it looks fine on my pc but not on tv. i have been burning in standard 4:3 ratio. can someone help me.
1
9333
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9254
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8256
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6800
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.