mme_mediacopier_add()

Add files to the copy queue

Synopsis:

#include <mme/mme.h>

int mme_mediacopier_add( mme_hdl_t *hdl,
                         mme_mediacopier_info_t *copyinfo,
                         char *statement,
                         uint32_t flags );

Arguments:

hdl
An MME connection handle.
copyinfo
A pointer to a mme_mediacopier_info_t structure that contains information about the copy operation.
statement
An SQL statement that selects the fids that you want to encode.
flags
Flags affecting the copy operation. See Mediacopier flags below.

Library:

mme

Description:

The function mme_mediacopier_add() prepares a media copying or ripping operation. Files that are selected by statement are added to the copyqueue table in the MME database.

To start a copy or ripping operation:


Note: To add files to the copy queue, specifying strings for unknown metadata, use mme_mediacopier_add_with_metadata().

Using default ripping values

By default, if you set the copyinfo members as follows: dstmsid=0, dstfolder=NULL, dstfilename=NULL, and encodeformatid=0, the MME will use the defaults in the configuration file mme.conf.


Caution: You should not assume that the default destination mediastore set by the configuration element <Copying>/<Destination>/<MSID> is always your HDD. In some instances, on startup the MME may detect another mediastore, such as a CD, before it detects the HDD and assign it msid=1. When preparing a media copy or ripping operation, ensure that the destination mediastore (dstmsid) is a writeable mediastore.

For more information, see the chapter Configuring Media Copying and Ripping in the MME Configuration Guide.

Mediacopier flags

Media copying and ripping uses the flags argument to determine media copying and ripping behavior. Possible values are combinations of:

Flag Value Description
MME_MEDIACOPIER_COPYADD_NONE 0x0000 Copy or rip directly to a destination folder. Obsolete; not supported.
MME_MEDIACOPIER_COPYADD_PRESERVE_PATH 0x0001 Preserve the original folder structure for copied or ripped files. Create folders as required. Obsolete; not supported.
MME_MEDIACOPIER_USE_DEFAULT_FILENAME 0x0002 Use the default destination filename set in the MME configuration file.
MME_MEDIACOPIER_USE_METADATA 0x0004 Use the specified metadata; do not use defaults.
MME_MEDIACOPIER_USE_DEFAULT_FOLDERNAME 0x0008 Use the default destination folder name set in the MME configuration file.

For more information about default destination files and folders, see Configuration elements for the media copy and ripping destination in the MME Configuration Guide chapter Configuring Media Copying and Ripping.

Events

None delivered.

Blocking and validation

Full validation of data; all arguments are checked before the call returns.

Returns:

0
Success
-1
An error occurred (errno is set).

Examples:

Below is a code snippet from the mmecli.c example application. This code snippet illustrates how to set up a call to mme_mediacopier_add().

mme_mediacopier_info_t copyinfo;

 // Just use defaults for now
 copyinfo.dstmsid = 0;
 copyinfo.dstfolderid = 0;
 copyinfo.format = 0;
 copyinfo.bitrate = 0;
 rc = mme_mediacopier_add(&mmehdl, &copyinfo, statement, 0);

 if (rc == -1) {
    sprintf(output, "Error setting copy add");
 }
 else {
    sprintf(output, "copy added");
 }

The example below shows how to use template strings for the destination folder and file name.

mme_mediacopier_info_t copyinfo;

char *folder = "/ripped/$ARTIST/$ALBUM/";
char *title = "$0TRACK-$TITLE(date=$DATESTAMP,time=$TIMESTAMP,srcfid=$SRCFID)";

copyinfo.dstmsid = 1;
copyinfo.dstfolder = folder;
copyinfo.dstfilename = title;
copyinfo.encodeformatid = 2;
rc = mme_mediacopier_add(mmehdl, &copyinfo, statement, 0);

 if (rc == -1) {
    sprintf(output, "Error setting copy add");
 }
 else {
    sprintf(output, "copy added");
 }

See mme_mediacopier_info_t.

Classification:

QNX Neutrino

Safety:
Interrupt handler No
Signal handler No
Thread Yes

See also:

mme_mediacopier_add_with_metadata(), mme_mediacopier_cleanup(), mme_mediacopier_clear(), mme_mediacopier_disable(), mme_mediacopier_enable(), mme_mediacopier_get_status(), mme_mediacopier_remove(), mme_mediacopier_info_t