mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-04-09 22:43:11 +02:00
2018-10-11 Fred Gleason <fredg@paravelsystems.com>
* Added an 'RD_ListCartsCuts()' function to 'rivwebcapi'.
This commit is contained in:
parent
3aa50b54cf
commit
ae75610054
@ -17764,3 +17764,5 @@
|
||||
from 11 to 41 in 'rivwebcapi'.
|
||||
* Added a 'struct rd_cut *cart_cuts' member to the 'rd_cart' struct
|
||||
in 'rivwebcapi'.
|
||||
2018-10-11 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added an 'RD_ListCartsCuts()' function to 'rivwebcapi'.
|
||||
|
@ -42,6 +42,7 @@ dist_librivwebcapi_la_SOURCES = rd_addcart.c rd_addcart.h \
|
||||
rd_listcart.c rd_listcart.h \
|
||||
rd_listcartcuts.c rd_listcartcuts.h \
|
||||
rd_listcarts.c rd_listcarts.h \
|
||||
rd_listcartscuts.c rd_listcartscuts.h \
|
||||
rd_listcut.c rd_listcut.h \
|
||||
rd_listcuts.c rd_listcuts.h \
|
||||
rd_listgroups.c rd_listgroups.h \
|
||||
@ -85,6 +86,7 @@ include_HEADERS = rd_addcart.h\
|
||||
rd_listcartcuts.h\
|
||||
rd_listcartschedcodes.h\
|
||||
rd_listcarts.h\
|
||||
rd_listcartscuts.h\
|
||||
rd_listcut.h\
|
||||
rd_listcuts.h\
|
||||
rd_listgroup.h\
|
||||
|
509
apis/rivwebcapi/rivwebcapi/rd_listcartscuts.c
Normal file
509
apis/rivwebcapi/rivwebcapi/rd_listcartscuts.c
Normal file
@ -0,0 +1,509 @@
|
||||
/* rd_listcartscuts.c
|
||||
*
|
||||
* ListCartsCuts Rivendell Access Library
|
||||
*
|
||||
* (C) Copyright 2015 Todd Baker <bakert@rfa.org>
|
||||
* (C) Copyright 2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <curl/curl.h>
|
||||
#include <expat.h>
|
||||
|
||||
#include "rd_common.h"
|
||||
#include "rd_getuseragent.h"
|
||||
#include "rd_listcartscuts.h"
|
||||
|
||||
struct xml_data {
|
||||
char elem_name[256];
|
||||
char strbuf[1024];
|
||||
struct rd_cart *carts;
|
||||
int cart_ptr;
|
||||
int cut_ptr;
|
||||
};
|
||||
|
||||
|
||||
static void XMLCALL __ListCartsCutsElementStart(void *data, const char *el,
|
||||
const char **attr)
|
||||
{
|
||||
unsigned i;
|
||||
struct xml_data *xml_data=(struct xml_data *)data;
|
||||
if(strcasecmp(el,"cart")==0) { // Allocate a new cart entry
|
||||
(xml_data->cart_ptr)++;
|
||||
xml_data->carts=
|
||||
realloc(xml_data->carts,sizeof(struct rd_cart)*(xml_data->cart_ptr+1));
|
||||
memset(xml_data->carts+xml_data->cart_ptr,0,sizeof(struct rd_cart));
|
||||
xml_data->cut_ptr=-1;
|
||||
}
|
||||
if(strcasecmp(el,"cut")==0) { // Allocate a new cut entry
|
||||
(xml_data->cut_ptr)++;
|
||||
(xml_data->carts+xml_data->cart_ptr)->cart_cuts=realloc((xml_data->carts+xml_data->cart_ptr)->cart_cuts,sizeof(struct rd_cut)*((xml_data->cut_ptr)+1));
|
||||
}
|
||||
strlcpy(xml_data->elem_name,el,256);
|
||||
memset(xml_data->strbuf,0,1024);
|
||||
}
|
||||
|
||||
|
||||
static void XMLCALL __ListCartsCutsElementData(void *data,const XML_Char *s,
|
||||
int len)
|
||||
{
|
||||
struct xml_data *xml_data=(struct xml_data *)data;
|
||||
|
||||
memcpy(xml_data->strbuf+strlen(xml_data->strbuf),s,len);
|
||||
}
|
||||
|
||||
|
||||
static void XMLCALL __ListCartsCutsElementEnd(void *data, const char *el)
|
||||
{
|
||||
struct xml_data *xml_data=(struct xml_data *)data;
|
||||
struct rd_cart *carts=(xml_data->carts)+xml_data->cart_ptr;
|
||||
char hold_datetime[27];
|
||||
|
||||
if(xml_data->cut_ptr<0) {
|
||||
/*
|
||||
* Cart Attributes
|
||||
*/
|
||||
if(strcasecmp(el,"number")==0) {
|
||||
sscanf(xml_data->strbuf,"%u",&carts->cart_number);
|
||||
}
|
||||
if(strcasecmp(el,"type")==0) {
|
||||
if(strcasecmp(xml_data->strbuf,"audio")==0) {
|
||||
carts->cart_type=TYPE_AUDIO;
|
||||
}
|
||||
else {
|
||||
if(strcasecmp(xml_data->strbuf,"macro")==0) {
|
||||
carts->cart_type=TYPE_MACRO;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This is ALL type */
|
||||
carts->cart_type=TYPE_ALL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(strcasecmp(el,"groupName")==0) {
|
||||
strlcpy(carts->cart_grp_name,xml_data->strbuf,41);
|
||||
}
|
||||
if(strcasecmp(el,"title")==0) {
|
||||
strlcpy(carts->cart_title,xml_data->strbuf,1021);
|
||||
}
|
||||
if(strcasecmp(el,"artist")==0) {
|
||||
strlcpy(carts->cart_artist,xml_data->strbuf,1021);
|
||||
}
|
||||
if(strcasecmp(el,"album")==0) {
|
||||
strlcpy(carts->cart_album,xml_data->strbuf,1021);
|
||||
}
|
||||
if(strcasecmp(el,"year")==0) {
|
||||
sscanf(xml_data->strbuf,"%d",&carts->cart_year);
|
||||
}
|
||||
if(strcasecmp(el,"label")==0) {
|
||||
strlcpy(carts->cart_label,xml_data->strbuf,257);
|
||||
}
|
||||
if(strcasecmp(el,"client")==0) {
|
||||
strlcpy(carts->cart_client,xml_data->strbuf,257);
|
||||
}
|
||||
if(strcasecmp(el,"agency")==0) {
|
||||
strlcpy(carts->cart_agency,xml_data->strbuf,257);
|
||||
}
|
||||
if(strcasecmp(el,"publisher")==0) {
|
||||
strlcpy(carts->cart_publisher,xml_data->strbuf,257);
|
||||
}
|
||||
if(strcasecmp(el,"composer")==0) {
|
||||
strlcpy(carts->cart_composer,xml_data->strbuf,257);
|
||||
}
|
||||
if(strcasecmp(el,"conductor")==0) {
|
||||
strlcpy(carts->cart_conductor,xml_data->strbuf,257);
|
||||
}
|
||||
if(strcasecmp(el,"userDefined")==0) {
|
||||
strlcpy(carts->cart_user_defined,xml_data->strbuf,1021);
|
||||
}
|
||||
if(strcasecmp(el,"usageCode")==0) {
|
||||
sscanf(xml_data->strbuf,"%d",&carts->cart_usage_code);
|
||||
}
|
||||
if(strcasecmp(el,"forcedLength")==0) {
|
||||
carts->cart_forced_length=RD_Cnv_TString_to_msec(xml_data->strbuf);
|
||||
}
|
||||
if(strcasecmp(el,"averageLength")==0) {
|
||||
carts->cart_average_length=RD_Cnv_TString_to_msec(xml_data->strbuf);
|
||||
}
|
||||
if(strcasecmp(el,"lengthDeviation")==0) {
|
||||
carts->cart_length_deviation=RD_Cnv_TString_to_msec(xml_data->strbuf);
|
||||
}
|
||||
if(strcasecmp(el,"averageSegueLength")==0) {
|
||||
carts->cart_average_segue_length=RD_Cnv_TString_to_msec(xml_data->strbuf);
|
||||
}
|
||||
if(strcasecmp(el,"averageHookLength")==0) {
|
||||
carts->cart_average_hook_length=RD_Cnv_TString_to_msec(xml_data->strbuf);
|
||||
}
|
||||
if(strcasecmp(el,"cutQuantity")==0) {
|
||||
sscanf(xml_data->strbuf,"%u",&carts->cart_cut_quantity);
|
||||
}
|
||||
if(strcasecmp(el,"lastCutPlayed")==0) {
|
||||
sscanf(xml_data->strbuf,"%u",&carts->cart_last_cut_played);
|
||||
}
|
||||
if(strcasecmp(el,"validity")==0) {
|
||||
sscanf(xml_data->strbuf,"%u",&carts->cart_validity);
|
||||
}
|
||||
if(strcasecmp(el,"enforceLength")==0) {
|
||||
carts->cart_enforce_length=RD_ReadBool(xml_data->strbuf);
|
||||
}
|
||||
if(strcasecmp(el,"asyncronous")==0) {
|
||||
carts->cart_asyncronous=RD_ReadBool(xml_data->strbuf);
|
||||
}
|
||||
if(strcasecmp(el,"owner")==0) {
|
||||
strlcpy(carts->cart_owner,xml_data->strbuf,257);
|
||||
}
|
||||
if(strcasecmp(el,"metadataDatetime")==0) {
|
||||
strlcpy(hold_datetime,xml_data->strbuf,26);
|
||||
carts->cart_metadata_datetime = RD_Cnv_DTString_to_tm(hold_datetime);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* Cut Attributes
|
||||
*/
|
||||
struct rd_cut *cut=(struct rd_cut *)(carts->cart_cuts)+xml_data->cut_ptr;
|
||||
|
||||
if(strcasecmp(el,"cutName")==0) {
|
||||
strlcpy(cut->cut_name,xml_data->strbuf,40);
|
||||
}
|
||||
if(strcasecmp(el,"cartNumber")==0) {
|
||||
sscanf(xml_data->strbuf,"%u",&(cut->cut_cart_number));
|
||||
}
|
||||
if(strcasecmp(el,"cutNumber")==0) {
|
||||
sscanf(xml_data->strbuf,"%u",&(cut->cut_cut_number));
|
||||
}
|
||||
if(strcasecmp(el,"evergreen")==0) {
|
||||
cut->cut_evergreen=strcmp(xml_data->strbuf,"false");
|
||||
}
|
||||
if(strcasecmp(el,"description")==0) {
|
||||
strlcpy(cut->cut_description,xml_data->strbuf,256);
|
||||
}
|
||||
if(strcasecmp(el,"outcue")==0) {
|
||||
strlcpy(cut->cut_outcue,xml_data->strbuf,256);
|
||||
}
|
||||
if(strcasecmp(el,"isrc")==0) {
|
||||
strlcpy(cut->cut_isrc,xml_data->strbuf,48);
|
||||
}
|
||||
if(strcasecmp(el,"isci")==0) {
|
||||
strlcpy(cut->cut_isci,xml_data->strbuf,128);
|
||||
}
|
||||
if(strcasecmp(el,"length")==0) {
|
||||
sscanf(xml_data->strbuf,"%u",&(cut->cut_length));
|
||||
}
|
||||
if(strcasecmp(el,"originDatetime")==0) {
|
||||
strlcpy(hold_datetime,xml_data->strbuf,26);
|
||||
cut->cut_origin_datetime=RD_Cnv_DTString_to_tm(hold_datetime);
|
||||
}
|
||||
if(strcasecmp(el,"startDatetime")==0) {
|
||||
strlcpy(hold_datetime,xml_data->strbuf,26);
|
||||
cut->cut_start_datetime=RD_Cnv_DTString_to_tm(hold_datetime);
|
||||
}
|
||||
if(strcasecmp(el,"endDatetime")==0) {
|
||||
strlcpy(hold_datetime,xml_data->strbuf,26);
|
||||
cut->cut_end_datetime=RD_Cnv_DTString_to_tm(hold_datetime);
|
||||
}
|
||||
if(strcasecmp(el,"sun")==0) {
|
||||
cut->cut_sun=strcmp(xml_data->strbuf,"false");
|
||||
}
|
||||
if(strcasecmp(el,"mon")==0) {
|
||||
cut->cut_mon=strcmp(xml_data->strbuf,"false");
|
||||
}
|
||||
if(strcasecmp(el,"tue")==0) {
|
||||
cut->cut_tue=strcmp(xml_data->strbuf,"false");
|
||||
}
|
||||
if(strcasecmp(el,"wed")==0) {
|
||||
cut->cut_wed=strcmp(xml_data->strbuf,"false");
|
||||
}
|
||||
if(strcasecmp(el,"thu")==0) {
|
||||
cut->cut_thu=strcmp(xml_data->strbuf,"false");
|
||||
}
|
||||
if(strcasecmp(el,"fri")==0) {
|
||||
cut->cut_fri=strcmp(xml_data->strbuf,"false");
|
||||
}
|
||||
if(strcasecmp(el,"sat")==0) {
|
||||
cut->cut_sat=strcmp(xml_data->strbuf,"false");
|
||||
}
|
||||
if(strcasecmp(el,"startDaypart")==0) {
|
||||
strlcpy(cut->cut_start_daypart,xml_data->strbuf,14);
|
||||
}
|
||||
if(strcasecmp(el,"endDaypart")==0) {
|
||||
strlcpy(cut->cut_end_daypart,xml_data->strbuf,14);
|
||||
}
|
||||
if(strcasecmp(el,"originName")==0) {
|
||||
strlcpy(cut->cut_origin_name,xml_data->strbuf,256);
|
||||
}
|
||||
if(strcasecmp(el,"originLoginName")==0) {
|
||||
strlcpy(cut->cut_origin_login_name,xml_data->strbuf,764);
|
||||
}
|
||||
if(strcasecmp(el,"sourceHostname")==0) {
|
||||
strlcpy(cut->cut_source_hostname,xml_data->strbuf,764);
|
||||
}
|
||||
if(strcasecmp(el,"weight")==0) {
|
||||
sscanf(xml_data->strbuf,"%u",&(cut->cut_weight));
|
||||
}
|
||||
if(strcasecmp(el,"lastPlayDatetime")==0) {
|
||||
strlcpy(hold_datetime,xml_data->strbuf,26);
|
||||
cut->cut_last_play_datetime=RD_Cnv_DTString_to_tm(hold_datetime);
|
||||
}
|
||||
if(strcasecmp(el,"playCounter")==0) {
|
||||
sscanf(xml_data->strbuf,"%u",&(cut->cut_play_counter));
|
||||
}
|
||||
if(strcasecmp(el,"codingFormat")==0) {
|
||||
sscanf(xml_data->strbuf,"%u",&(cut->cut_coding_format));
|
||||
}
|
||||
if(strcasecmp(el,"sampleRate")==0) {
|
||||
sscanf(xml_data->strbuf,"%u",&(cut->cut_sample_rate));
|
||||
}
|
||||
if(strcasecmp(el,"bitRate")==0) {
|
||||
sscanf(xml_data->strbuf,"%u",&(cut->cut_bit_rate));
|
||||
}
|
||||
if(strcasecmp(el,"channels")==0) {
|
||||
sscanf(xml_data->strbuf,"%u",&(cut->cut_channels));
|
||||
}
|
||||
if(strcasecmp(el,"playGain")==0) {
|
||||
sscanf(xml_data->strbuf,"%d",&(cut->cut_play_gain));
|
||||
}
|
||||
if(strcasecmp(el,"startPoint")==0) {
|
||||
sscanf(xml_data->strbuf,"%d",&(cut->cut_start_point));
|
||||
}
|
||||
if(strcasecmp(el,"endPoint")==0) {
|
||||
sscanf(xml_data->strbuf,"%d",&(cut->cut_end_point));
|
||||
}
|
||||
if(strcasecmp(el,"fadeupPoint")==0) {
|
||||
sscanf(xml_data->strbuf,"%d",&(cut->cut_fadeup_point));
|
||||
}
|
||||
if(strcasecmp(el,"fadedownPoint")==0) {
|
||||
sscanf(xml_data->strbuf,"%d",&(cut->cut_fadedown_point));
|
||||
}
|
||||
if(strcasecmp(el,"segueStartPoint")==0) {
|
||||
sscanf(xml_data->strbuf,"%d",&(cut->cut_segue_start_point));
|
||||
}
|
||||
if(strcasecmp(el,"segueEndPoint")==0) {
|
||||
sscanf(xml_data->strbuf,"%d",&(cut->cut_segue_end_point));
|
||||
}
|
||||
if(strcasecmp(el,"segueGain")==0) {
|
||||
sscanf(xml_data->strbuf,"%d",&(cut->cut_segue_gain));
|
||||
}
|
||||
if(strcasecmp(el,"hookStartPoint")==0) {
|
||||
sscanf(xml_data->strbuf,"%d",&(cut->cut_hook_start_point));
|
||||
}
|
||||
if(strcasecmp(el,"hookEndPoint")==0) {
|
||||
sscanf(xml_data->strbuf,"%d",&(cut->cut_hook_end_point));
|
||||
}
|
||||
if(strcasecmp(el,"talkStartPoint")==0) {
|
||||
sscanf(xml_data->strbuf,"%d",&(cut->cut_talk_start_point));
|
||||
}
|
||||
if(strcasecmp(el,"talkEndPoint")==0) {
|
||||
sscanf(xml_data->strbuf,"%d",&(cut->cut_talk_end_point));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
size_t __ListCartsCutsCallback(void *ptr, size_t size, size_t nmemb, void *userdata)
|
||||
{
|
||||
XML_Parser p=(XML_Parser)userdata;
|
||||
|
||||
XML_Parse(p,ptr,size*nmemb,0);
|
||||
|
||||
return size*nmemb;
|
||||
}
|
||||
|
||||
|
||||
int RD_ListCartsCuts(struct rd_cart *carts[],
|
||||
const char hostname[],
|
||||
const char username[],
|
||||
const char passwd[],
|
||||
const char ticket[],
|
||||
const char group_name[],
|
||||
const char filter[],
|
||||
const char type[],
|
||||
const char user_agent[],
|
||||
unsigned *numrecs)
|
||||
{
|
||||
char url[1500];
|
||||
CURL *curl=NULL;
|
||||
XML_Parser parser;
|
||||
struct xml_data xml_data;
|
||||
long response_code;
|
||||
char errbuf[CURL_ERROR_SIZE];
|
||||
CURLcode res;
|
||||
char user_agent_string[255];
|
||||
struct curl_httppost *first=NULL;
|
||||
struct curl_httppost *last=NULL;
|
||||
|
||||
/* Set number of recs so if fail already set */
|
||||
*numrecs = 0;
|
||||
|
||||
if((curl=curl_easy_init())==NULL) {
|
||||
curl_easy_cleanup(curl);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup the CURL call
|
||||
*/
|
||||
memset(&xml_data,0,sizeof(xml_data));
|
||||
xml_data.cart_ptr=-1;
|
||||
parser=XML_ParserCreate(NULL);
|
||||
XML_SetUserData(parser,&xml_data);
|
||||
XML_SetElementHandler(parser,__ListCartsCutsElementStart,
|
||||
__ListCartsCutsElementEnd);
|
||||
XML_SetCharacterDataHandler(parser,__ListCartsCutsElementData);
|
||||
snprintf(url,1500,"http://%s/rd-bin/rdxport.cgi",hostname);
|
||||
|
||||
curl_formadd(&first,
|
||||
&last,
|
||||
CURLFORM_PTRNAME,
|
||||
"COMMAND",
|
||||
CURLFORM_COPYCONTENTS,
|
||||
"6",
|
||||
CURLFORM_END);
|
||||
|
||||
curl_formadd(&first,
|
||||
&last,
|
||||
CURLFORM_PTRNAME,
|
||||
"LOGIN_NAME",
|
||||
CURLFORM_COPYCONTENTS,
|
||||
username,
|
||||
CURLFORM_END);
|
||||
|
||||
curl_formadd(&first,
|
||||
&last,
|
||||
CURLFORM_PTRNAME,
|
||||
"PASSWORD",
|
||||
CURLFORM_COPYCONTENTS,
|
||||
passwd,
|
||||
CURLFORM_END);
|
||||
|
||||
curl_formadd(&first,
|
||||
&last,
|
||||
CURLFORM_PTRNAME,
|
||||
"TICKET",
|
||||
CURLFORM_COPYCONTENTS,
|
||||
ticket,
|
||||
CURLFORM_END);
|
||||
|
||||
curl_formadd(&first,
|
||||
&last,
|
||||
CURLFORM_PTRNAME,
|
||||
"GROUP_NAME",
|
||||
CURLFORM_COPYCONTENTS,
|
||||
group_name,
|
||||
CURLFORM_END);
|
||||
|
||||
curl_formadd(&first,
|
||||
&last,
|
||||
CURLFORM_PTRNAME,
|
||||
"FILTER",
|
||||
CURLFORM_COPYCONTENTS,
|
||||
filter,
|
||||
CURLFORM_END);
|
||||
|
||||
curl_formadd(&first,
|
||||
&last,
|
||||
CURLFORM_PTRNAME,
|
||||
"TYPE",
|
||||
CURLFORM_COPYCONTENTS,
|
||||
type,
|
||||
CURLFORM_END);
|
||||
|
||||
curl_formadd(&first,
|
||||
&last,
|
||||
CURLFORM_PTRNAME,
|
||||
"INCLUDE_CUTS",
|
||||
CURLFORM_PTRCONTENTS,
|
||||
"1",
|
||||
CURLFORM_END);
|
||||
|
||||
// Check if User Agent Present otherwise set to default
|
||||
if (strlen(user_agent)> 0){
|
||||
curl_easy_setopt(curl, CURLOPT_USERAGENT,user_agent);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(user_agent_string, RD_GetUserAgent());
|
||||
strcat(user_agent_string,VERSION);
|
||||
curl_easy_setopt(curl, CURLOPT_USERAGENT,user_agent_string);
|
||||
}
|
||||
|
||||
curl_easy_setopt(curl,CURLOPT_WRITEDATA,parser);
|
||||
curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,__ListCartsCutsCallback);
|
||||
curl_easy_setopt(curl,CURLOPT_URL,url);
|
||||
curl_easy_setopt(curl,CURLOPT_POST,1);
|
||||
curl_easy_setopt(curl,CURLOPT_HTTPPOST,first);
|
||||
curl_easy_setopt(curl,CURLOPT_NOPROGRESS,1);
|
||||
curl_easy_setopt(curl,CURLOPT_ERRORBUFFER,errbuf);
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
if(res != CURLE_OK) {
|
||||
#ifdef RIVC_DEBUG_OUT
|
||||
size_t len = strlen(errbuf);
|
||||
fprintf(stderr, "\nlibcurl error: (%d)", res);
|
||||
if (len)
|
||||
fprintf(stderr, "%s%s", errbuf,
|
||||
((errbuf[len-1] != '\n') ? "\n" : ""));
|
||||
else
|
||||
fprintf(stderr, "%s\n", curl_easy_strerror(res));
|
||||
#endif
|
||||
curl_easy_cleanup(curl);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* The response OK - so figure out if we got what we wanted.. */
|
||||
|
||||
curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE,&response_code);
|
||||
curl_formfree(first);
|
||||
curl_easy_cleanup(curl);
|
||||
|
||||
if (response_code > 199 && response_code < 300) {
|
||||
*carts=xml_data.carts;
|
||||
*numrecs = xml_data.cart_ptr+1;
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
#ifdef RIVC_DEBUG_OUT
|
||||
fprintf(stderr," rd_listcartscuts Call Returned Error: %s\n",xml_data.strbuf);
|
||||
#endif
|
||||
return (int)response_code;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct rd_cut *RD_ListCartsCuts_GetCut(struct rd_cart carts[],int cart_rec,
|
||||
int cut_rec)
|
||||
{
|
||||
return
|
||||
(struct rd_cut *)(((struct rd_cart *)(carts)+cart_rec)->cart_cuts)+cut_rec;
|
||||
}
|
||||
|
||||
|
||||
void RD_ListCartsCuts_Free(struct rd_cart carts[],int numrecs)
|
||||
{
|
||||
int i;
|
||||
struct rd_cut *cut=NULL;
|
||||
|
||||
for(i=0;i<numrecs;i++) {
|
||||
if(carts[i].cart_cuts!=NULL) {
|
||||
free(carts[i].cart_cuts);
|
||||
}
|
||||
}
|
||||
free(carts);
|
||||
}
|
48
apis/rivwebcapi/rivwebcapi/rd_listcartscuts.h
Normal file
48
apis/rivwebcapi/rivwebcapi/rd_listcartscuts.h
Normal file
@ -0,0 +1,48 @@
|
||||
/* rd_listcartscuts.h
|
||||
*
|
||||
* Header for the ListCartsCuts Rivendell Access Library
|
||||
*
|
||||
* (C) Copyright 2015 Todd Baker <bakert@rfa.org>
|
||||
* (C) Copyright 2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef RD_LISTCARTSCUTS_H
|
||||
#define RD_LISTCARTSCUTS_H
|
||||
|
||||
#include <rivwebcapi/rd_common.h>
|
||||
|
||||
_MYRIVLIB_INIT_DECL
|
||||
|
||||
#include <rivwebcapi/rd_cart.h>
|
||||
|
||||
int RD_ListCartsCuts(struct rd_cart *carts[],
|
||||
const char hostname[],
|
||||
const char username[],
|
||||
const char passwd[],
|
||||
const char ticket[],
|
||||
const char group_name[],
|
||||
const char filter[],
|
||||
const char type[],
|
||||
const char user_agent[],
|
||||
unsigned *numrecs);
|
||||
struct rd_cut *RD_ListCartsCuts_GetCut(struct rd_cart carts[],int cart_rec,
|
||||
int cut_rec);
|
||||
void RD_ListCartsCuts_Free(struct rd_cart carts[],int numrecs);
|
||||
|
||||
_MYRIVLIB_FINI_DECL
|
||||
|
||||
|
||||
#endif // RD_LISTCARTSCUTS_H
|
@ -43,6 +43,7 @@ noinst_PROGRAMS = addcart_test \
|
||||
listcart_test \
|
||||
listcartcuts_test \
|
||||
listcarts_test \
|
||||
listcartscuts_test \
|
||||
listcartschedcodes_test \
|
||||
listgroup_test \
|
||||
listgroups_test \
|
||||
@ -117,6 +118,9 @@ listcartcuts_test_LDADD = -lrivwebcapi -lexpat -lcurl -lm
|
||||
dist_listcarts_test_SOURCES = listcarts_test.c
|
||||
listcarts_test_LDADD = -lrivwebcapi -lexpat -lcurl -lm
|
||||
|
||||
dist_listcartscuts_test_SOURCES = listcartscuts_test.c
|
||||
listcartscuts_test_LDADD = -lrivwebcapi -lexpat -lcurl -lm
|
||||
|
||||
dist_listcartschedcodes_test_SOURCES = listcartschedcodes_test.c
|
||||
listcartschedcodes_test_LDADD = -lrivwebcapi -lexpat -lcurl -lm
|
||||
|
||||
|
305
apis/rivwebcapi/tests/listcartscuts_test.c
Normal file
305
apis/rivwebcapi/tests/listcartscuts_test.c
Normal file
@ -0,0 +1,305 @@
|
||||
/* listcartscuts_test.c
|
||||
*
|
||||
* Test the listcartscuts library.
|
||||
*
|
||||
* (C) Copyright 2015 Todd Baker <bakert@rfa.org>
|
||||
* (C) Copyright 2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <rivwebcapi/rd_listcartscuts.h>
|
||||
#include <rivwebcapi/rd_createticket.h>
|
||||
#include <rivwebcapi/rd_getuseragent.h>
|
||||
#include <rivwebcapi/rd_getversion.h>
|
||||
|
||||
void dump_datetime(const char *label,struct tm *tm)
|
||||
{
|
||||
printf(" %s year value: %d\n",label,tm->tm_year);
|
||||
printf(" %s mon value: %d\n",label,tm->tm_mon);
|
||||
printf(" %s day value: %d\n",label,tm->tm_mday);
|
||||
printf(" %s wday value: %d\n",label,tm->tm_wday);
|
||||
printf(" %s hour value: %d\n",label,tm->tm_hour);
|
||||
printf(" %s min value: %d\n",label,tm->tm_min);
|
||||
printf(" %s sec value: %d\n",label,tm->tm_sec);
|
||||
printf(" %s isdst: %d\n",label,tm->tm_isdst);
|
||||
}
|
||||
|
||||
|
||||
void dump_cut(struct rd_cut *cut)
|
||||
{
|
||||
printf("Cut %04u:\n",cut->cut_cut_number);
|
||||
printf(" Cut Name: %s\n",cut->cut_name);
|
||||
printf(" Evergreen: %d\n",cut->cut_evergreen);
|
||||
printf(" Description: %s\n",cut->cut_description);
|
||||
printf(" Outcue: %s\n",cut->cut_outcue);
|
||||
printf(" ISRC: %s\n",cut->cut_isrc);
|
||||
printf(" ISCI: %s\n",cut->cut_isci);
|
||||
printf(" Length: %u\n",cut->cut_length);
|
||||
dump_datetime("Origin Datetime",&cut->cut_origin_datetime);
|
||||
dump_datetime("Origin Datetime",&cut->cut_origin_datetime);
|
||||
dump_datetime(" Start Datetime",&cut->cut_start_datetime);
|
||||
dump_datetime(" End Datetime",&cut->cut_end_datetime);
|
||||
printf(" Sunday: %d\n",cut->cut_sun);
|
||||
printf(" Monday: %d\n",cut->cut_mon);
|
||||
printf(" Tuesday: %d\n",cut->cut_tue);
|
||||
printf(" Wednesday: %d\n",cut->cut_wed);
|
||||
printf(" Thursday: %d\n",cut->cut_thu);
|
||||
printf(" Friday: %d\n",cut->cut_fri);
|
||||
printf(" Saturday: %d\n",cut->cut_sat);
|
||||
printf(" Start Daypart: %s\n",cut->cut_start_daypart);
|
||||
printf(" End Daypart: %s\n",cut->cut_end_daypart);
|
||||
printf(" Origin Name: %s\n",cut->cut_origin_name);
|
||||
printf(" Origin Login Name: %s\n",cut->cut_origin_login_name);
|
||||
printf(" Source Hostname: %s\n",cut->cut_source_hostname);
|
||||
printf(" Weight: %u\n",cut->cut_weight);
|
||||
dump_datetime("Last Play Datetime",&cut->cut_last_play_datetime);
|
||||
printf(" Play Counter: %u\n",cut->cut_play_counter);
|
||||
printf(" Coding Format: %u\n",cut->cut_coding_format);
|
||||
printf(" Sample Rate: %u\n",cut->cut_sample_rate);
|
||||
printf(" Bit Rate: %u\n",cut->cut_bit_rate);
|
||||
printf(" Channels: %u\n",cut->cut_channels);
|
||||
printf(" Play Gain: %d\n",cut->cut_play_gain);
|
||||
printf(" Start Point: %d\n",cut->cut_start_point);
|
||||
printf(" End Point: %d\n",cut->cut_end_point);
|
||||
printf(" Fade Up Point: %d\n",cut->cut_start_point);
|
||||
printf(" Fade Down Point: %d\n",cut->cut_end_point);
|
||||
printf(" Segue Start Point: %d\n",cut->cut_segue_start_point);
|
||||
printf(" Segue End Point: %d\n",cut->cut_segue_end_point);
|
||||
printf(" Segue Gain: %d\n",cut->cut_segue_gain);
|
||||
printf(" Hook Start Point: %d\n",cut->cut_hook_start_point);
|
||||
printf(" Hook End Point: %d\n",cut->cut_hook_end_point);
|
||||
printf(" Talk Start Point: %d\n",cut->cut_talk_start_point);
|
||||
printf(" Talk End Point: %d\n",cut->cut_talk_end_point);
|
||||
}
|
||||
|
||||
|
||||
void dump_cart(struct rd_cart *cart)
|
||||
{
|
||||
printf(" Cart Number: %d\n",cart->cart_number);
|
||||
printf(" Cart Type: %d\n",cart->cart_type);
|
||||
printf(" Group Name: %s\n",cart->cart_grp_name);
|
||||
printf(" Cart Title: %s\n",cart->cart_title);
|
||||
printf(" Cart Artist: %s\n",cart->cart_artist);
|
||||
printf(" Cart Album: %s\n",cart->cart_album);
|
||||
printf(" Cart Year: %d\n",cart->cart_year);
|
||||
printf(" Cart Label: %s\n",cart->cart_label);
|
||||
printf(" Cart Client: %s\n",cart->cart_client);
|
||||
printf(" Cart Agency: %s\n",cart->cart_agency);
|
||||
printf(" Cart Publisher: %s\n",cart->cart_publisher);
|
||||
printf(" Cart Composer: %s\n",cart->cart_composer);
|
||||
printf(" Cart Conductor: %s\n",cart->cart_conductor);
|
||||
printf(" Cart User Defined: %s\n",cart->cart_user_defined);
|
||||
printf(" Cart Usage Code: %d\n",cart->cart_usage_code);
|
||||
printf(" Cart Forced Length: %d\n",cart->cart_forced_length);
|
||||
printf(" Cart Average Length: %d\n",cart->cart_average_length);
|
||||
printf(" Cart Length Deviation: %d\n",cart->cart_length_deviation);
|
||||
printf("Cart Average Segue Length: %d\n",cart->cart_average_segue_length);
|
||||
printf(" Cart Average Hook Length: %d\n",cart->cart_average_hook_length);
|
||||
printf(" Cart Cut Quantity: %u\n",cart->cart_cut_quantity);
|
||||
printf(" Cart Last Cut Played: %03u\n",cart->cart_last_cut_played);
|
||||
printf(" Cart Validity: %u\n",cart->cart_validity);
|
||||
printf(" Cart Enforce Length: %d\n",cart->cart_enforce_length);
|
||||
printf(" Cart Asyncronous: %d\n",cart->cart_asyncronous);
|
||||
printf(" Cart Owner: %s\n",cart->cart_owner);
|
||||
dump_datetime("Cart Metadata",&cart->cart_metadata_datetime);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
struct rd_cart *carts=0;
|
||||
unsigned numrecs;
|
||||
char *host;
|
||||
char *user;
|
||||
char *passwd;
|
||||
char ticket[41]="";
|
||||
char user_agent[255]={0};
|
||||
|
||||
/* Get the Rivendell Host, User and Password if set in env */
|
||||
if (getenv("RIVHOST")!=NULL) {
|
||||
host = getenv("RIVHOST");
|
||||
}
|
||||
else {
|
||||
host="localhost";
|
||||
}
|
||||
|
||||
if (getenv("RIVUSER")!=NULL) {
|
||||
user = getenv("RIVUSER");
|
||||
}
|
||||
else {
|
||||
user="USER";
|
||||
}
|
||||
|
||||
if (getenv("RIVPASS")!=NULL) {
|
||||
passwd = getenv("RIVPASS");
|
||||
}
|
||||
else {
|
||||
passwd = "";
|
||||
}
|
||||
|
||||
// Add the User Agent and Version
|
||||
strcat(user_agent,RD_GetUserAgent());
|
||||
strcat(user_agent,RD_GetVersion());
|
||||
strcat(user_agent," (Test Suite)");
|
||||
|
||||
//
|
||||
// Call the function
|
||||
//
|
||||
int result= RD_ListCartsCuts(&carts,
|
||||
host,
|
||||
user,
|
||||
passwd,
|
||||
ticket,
|
||||
"",
|
||||
"",
|
||||
"Audio",
|
||||
user_agent,
|
||||
&numrecs);
|
||||
if(result<0) {
|
||||
fprintf(stderr,"Error: Web function Failure!\n");
|
||||
exit(256);
|
||||
}
|
||||
|
||||
if ((result< 200 || result > 299) &&
|
||||
(result != 0))
|
||||
{
|
||||
switch(result) {
|
||||
case 403:
|
||||
fprintf(stderr,"ERROR: Invalid User Authentification \n");
|
||||
break;
|
||||
|
||||
case 404:
|
||||
fprintf(stderr,"ERROR: No Such Group Exists! \n");
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "Unknown Error occurred ==> %d\n",result);
|
||||
}
|
||||
exit(256);
|
||||
}
|
||||
//
|
||||
// List the results
|
||||
//
|
||||
for(i=0;i<numrecs;i++) {
|
||||
dump_cart(&carts[i]);
|
||||
printf("\n");
|
||||
/*
|
||||
for(j=0;j<carts[i].cart_cut_quantity;j++) {
|
||||
dump_cut(RD_ListCartCuts_GetCut(&carts[i],j));
|
||||
printf("\n");
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
//
|
||||
// Free the cart list when finished with it
|
||||
//
|
||||
RD_ListCartsCuts_Free(carts,numrecs);
|
||||
|
||||
|
||||
// Add test of create_ticket function
|
||||
|
||||
struct rd_ticketinfo *myticket=0;
|
||||
numrecs=0;
|
||||
|
||||
result = RD_CreateTicket( &myticket,
|
||||
host,
|
||||
user,
|
||||
passwd,
|
||||
user_agent,
|
||||
&numrecs);
|
||||
|
||||
if ((result< 200 || result > 299) &&
|
||||
(result != 0))
|
||||
{
|
||||
switch(result) {
|
||||
case 403:
|
||||
fprintf(stderr," ERROR: Invalid User Information During Create Ticket\n");
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unknown Error occurred ==> %d\n",result);
|
||||
}
|
||||
exit(256);
|
||||
}
|
||||
|
||||
// We got a ticket created - use it and do the call again
|
||||
//
|
||||
// List the Results
|
||||
//
|
||||
for(i=0;i<numrecs;i++) {
|
||||
printf(" Ticket: %s\n",myticket[i].ticket);
|
||||
dump_datetime("Ticket Expire",&myticket->tkt_expiration_datetime);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
user="";
|
||||
passwd="";
|
||||
strcpy( ticket,myticket->ticket);
|
||||
fprintf(stderr, "Ticket was copied - = %s\n",ticket);
|
||||
//
|
||||
// Call the function
|
||||
//
|
||||
result= RD_ListCartsCuts(&carts,
|
||||
host,
|
||||
user,
|
||||
passwd,
|
||||
ticket,
|
||||
"",
|
||||
"",
|
||||
"Audio",
|
||||
user_agent,
|
||||
&numrecs);
|
||||
if(result<0) {
|
||||
fprintf(stderr,"Error: Web function Failure!\n");
|
||||
exit(256);
|
||||
}
|
||||
|
||||
if ((result< 200 || result > 299) &&
|
||||
(result != 0))
|
||||
{
|
||||
switch(result) {
|
||||
case 403:
|
||||
fprintf(stderr," ERROR: Invalid User Information During Create Ticket\n");
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unknown Error occurred ==> %d\n",result);
|
||||
}
|
||||
exit(256);
|
||||
}
|
||||
//
|
||||
// List the results
|
||||
//
|
||||
for(i=0;i<numrecs;i++) {
|
||||
dump_cart(&carts[i]);
|
||||
printf("\n");
|
||||
for(j=0;j<carts[i].cart_cut_quantity;j++) {
|
||||
dump_cut(RD_ListCartsCuts_GetCut(carts,i,j));
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Free the cart list when finished with it
|
||||
//
|
||||
RD_ListCartsCuts_Free(carts,numrecs);
|
||||
|
||||
exit(0);
|
||||
}
|
@ -97,6 +97,9 @@ all-local: rd_addcart.html\
|
||||
rd_listcarts.html\
|
||||
rd_listcarts.pdf\
|
||||
rd_listcarts.xml\
|
||||
rd_listcartscuts.html\
|
||||
rd_listcartscuts.pdf\
|
||||
rd_listcartscuts.xml\
|
||||
rd_listcuts.html\
|
||||
rd_listcuts.pdf\
|
||||
rd_listcuts.xml\
|
||||
@ -161,6 +164,7 @@ man_MANS = rd_addcart.7\
|
||||
rd_listcart.7\
|
||||
rd_listcartcuts.7\
|
||||
rd_listcarts.7\
|
||||
rd_listcartscuts.7\
|
||||
rd_listcuts.7\
|
||||
rd_listcut.7\
|
||||
rd_listgroups.7\
|
||||
@ -253,13 +257,19 @@ EXTRA_DIST = rd_addcart.7\
|
||||
rd_listcart.7\
|
||||
rd_listcart.html\
|
||||
rd_listcart.pdf\
|
||||
rd_listcart.xml\
|
||||
rd_listcartcuts.7\
|
||||
rd_listcartcuts.html\
|
||||
rd_listcartcuts.pdf\
|
||||
rd_listcartcuts.xml\
|
||||
rd_listcarts.7\
|
||||
rd_listcarts.html\
|
||||
rd_listcarts.pdf\
|
||||
rd_listcarts.xml\
|
||||
rd_listcartscuts.7\
|
||||
rd_listcartscuts.html\
|
||||
rd_listcartscuts.pdf\
|
||||
rd_listcartscuts.xml\
|
||||
rd_listcart.xml\
|
||||
rd_listcuts.7\
|
||||
rd_listcuts.html\
|
||||
|
300
docs/rivwebcapi/rd_listcartscuts.xml
Normal file
300
docs/rivwebcapi/rd_listcartscuts.xml
Normal file
@ -0,0 +1,300 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<refentry id="stdin" xmlns="http://docbook.org/ns/docbook" version="5.0">
|
||||
<!--
|
||||
Header
|
||||
-->
|
||||
<refmeta>
|
||||
<refentrytitle>RD_ListCartsCuts</refentrytitle>
|
||||
<manvolnum>7</manvolnum>
|
||||
<refmiscinfo class='source'>October 2018</refmiscinfo>
|
||||
<refmiscinfo class='manual'>Rivendell C Library Manual</refmiscinfo>
|
||||
</refmeta>
|
||||
<refnamediv>
|
||||
<refname>rd_listcartscuts</refname>
|
||||
<refpurpose>Rivendell List Cart/Cuts C Library Function</refpurpose>
|
||||
</refnamediv>
|
||||
<info>
|
||||
<author>
|
||||
<personname>
|
||||
<firstname>Todd</firstname>
|
||||
<surname>Baker</surname>
|
||||
<email>bakert@rfa.org</email>
|
||||
</personname>
|
||||
<contrib>Rivendell C Library Author</contrib>
|
||||
</author>
|
||||
</info>
|
||||
|
||||
<!--
|
||||
Body
|
||||
-->
|
||||
<refsynopsisdiv id='synopsis'>
|
||||
<funcsynopsis>
|
||||
<funcsynopsisinfo>#include <rivwebcapi/rd_listcartscuts.h></funcsynopsisinfo>
|
||||
<funcprototype>
|
||||
<funcdef>int <function>RD_ListCartsCuts</function></funcdef>
|
||||
<paramdef> struct rd_cart * <parameter>cart[]</parameter></paramdef>
|
||||
<paramdef>const char <parameter>hostname[]</parameter></paramdef>
|
||||
<paramdef>const char <parameter>username[]</parameter></paramdef>
|
||||
<paramdef>const char <parameter>passwd[]</parameter></paramdef>
|
||||
<paramdef>const char <parameter>ticket[]</parameter></paramdef>
|
||||
<paramdef>const char <parameter>group_name[]</parameter></paramdef>
|
||||
<paramdef>const char <parameter>filter[]</parameter></paramdef>
|
||||
<paramdef>const char <parameter>type[]</parameter></paramdef>
|
||||
<paramdef>const char <parameter>user_agent[]</parameter></paramdef>
|
||||
<paramdef>unsigned * <parameter>numrecs</parameter></paramdef>
|
||||
</funcprototype>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>struct rd_cut *<function>RD_ListCartsCuts_GetCut</function></funcdef>
|
||||
<paramdef> struct rd_cart <parameter>carts[]</parameter></paramdef>
|
||||
<paramdef>int <parameter>cart_rec</parameter></paramdef>
|
||||
<paramdef>int <parameter>cut_rec</parameter></paramdef>
|
||||
</funcprototype>
|
||||
|
||||
<funcprototype>
|
||||
<funcdef>void <function>RD_ListCartsCuts_Free</function></funcdef>
|
||||
<paramdef> struct rd_cart <parameter>carts[]</parameter></paramdef>
|
||||
<paramdef> unsigned <parameter>numrecs</parameter></paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1 id='description'><title>Description</title>
|
||||
<para>
|
||||
This function lists the fields in one or more pre-existing cart(s).
|
||||
The user can also filter the records by group name, cart type, and/or a
|
||||
user provided search string.
|
||||
Unlike <command>RD_ListCarts</command><manvolnum>7</manvolnum>,
|
||||
<command>RD_ListCartsCuts</command><manvolnum>7</manvolnum> will
|
||||
also fetch the full list of cuts associated with each cart.
|
||||
</para>
|
||||
<table xml:id="ex.listcartscuts" frame="all">
|
||||
<title>RD_ListCartsCuts function call fields</title>
|
||||
<tgroup cols="4" align="left" colsep="1" rowsep="1">
|
||||
<colspec colname="FIELD NAME" />
|
||||
<colspec colname="FIELD TYPE" />
|
||||
<colspec colname="MEANING" />
|
||||
<colspec colname="REMARKS" />
|
||||
<thead>
|
||||
<row>
|
||||
<entry>
|
||||
FIELD NAME
|
||||
</entry>
|
||||
<entry>
|
||||
FIELD TYPE
|
||||
</entry>
|
||||
<entry>
|
||||
MEANING
|
||||
</entry>
|
||||
<entry>
|
||||
REMARKS
|
||||
</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>
|
||||
*cart
|
||||
</entry>
|
||||
<entry>
|
||||
Pointer to rd_cart structure
|
||||
</entry>
|
||||
<entry>
|
||||
Memory location to store cart information
|
||||
</entry>
|
||||
<entry>
|
||||
Mandatory
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
hostname
|
||||
</entry>
|
||||
<entry>
|
||||
Character Array
|
||||
</entry>
|
||||
<entry>
|
||||
Name Of Rivendell DB Host
|
||||
</entry>
|
||||
<entry>
|
||||
Mandatory
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
username
|
||||
</entry>
|
||||
<entry>
|
||||
Character Array
|
||||
</entry>
|
||||
<entry>
|
||||
Rivendell User Name
|
||||
</entry>
|
||||
<entry>
|
||||
Mandatory When NO Ticket Provided
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
passwd
|
||||
</entry>
|
||||
<entry>
|
||||
Character Array
|
||||
</entry>
|
||||
<entry>
|
||||
Rivendell User Password
|
||||
</entry>
|
||||
<entry>
|
||||
Mandatory When NO Ticket Provided
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
ticket
|
||||
</entry>
|
||||
<entry>
|
||||
Character Array
|
||||
</entry>
|
||||
<entry>
|
||||
Rivendell Authentification Ticket
|
||||
</entry>
|
||||
<entry>
|
||||
Mandatory When NO User/Password Pair Provided.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
group_name
|
||||
</entry>
|
||||
<entry>
|
||||
character array
|
||||
</entry>
|
||||
<entry>
|
||||
Group Name
|
||||
</entry>
|
||||
<entry>
|
||||
Optional
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
filter
|
||||
</entry>
|
||||
<entry>
|
||||
character array
|
||||
</entry>
|
||||
<entry>
|
||||
Filter - searches for specific strings within the following fields: Title, Artist, Client, Agency, Album, Label, Publisher, Composer, Conductor, Song_Id, User_Defined, and Cart Number.
|
||||
</entry>
|
||||
<entry>
|
||||
Optional
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
type
|
||||
</entry>
|
||||
<entry>
|
||||
character array
|
||||
</entry>
|
||||
<entry>
|
||||
Type of Cart records. If set can be Audio, or Macro.
|
||||
</entry>
|
||||
<entry>
|
||||
Optional
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
user_agent
|
||||
</entry>
|
||||
<entry>
|
||||
Character Array
|
||||
</entry>
|
||||
<entry>
|
||||
User Agent Value put into HTTP request
|
||||
</entry>
|
||||
<entry>
|
||||
Optional (default is Rivendell-C-API/x.x.x)
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>
|
||||
*numrecs
|
||||
</entry>
|
||||
<entry>
|
||||
pointer to integer
|
||||
</entry>
|
||||
<entry>
|
||||
memory location for number of records returned
|
||||
</entry>
|
||||
<entry>
|
||||
Mandatory
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
|
||||
<para>
|
||||
When successful the function will return the number of records sent
|
||||
(numrecs) and a rd_cart structure which
|
||||
is stored in the provided memory locations. (See the
|
||||
<command>rd_listcartcuts</command><manvolnum>7</manvolnum> man page
|
||||
for a listing of the rd_cart structure).
|
||||
</para>
|
||||
|
||||
<refsect2 id='access_cut_information'><title>Accessing Cut Information</title>
|
||||
<para>
|
||||
Information about the cuts associated with each cart can be accessed
|
||||
from the returned rd_cart structure through use of the
|
||||
<command>RD_ListCartsCuts_GetCut()</command> function.
|
||||
The <parameter>cart_rec</parameter> parameter should range between
|
||||
<userinput>0</userinput> and one less than the value returned in the
|
||||
<parameter>numrecs</parameter> argument to
|
||||
<command>RD_ListCartsCuts</command>, while
|
||||
the <parameter>cut_rec</parameter> parameter should range between
|
||||
<userinput>0</userinput> and one less than the
|
||||
value of the <parameter>cart_cut_quantity</parameter> member of the
|
||||
cart's rd_cart structure.
|
||||
</para>
|
||||
<para>
|
||||
Cut information is returned in the form of a rd_cut structure. (See the
|
||||
<command>rd_listcartcuts</command><manvolnum>7</manvolnum> man page
|
||||
for a listing of the rd_cut structure).
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id='freeing_memory'><title>Freeing Memory</title>
|
||||
<para>
|
||||
When the returned rd_cart structure is no longer required, it should
|
||||
freed by passing it to the <command>RD_ListCartsCuts_Free()</command>
|
||||
function.
|
||||
</para>
|
||||
</refsect2>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id='returns'><title>RETURN VALUE</title>
|
||||
<para>
|
||||
On success, zero is returned. Using the provided parameters an rd_cart
|
||||
structure is returned and the number of records is returned.
|
||||
</para>
|
||||
<para>
|
||||
If a server error occurs a -1 is returned.
|
||||
If a client error occurs a specific error number is returned.
|
||||
</para>
|
||||
<refsect2 id='errors'><title>Errors</title>
|
||||
<para>
|
||||
403 User Authentification Error.
|
||||
</para>
|
||||
<para>
|
||||
404 No Such Group Exists.
|
||||
</para>
|
||||
<para>
|
||||
nnn Unknown Error Occurred.
|
||||
</para>
|
||||
</refsect2>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
@ -448,6 +448,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
@LOCAL_PREFIX@/share/man/man7/rd_listcart.7.gz
|
||||
@LOCAL_PREFIX@/share/man/man7/rd_listcartcuts.7.gz
|
||||
@LOCAL_PREFIX@/share/man/man7/rd_listcarts.7.gz
|
||||
@LOCAL_PREFIX@/share/man/man7/rd_listcartscuts.7.gz
|
||||
@LOCAL_PREFIX@/share/man/man7/rd_listcartschedcodes.7.gz
|
||||
@LOCAL_PREFIX@/share/man/man7/rd_listcut.7.gz
|
||||
@LOCAL_PREFIX@/share/man/man7/rd_listcuts.7.gz
|
||||
|
Loading…
x
Reference in New Issue
Block a user