The &k3b; &DCOP; Interface&k3b; features, like many other &tde; applications as well, a
&DCOP; interface which makes it possible to control a part of it's
functionality from ⪚ a shellscript.To use these &DCOP; functions you can either use the
dcop commandline program or the more convenient
Kdcop application. Both provide the same
functionality so it's mostly a matter of taste and context of usage when
deciding which way to choose.This chapter assumes that you're using the dcop
commandline program. To access &k3b;'s &DCOP; functions, make sure that
&k3b; is started and then enter something like this at a console:
#dcop[function]Besides the generic &DCOP; functions available to all &tde;
applications, &k3b;'s DCOP interface mainly consists of two parts as described below.The default K3bInterfaceThe default K3b DCOP interface provides functionality like copyCD, formatDVD, and methods for creating new projects.
DCOPRef createDataCDProject()
DCOPRef createAudioCDProject()
DCOPRef createMixedCDProject()
DCOPRef createVideoCDProject()
DCOPRef createMovixCDProject()
DCOPRef createDataDVDProject()
DCOPRef createVideoDVDProject()
DCOPRef createMovixDVDProject()
DCOPRef openProject(KURL url)
QValueList<DCOPRef> projects()
DCOPRef currentProject()
void copyCd()
void copyDvd()
void eraseCdrw()
void formatDvd()
void burnCdImage(KURL url)
void burnDvdImage(KURL url)
As result from one of the createXXXProject methods one gets a DCOP reference to the newly created project:
DCOPRef(k3b,K3bProject-0)
Alternatively you may create a project using the command line:
#k3b--audiocd
and then retrieve a reference to this project with
#dcopcurrentProject
Using this reference it is possible to manipulate the project using the K3bProjectInterface.K3bProjectInterface
void addUrls(KURL::List urls)
void addUrl(KURL url)
void burn()
K3b offers the K3bProjectInterface as listed above or the more powerful K3bDataProjectInterface which only applies to data projects (CD and DVD):
void createFolder(TQString name)
void createFolder(TQString name,TQString parent)
void addUrl(KURL url,TQString parent)
void addUrls(KURL::List urls,TQString parent)
void removeItem(TQString path)
void renameItem(TQString path,TQString newName)
void setVolumeID(TQString id)
Using this it is possible to fill a data project with files and folders from a script.
The following script for example creates a new data project, adds several folders to the project, and adds files to the newly created folders:
#!/bin/bash
PROJECT=$(dcop k3b K3bInterface createDataCDProject)
dcop $PROJECT createFolder test
dcop $PROJECT createFolder foo
dcop $PROJECT createFolder bar /foo
dcop $PROJECT addUrl /home/trueg/somefile.txt /foo/bar