RD_AddCut
7
October 2015
Rivendell C Library Manual

# rd_addcut

Rivendell Add Cut C Library Function
Todd
Baker
bakert@rfa.org
Rivendell C Library Author

        #include <rivwebcapi/rd_addcut.h>

        int RD_AddCut
           struct rd_cut * cut[]
          const char hostname[]
          const char username[]
          const char passwd[]
          const char ticket[]
          const unsigned cartnumber
          const char user_agent[]
          unsigned * numrecs

## Description

`RD_AddCut` is the function to use to add a cut to an existing Rivendell Database.

This function adds a cut to the cart number entered into the Rivendell database on hostname. The cut will be created with default values listed below.

### RD_AddCut function call fields

FIELD NAME | FIELD TYPE | MEANING | REMARKS
--- | --- | --- | ---
*rd_cut | Pointer to rd_cut structure | Memory location to store cut information | Mandatory
hostname | Character Array | Name Of Rivendell DB Host | Mandatory
username | Character Array | Rivendell User Name | Mandatory When NO Ticket Provided.
passwd | Character Array | Rivendell User Password | Mandatory When NO Ticket Provided.
ticket | Character Array | Rivendell Authentification Ticket | Mandatory When NO User/Password Pair Provided.
cartnumber | unsigned integer | Cart Number | Mandatory
user_agent | Character Array | User Agent Value put into HTTP request | Optional (default is Rivendell-C-API/x.x.x)
*numrecs | pointer to integer | memory location for number of records returned | Mandatory

When successful function will return the number of records sent (numrecs) and a rd_cut structure which is stored in the provided memory locations. The rd_cut structure has the following fields:

        struct rd_cut {
              char cut_name[11];                  	/* Default is: CART###_CUT### */
              unsigned cut_cart_number;		/* Cart Number */
              unsigned cut_cut_number;		/* Next available Cut Number */
              int cut_evergreen;                    /* Default is: False */
              char cut_description[257];		/* Default is: Cut ### */
              char cut_outcue[257];			/* Default is: NULL */
              char cut_isrc[49];			/* Default is: NULL */
              char cut_isci[129];			/* Default is: NULL */
              unsigned  cut_length;			/* Default is: 0 */
              struct tm cut_origin_datetime;	/* Default is: NULL */
              struct tm cut_start_datetime;		/* Default is: NULL */
              struct tm cut_end_datetime;		/* Default is: NULL */
              int cut_sun;				/* Default is: true */
              int cut_mon;				/* Default is: true */
              int cut_tue;				/* Default is: true */
              int cut_wed;				/* Default is: true */
              int cut_thu;				/* Default is: true */
              int cut_fri;				/* Default is: true */
              int cut_sat;				/* Default is: true */
              char cut_start_daypart[14];		/* Default is: NULL */
              char cut_end_daypart[14];		/* Default is: NULL */
              char cut_origin_name[257];		/* Default is: NULL */
              unsigned cut_weight;			/* Default is: 1 */
              struct tm cut_last_play_datetime; 	/* Default is: NULL */
              unsigned cut_play_counter;		/* Default is: 0 */
              unsigned cut_local_counter;		/* Default is: 0 */
              unsigned cut_validity;		/* Default is: 0 */
              unsigned cut_coding_format;		/* Default is: 0 */
              unsigned cut_sample_rate;		/* Default is: 0 */
              unsigned cut_bit_rate;		/* Default is: 0 */
              unsigned cut_channels;		/* Default is: 2 */
              int cut_play_gain;			/* Default is: 0 */
              int cut_start_point;			/* Default is: -1 */
              int cut_end_point;			/* Default is: -1 */
              int cut_fadeup_point;			/* Default is: -1 */
              int cut_fadedown_point;		/* Default is: -1 */
              int cut_segue_start_point;		/* Default is: -1 */
              int cut_segue_end_point;		/* Default is: -1 */
              int cut_segue_gain;			/* Default is: -3000 */
              int cut_hook_start_point;		/* Default is: -1 */
              int cut_hook_end_point;		/* Default is: -1 */
              int cut_talk_start_point;		/* Default is: -1 */
              int cut_talk_end_point;		/* Default is: -1 */
        };

## RETURN VALUE

On success, zero is returned. Using the provided parameters an rd_cut structure is returned and the number of records is returned.

If a server error occurs a -1 is returned. If a client error occurs a specific error number is returned.

## ERRORS

400 Missing Cart Numer.

403 Invalid User Authentification.

404 No Such Cart Exists or Invalid Permissions.

500 Unable to Create Cut - No New Cuts.

nnn Unknown Error Occurred.