RD_Import
7
October 2015
Rivendell C Library Manual

# rd_import

Rivendell Import Audio C Library Function
Todd
Baker
bakert@rfa.org
Rivendell C Library Author

        #include <rivwebcapi/rd_import.h>

        int RD_Import
          struct rd_cartimport *import[]
          const char hostname[]
          const char username[]
          const char passwd[]
          const char ticket[]
          const unsigned cartnumber
          const unsigned cutnumber
          const unsigned channels
          const int normalization_level
          const int autotrim_level
          const int use_metadata
          const int create
          const char group[]
          const char title[]
          const char filename[]
          const char user_agent[]
          unsigned *numrecs

## Description

`RD_Import` is the function to use to import PCM/MPEG data into the audio store.

### RD_Import function call fields

FIELD NAME | FIELD TYPE | MEANING | REMARKS
--- | --- | --- | ---
*import | Pointer to rd_cartimport structure | Memory location to store import information | Mandatory
hostname | Character Array | Name Of Rivendell DB Host | Mandatory When NO Ticket Provided
username | Character Array | Rivendell User Name | Mandatory
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
cutnumber | unsigned integer | Cut Number | Mandatory
channels | unsigned integer | Number of Channels | Mandatory
normalization_level | integer | Normalization Level | Mandatory
autotrim_level | integer | AutoTrim Level | Mandatory
use_metadata | integer | Flag for whether to use Meta Data | Mandatory
create | integer | Create Cart Flag | Optional
group | Character Array | Rivendell Group Name | Mandatory IF Creating Cart
title | Character Array | Cart Title | Optional - If present used for Duplicate Cart Check
filename | character array | File Name For Source Audio | 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_cartimport structure which is stored in the provided memory locations. The rd_cartimport structure has the following fields:

        struct rd_cartimport{
              int response_code;                  /* HTTP Response Code */
              char error_string[256];             /* Error Explanation */
              unsigned cart_number;               /* Destination Cart Number */
              unsigned cut_number;                /* Destination Cut Number */
        };

## RETURN VALUE

On success, zero 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 Number / Cut Number Error.

400 Missing Input Parameter(s).

403 User Authentification Error.

404 Unauthorized, or No Such Cart/Cut/Group, or Duplicate Cart Titles Not Allowed.

415 Format Not Supported.

415 Conversion Settings/Format Error.

500 Conversion Error.

509 Format Error On Convert.

nnn Unknown Error Occurred.