mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-04-09 14:33:28 +02:00
2020-09-23 Fred Gleason <fredg@paravelsystems.com>
* Added 'RD_PostImage()' and 'RD_RemoveImage()' calls to the rivwebcapi API. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
parent
028dd22d93
commit
ce8dcbd4f0
@ -20336,3 +20336,6 @@
|
||||
2020-09-22 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Updated screenshots in the 'RDCastManager' chapter of the
|
||||
Operations Guide.
|
||||
2020-09-23 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added 'RD_PostImage()' and 'RD_RemoveImage()' calls to the
|
||||
rivwebcapi API.
|
||||
|
@ -52,8 +52,10 @@ dist_librivwebcapi_la_SOURCES = rd_addcart.c rd_addcart.h \
|
||||
rd_listservices.c rd_listservices.h \
|
||||
rd_listschedcodes.c rd_listschedcodes.h \
|
||||
rd_listsystemsettings.c rd_listsystemsettings.h \
|
||||
rd_postimage.c rd_postimage.h \
|
||||
rd_removecart.c rd_removecart.h \
|
||||
rd_removecut.c rd_removecut.h \
|
||||
rd_removeimage.c rd_removeimage.h \
|
||||
rd_savelog.c rd_savelog.h \
|
||||
rd_trimaudio.c rd_trimaudio.h \
|
||||
rd_unassignschedcode.c rd_unassignschedcode.h
|
||||
@ -96,10 +98,12 @@ include_HEADERS = rd_addcart.h\
|
||||
rd_listschedcodes.h\
|
||||
rd_listservices.h\
|
||||
rd_listsystemsettings.h \
|
||||
rd_postimage.h \
|
||||
rd_savelog.h\
|
||||
rd_schedcodes.h\
|
||||
rd_removecart.h\
|
||||
rd_removecut.h\
|
||||
rd_removeimage.h\
|
||||
rd_trimaudio.h\
|
||||
rd_unassignschedcode.h
|
||||
|
||||
|
197
apis/rivwebcapi/rivwebcapi/rd_postimage.c
Normal file
197
apis/rivwebcapi/rivwebcapi/rd_postimage.c
Normal file
@ -0,0 +1,197 @@
|
||||
/* rd_postimage.c
|
||||
*
|
||||
* Implementation of the Post Image Rivendell Access Library
|
||||
*
|
||||
* (C) Copyright 2015 Todd Baker <bakert@rfa.org>
|
||||
* (C) Copyright 2020 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_postimage.h"
|
||||
#include "rd_common.h"
|
||||
#include "rd_getuseragent.h"
|
||||
|
||||
struct xml_data {
|
||||
char elem_name[256];
|
||||
char strbuf[1024];
|
||||
};
|
||||
|
||||
static void XMLCALL __PostImageElementStart(void *data, const char *el,
|
||||
const char **attr)
|
||||
{
|
||||
struct xml_data *xml_data=(struct xml_data *)data;
|
||||
strlcpy(xml_data->elem_name,el,256);
|
||||
memset(xml_data->strbuf,0,1024);
|
||||
}
|
||||
|
||||
static void XMLCALL __PostImageElementData(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 __PostImageElementEnd(void *data, const char *el)
|
||||
{
|
||||
struct xml_data *xml_data=(struct xml_data *)data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
size_t __PostImageCallback(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_PostImage( const char hostname[],
|
||||
const char username[],
|
||||
const char passwd[],
|
||||
const char ticket[],
|
||||
const unsigned img_id,
|
||||
const char user_agent[])
|
||||
{
|
||||
char post[1500];
|
||||
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];
|
||||
char id_buffer[21];
|
||||
struct curl_httppost *first=NULL;
|
||||
struct curl_httppost *last=NULL;
|
||||
|
||||
if((curl=curl_easy_init())==NULL) {
|
||||
curl_easy_cleanup(curl);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup the CURL call
|
||||
*/
|
||||
memset(&xml_data,0,sizeof(xml_data));
|
||||
parser=XML_ParserCreate(NULL);
|
||||
XML_SetUserData(parser,&xml_data);
|
||||
XML_SetElementHandler(parser,__PostImageElementStart,
|
||||
__PostImageElementEnd);
|
||||
XML_SetCharacterDataHandler(parser,__PostImageElementData);
|
||||
snprintf(url,1500,"http://%s/rd-bin/rdxport.cgi",hostname);
|
||||
|
||||
curl_formadd(&first,
|
||||
&last,
|
||||
CURLFORM_PTRNAME,
|
||||
"COMMAND",
|
||||
CURLFORM_COPYCONTENTS,
|
||||
"44",
|
||||
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);
|
||||
|
||||
snprintf(id_buffer,21,"%u",img_id);
|
||||
curl_formadd(&first,
|
||||
&last,
|
||||
CURLFORM_PTRNAME,
|
||||
"ID",
|
||||
CURLFORM_COPYCONTENTS,
|
||||
id_buffer,
|
||||
CURLFORM_END);
|
||||
|
||||
curl_easy_setopt(curl,CURLOPT_WRITEDATA,parser);
|
||||
curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,__PostImageCallback);
|
||||
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);
|
||||
// curl_easy_setopt(curl,CURLOPT_VERBOSE,1);
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
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_formfree(first);
|
||||
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) { //Success
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
#ifdef RIVC_DEBUG_OUT
|
||||
fprintf(stderr," rd_postimage Call Returned Error: %s\n",xml_data.strbuf);
|
||||
#endif
|
||||
return (int)response_code;
|
||||
}
|
||||
}
|
39
apis/rivwebcapi/rivwebcapi/rd_postimage.h
Normal file
39
apis/rivwebcapi/rivwebcapi/rd_postimage.h
Normal file
@ -0,0 +1,39 @@
|
||||
/* rd_postimage.h
|
||||
*
|
||||
* Header for the Post Image Rivendell Access Library
|
||||
*
|
||||
* (C) Copyright 2015 Todd Baker <bakert@rfa.org>
|
||||
* (C) Copyright 2020 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_POSTIMAGE_H
|
||||
#define RD_POSTIMAGE_H
|
||||
|
||||
#include <rivwebcapi/rd_common.h>
|
||||
|
||||
_MYRIVLIB_INIT_DECL
|
||||
|
||||
int RD_PostImage(const char hostname[],
|
||||
const char username[],
|
||||
const char passwd[],
|
||||
const char ticket[],
|
||||
const unsigned img_id,
|
||||
const char user_agent[]);
|
||||
|
||||
_MYRIVLIB_FINI_DECL
|
||||
|
||||
|
||||
#endif // RD_POSTIMAGE_H
|
197
apis/rivwebcapi/rivwebcapi/rd_removeimage.c
Normal file
197
apis/rivwebcapi/rivwebcapi/rd_removeimage.c
Normal file
@ -0,0 +1,197 @@
|
||||
/* rd_removeimage.c
|
||||
*
|
||||
* Implementation of the Remove Image Rivendell Access Library
|
||||
*
|
||||
* (C) Copyright 2015 Todd Baker <bakert@rfa.org>
|
||||
* (C) Copyright 2020 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_removeimage.h"
|
||||
#include "rd_common.h"
|
||||
#include "rd_getuseragent.h"
|
||||
|
||||
struct xml_data {
|
||||
char elem_name[256];
|
||||
char strbuf[1024];
|
||||
};
|
||||
|
||||
static void XMLCALL __RemoveImageElementStart(void *data, const char *el,
|
||||
const char **attr)
|
||||
{
|
||||
struct xml_data *xml_data=(struct xml_data *)data;
|
||||
strlcpy(xml_data->elem_name,el,256);
|
||||
memset(xml_data->strbuf,0,1024);
|
||||
}
|
||||
|
||||
static void XMLCALL __RemoveImageElementData(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 __RemoveImageElementEnd(void *data, const char *el)
|
||||
{
|
||||
struct xml_data *xml_data=(struct xml_data *)data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
size_t __RemoveImageCallback(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_RemoveImage( const char hostname[],
|
||||
const char username[],
|
||||
const char passwd[],
|
||||
const char ticket[],
|
||||
const unsigned img_id,
|
||||
const char user_agent[])
|
||||
{
|
||||
char post[1500];
|
||||
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];
|
||||
char id_buffer[21];
|
||||
struct curl_httppost *first=NULL;
|
||||
struct curl_httppost *last=NULL;
|
||||
|
||||
if((curl=curl_easy_init())==NULL) {
|
||||
curl_easy_cleanup(curl);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup the CURL call
|
||||
*/
|
||||
memset(&xml_data,0,sizeof(xml_data));
|
||||
parser=XML_ParserCreate(NULL);
|
||||
XML_SetUserData(parser,&xml_data);
|
||||
XML_SetElementHandler(parser,__RemoveImageElementStart,
|
||||
__RemoveImageElementEnd);
|
||||
XML_SetCharacterDataHandler(parser,__RemoveImageElementData);
|
||||
snprintf(url,1500,"http://%s/rd-bin/rdxport.cgi",hostname);
|
||||
|
||||
curl_formadd(&first,
|
||||
&last,
|
||||
CURLFORM_PTRNAME,
|
||||
"COMMAND",
|
||||
CURLFORM_COPYCONTENTS,
|
||||
"45",
|
||||
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);
|
||||
|
||||
snprintf(id_buffer,21,"%u",img_id);
|
||||
curl_formadd(&first,
|
||||
&last,
|
||||
CURLFORM_PTRNAME,
|
||||
"ID",
|
||||
CURLFORM_COPYCONTENTS,
|
||||
id_buffer,
|
||||
CURLFORM_END);
|
||||
|
||||
curl_easy_setopt(curl,CURLOPT_WRITEDATA,parser);
|
||||
curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,__RemoveImageCallback);
|
||||
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);
|
||||
// curl_easy_setopt(curl,CURLOPT_VERBOSE,1);
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
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_formfree(first);
|
||||
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) { //Success
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
#ifdef RIVC_DEBUG_OUT
|
||||
fprintf(stderr," rd_removeimage Call Returned Error: %s\n",xml_data.strbuf);
|
||||
#endif
|
||||
return (int)response_code;
|
||||
}
|
||||
}
|
39
apis/rivwebcapi/rivwebcapi/rd_removeimage.h
Normal file
39
apis/rivwebcapi/rivwebcapi/rd_removeimage.h
Normal file
@ -0,0 +1,39 @@
|
||||
/* rd_removeimage.h
|
||||
*
|
||||
* Header for the Remove Image Rivendell Access Library
|
||||
*
|
||||
* (C) Copyright 2015 Todd Baker <bakert@rfa.org>
|
||||
* (C) Copyright 2020 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_REMOVEIMAGE_H
|
||||
#define RD_REMOVEIMAGE_H
|
||||
|
||||
#include <rivwebcapi/rd_common.h>
|
||||
|
||||
_MYRIVLIB_INIT_DECL
|
||||
|
||||
int RD_RemoveImage(const char hostname[],
|
||||
const char username[],
|
||||
const char passwd[],
|
||||
const char ticket[],
|
||||
const unsigned img_id,
|
||||
const char user_agent[]);
|
||||
|
||||
_MYRIVLIB_FINI_DECL
|
||||
|
||||
|
||||
#endif // RD_REMOVEIMAGE_H
|
@ -52,8 +52,10 @@ noinst_PROGRAMS = addcart_test \
|
||||
listschedcodes_test \
|
||||
listservices_test \
|
||||
listsystemsettings_test \
|
||||
postimage_test \
|
||||
removecart_test \
|
||||
removecut_test \
|
||||
removeimage_test \
|
||||
savelog_test \
|
||||
trimaudio_test \
|
||||
unassignschedcode_test
|
||||
@ -151,12 +153,18 @@ listservices_test_LDADD = -lrivwebcapi -lexpat -lcurl -lm
|
||||
dist_listsystemsettings_test_SOURCES = listsystemsettings_test.c
|
||||
listsystemsettings_test_LDADD = -lrivwebcapi -lexpat -lcurl -lm
|
||||
|
||||
dist_postimage_test_SOURCES = postimage_test.c
|
||||
postimage_test_LDADD = -lrivwebcapi -lexpat -lcurl -lm
|
||||
|
||||
dist_removecart_test_SOURCES = removecart_test.c
|
||||
removecart_test_LDADD = -lrivwebcapi -lexpat -lcurl -lm
|
||||
|
||||
dist_removecut_test_SOURCES = removecut_test.c
|
||||
removecut_test_LDADD = -lrivwebcapi -lexpat -lcurl -lm
|
||||
|
||||
dist_removeimage_test_SOURCES = removeimage_test.c
|
||||
removeimage_test_LDADD = -lrivwebcapi -lexpat -lcurl -lm
|
||||
|
||||
dist_savelog_test_SOURCES = savelog_test.c common.c common.h
|
||||
savelog_test_LDADD = -lrivwebcapi -lexpat -lcurl -lm
|
||||
|
||||
|
205
apis/rivwebcapi/tests/postimage_test.c
Normal file
205
apis/rivwebcapi/tests/postimage_test.c
Normal file
@ -0,0 +1,205 @@
|
||||
/* postimage_test.c
|
||||
*
|
||||
* Test the post RSS image library.
|
||||
*
|
||||
* (C) Copyright 2020 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_postimage.h>
|
||||
#include <rivwebcapi/rd_createticket.h>
|
||||
#include <rivwebcapi/rd_getuseragent.h>
|
||||
#include <rivwebcapi/rd_getversion.h>
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
|
||||
char buf[BUFSIZ];
|
||||
char *p;
|
||||
long int img_id=0;
|
||||
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 = "";
|
||||
}
|
||||
|
||||
printf("Please enter the ID number of the RSS image that you want to Post ==> ");
|
||||
if (fgets(buf,sizeof(buf),stdin) != NULL)
|
||||
{
|
||||
img_id = strtol(buf, &p,10);
|
||||
|
||||
if ( (buf[0] != '\n') &&
|
||||
((*p != '\n') && (*p != '\0')))
|
||||
{
|
||||
fprintf(stderr," Illegal Characters detected! Exiting.\n");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
// 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_PostImage( host,
|
||||
user,
|
||||
passwd,
|
||||
ticket,
|
||||
(unsigned)img_id,
|
||||
user_agent);
|
||||
|
||||
if(result<0) {
|
||||
fprintf(stderr,"Something went wrong!\n");
|
||||
exit(256);
|
||||
}
|
||||
|
||||
if ((result< 200 || result > 299) &&
|
||||
(result != 0))
|
||||
{
|
||||
switch(result) {
|
||||
case 404:
|
||||
fprintf(stderr,"ERROR: No Such Image Exists! \n");
|
||||
break;
|
||||
case 401:
|
||||
fprintf(stderr, "ERROR: Unauthorized \n");
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unknown Error occurred ==> %d",result);
|
||||
}
|
||||
exit(256);
|
||||
}
|
||||
|
||||
//
|
||||
// List the Results
|
||||
//
|
||||
printf(" Image: %ld was successfully posted!\n",img_id);
|
||||
printf("\n");
|
||||
|
||||
// Add test of create_ticket function
|
||||
|
||||
int i;
|
||||
struct rd_ticketinfo *myticket=0;
|
||||
unsigned 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);
|
||||
printf("Ticket Expire year value = %d\n",myticket->tkt_expiration_datetime.tm_year);
|
||||
printf("Ticket Expire month value = %d\n",myticket->tkt_expiration_datetime.tm_mon);
|
||||
printf("Ticket Expire day value = %d\n",myticket->tkt_expiration_datetime.tm_mday);
|
||||
printf("Ticket Expire wday value = %d\n",myticket->tkt_expiration_datetime.tm_wday);
|
||||
printf("Ticket Expire hour value = %d\n",myticket->tkt_expiration_datetime.tm_hour);
|
||||
printf("Ticket Expire min value = %d\n",myticket->tkt_expiration_datetime.tm_min);
|
||||
printf("Ticket Expire sec value = %d\n",myticket->tkt_expiration_datetime.tm_sec);
|
||||
printf("Ticket Expire isdst value = %d\n",myticket->tkt_expiration_datetime.tm_isdst);
|
||||
printf("\n");
|
||||
|
||||
}
|
||||
|
||||
user="";
|
||||
passwd="";
|
||||
strcpy( ticket,myticket->ticket);
|
||||
fprintf(stderr, "Ticket was copied - = %s\n",ticket);
|
||||
//
|
||||
// Call the function
|
||||
//
|
||||
result=RD_PostImage( host,
|
||||
user,
|
||||
passwd,
|
||||
ticket,
|
||||
(unsigned)img_id,
|
||||
user_agent);
|
||||
|
||||
if(result<0) {
|
||||
fprintf(stderr,"Something went wrong!\n");
|
||||
exit(256);
|
||||
}
|
||||
|
||||
if ((result< 200 || result > 299) &&
|
||||
(result != 0))
|
||||
{
|
||||
switch(result) {
|
||||
case 404:
|
||||
fprintf(stderr,"ERROR: No Image Exists! \n");
|
||||
break;
|
||||
case 401:
|
||||
fprintf(stderr, "ERROR: Unauthorized\n");
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unknown Error occurred ==> %d",result);
|
||||
}
|
||||
exit(256);
|
||||
}
|
||||
|
||||
//
|
||||
// List the Results
|
||||
//
|
||||
printf(" Image: %ld was successfully deleted!\n",img_id);
|
||||
printf("\n");
|
||||
|
||||
exit(0);
|
||||
}
|
205
apis/rivwebcapi/tests/removeimage_test.c
Normal file
205
apis/rivwebcapi/tests/removeimage_test.c
Normal file
@ -0,0 +1,205 @@
|
||||
/* removeimage_test.c
|
||||
*
|
||||
* Test the post RSS image library.
|
||||
*
|
||||
* (C) Copyright 2020 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_removeimage.h>
|
||||
#include <rivwebcapi/rd_createticket.h>
|
||||
#include <rivwebcapi/rd_getuseragent.h>
|
||||
#include <rivwebcapi/rd_getversion.h>
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
|
||||
char buf[BUFSIZ];
|
||||
char *p;
|
||||
long int img_id=0;
|
||||
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 = "";
|
||||
}
|
||||
|
||||
printf("Please enter the ID number of the RSS image that you want to Post ==> ");
|
||||
if (fgets(buf,sizeof(buf),stdin) != NULL)
|
||||
{
|
||||
img_id = strtol(buf, &p,10);
|
||||
|
||||
if ( (buf[0] != '\n') &&
|
||||
((*p != '\n') && (*p != '\0')))
|
||||
{
|
||||
fprintf(stderr," Illegal Characters detected! Exiting.\n");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
// 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_RemoveImage( host,
|
||||
user,
|
||||
passwd,
|
||||
ticket,
|
||||
(unsigned)img_id,
|
||||
user_agent);
|
||||
|
||||
if(result<0) {
|
||||
fprintf(stderr,"Something went wrong!\n");
|
||||
exit(256);
|
||||
}
|
||||
|
||||
if ((result< 200 || result > 299) &&
|
||||
(result != 0))
|
||||
{
|
||||
switch(result) {
|
||||
case 404:
|
||||
fprintf(stderr,"ERROR: No Such Image Exists! \n");
|
||||
break;
|
||||
case 401:
|
||||
fprintf(stderr, "ERROR: Unauthorized \n");
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unknown Error occurred ==> %d",result);
|
||||
}
|
||||
exit(256);
|
||||
}
|
||||
|
||||
//
|
||||
// List the Results
|
||||
//
|
||||
printf(" Image: %ld was successfully posted!\n",img_id);
|
||||
printf("\n");
|
||||
|
||||
// Add test of create_ticket function
|
||||
|
||||
int i;
|
||||
struct rd_ticketinfo *myticket=0;
|
||||
unsigned 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);
|
||||
printf("Ticket Expire year value = %d\n",myticket->tkt_expiration_datetime.tm_year);
|
||||
printf("Ticket Expire month value = %d\n",myticket->tkt_expiration_datetime.tm_mon);
|
||||
printf("Ticket Expire day value = %d\n",myticket->tkt_expiration_datetime.tm_mday);
|
||||
printf("Ticket Expire wday value = %d\n",myticket->tkt_expiration_datetime.tm_wday);
|
||||
printf("Ticket Expire hour value = %d\n",myticket->tkt_expiration_datetime.tm_hour);
|
||||
printf("Ticket Expire min value = %d\n",myticket->tkt_expiration_datetime.tm_min);
|
||||
printf("Ticket Expire sec value = %d\n",myticket->tkt_expiration_datetime.tm_sec);
|
||||
printf("Ticket Expire isdst value = %d\n",myticket->tkt_expiration_datetime.tm_isdst);
|
||||
printf("\n");
|
||||
|
||||
}
|
||||
|
||||
user="";
|
||||
passwd="";
|
||||
strcpy( ticket,myticket->ticket);
|
||||
fprintf(stderr, "Ticket was copied - = %s\n",ticket);
|
||||
//
|
||||
// Call the function
|
||||
//
|
||||
result=RD_RemoveImage( host,
|
||||
user,
|
||||
passwd,
|
||||
ticket,
|
||||
(unsigned)img_id,
|
||||
user_agent);
|
||||
|
||||
if(result<0) {
|
||||
fprintf(stderr,"Something went wrong!\n");
|
||||
exit(256);
|
||||
}
|
||||
|
||||
if ((result< 200 || result > 299) &&
|
||||
(result != 0))
|
||||
{
|
||||
switch(result) {
|
||||
case 404:
|
||||
fprintf(stderr,"ERROR: No Image Exists! \n");
|
||||
break;
|
||||
case 401:
|
||||
fprintf(stderr, "ERROR: Unauthorized\n");
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unknown Error occurred ==> %d",result);
|
||||
}
|
||||
exit(256);
|
||||
}
|
||||
|
||||
//
|
||||
// List the Results
|
||||
//
|
||||
printf(" Image: %ld was successfully deleted!\n",img_id);
|
||||
printf("\n");
|
||||
|
||||
exit(0);
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
##
|
||||
## docs/rivwebcapi/Makefile.am for Rivendell C API
|
||||
##
|
||||
## (C) Copyright 2015-2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
## (C) Copyright 2015-2020 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
|
||||
@ -127,12 +127,18 @@ all-local: rd_addcart.html\
|
||||
rd_listsystemsettings.html\
|
||||
rd_listsystemsettings.pdf\
|
||||
rd_listsystemsettings.xml\
|
||||
rd_postimage.html\
|
||||
rd_postimage.pdf\
|
||||
rd_postimage.xml\
|
||||
rd_removecart.html\
|
||||
rd_removecart.pdf\
|
||||
rd_removecart.xml\
|
||||
rd_removecut.html\
|
||||
rd_removecut.pdf\
|
||||
rd_removecut.xml\
|
||||
rd_removeimage.html\
|
||||
rd_removeimage.pdf\
|
||||
rd_removecut.xml\
|
||||
rd_savelog.html\
|
||||
rd_savelog.pdf\
|
||||
rd_savelog.xml\
|
||||
@ -174,8 +180,10 @@ man_MANS = rd_addcart.7\
|
||||
rd_listschedcodes.7\
|
||||
rd_listservices.7\
|
||||
rd_listsystemsettings.7\
|
||||
rd_postimage.7\
|
||||
rd_removecart.7\
|
||||
rd_removecut.7\
|
||||
rd_removeimage.7\
|
||||
rd_savelog.7\
|
||||
rd_trimaudio.7\
|
||||
rd_unassignschedcode.7
|
||||
@ -307,6 +315,10 @@ EXTRA_DIST = rd_addcart.7\
|
||||
rd_listsystemsettings.html\
|
||||
rd_listsystemsettings.pdf\
|
||||
rd_listsystemsettings.xml\
|
||||
rd_postimage.7\
|
||||
rd_postimage.html\
|
||||
rd_postimage.pdf\
|
||||
rd_postimage.xml\
|
||||
rd_removecart.7\
|
||||
rd_removecart.html\
|
||||
rd_removecart.pdf\
|
||||
@ -315,6 +327,10 @@ EXTRA_DIST = rd_addcart.7\
|
||||
rd_removecut.html\
|
||||
rd_removecut.pdf\
|
||||
rd_removecut.xml\
|
||||
rd_removeimage.7\
|
||||
rd_removeimage.html\
|
||||
rd_removeimage.pdf\
|
||||
rd_removeimage.xml\
|
||||
rd_savelog.7\
|
||||
rd_savelog.html\
|
||||
rd_savelog.pdf\
|
||||
|
189
docs/rivwebcapi/rd_postimage.xml
Normal file
189
docs/rivwebcapi/rd_postimage.xml
Normal file
@ -0,0 +1,189 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<refentry id="stdin" xmlns="http://docbook.org/ns/docbook" version="5.0">
|
||||
<!--
|
||||
Header
|
||||
-->
|
||||
<refmeta>
|
||||
<refentrytitle>RD_PostImage</refentrytitle>
|
||||
<manvolnum>7</manvolnum>
|
||||
<refmiscinfo class='source'>September 2020</refmiscinfo>
|
||||
<refmiscinfo class='manual'>Rivendell C Library Manual</refmiscinfo>
|
||||
</refmeta>
|
||||
<refnamediv>
|
||||
<refname>rd_postimage</refname>
|
||||
<refpurpose>Rivendell Remove Cut C Library Function</refpurpose>
|
||||
</refnamediv>
|
||||
<info>
|
||||
<author>
|
||||
<personname>
|
||||
<firstname>Fred</firstname>
|
||||
<surname>Gleason</surname>
|
||||
<email>fredg@paravelsystems.com</email>
|
||||
</personname>
|
||||
<contrib>Rivendell C Library Author</contrib>
|
||||
</author>
|
||||
</info>
|
||||
|
||||
<!--
|
||||
Body
|
||||
-->
|
||||
<refsynopsisdiv id='synopsis'>
|
||||
<funcsynopsis>
|
||||
<funcsynopsisinfo>#include <rivwebcapi/rd_postimage.h></funcsynopsisinfo>
|
||||
<funcprototype>
|
||||
<funcdef>int <function>RD_PostImage</function></funcdef>
|
||||
<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 unsigned <parameter>img_id</parameter></paramdef>
|
||||
<paramdef>const char <parameter>user_agent[]</parameter></paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1 id='description'><title>Description</title>
|
||||
<para>
|
||||
<command>RD_PostImage</command> is the function to use
|
||||
to post an RSS image from the Rivendell database to the remote RSS
|
||||
repository.
|
||||
</para>
|
||||
<table xml:id="ex.postimage" frame="all">
|
||||
<title>RD_PostImage 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>
|
||||
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>
|
||||
img_id
|
||||
</entry>
|
||||
<entry>
|
||||
unsigned integer
|
||||
</entry>
|
||||
<entry>
|
||||
Image ID
|
||||
</entry>
|
||||
<entry>
|
||||
Mandatory
|
||||
</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>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
|
||||
</refsect1>
|
||||
<refsect2 id='returns'><title>RETURN VALUE</title>
|
||||
<para>
|
||||
On success, zero 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>
|
||||
<refsect3 id='errors'><title>ERRORS</title>
|
||||
<para>
|
||||
400 Missing Image ID
|
||||
</para>
|
||||
<para>
|
||||
403 User Authentification Error.
|
||||
</para>
|
||||
<para>
|
||||
404 Unauthorized or No Such Image
|
||||
</para>
|
||||
<para>
|
||||
nnn Unknown Error Occurred.
|
||||
</para>
|
||||
</refsect3>
|
||||
|
||||
</refentry>
|
188
docs/rivwebcapi/rd_removeimage.xml
Normal file
188
docs/rivwebcapi/rd_removeimage.xml
Normal file
@ -0,0 +1,188 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<refentry id="stdin" xmlns="http://docbook.org/ns/docbook" version="5.0">
|
||||
<!--
|
||||
Header
|
||||
-->
|
||||
<refmeta>
|
||||
<refentrytitle>RD_RemoveImage</refentrytitle>
|
||||
<manvolnum>7</manvolnum>
|
||||
<refmiscinfo class='source'>September 2020</refmiscinfo>
|
||||
<refmiscinfo class='manual'>Rivendell C Library Manual</refmiscinfo>
|
||||
</refmeta>
|
||||
<refnamediv>
|
||||
<refname>rd_removeimage</refname>
|
||||
<refpurpose>Rivendell Remove Cut C Library Function</refpurpose>
|
||||
</refnamediv>
|
||||
<info>
|
||||
<author>
|
||||
<personname>
|
||||
<firstname>Fred</firstname>
|
||||
<surname>Gleason</surname>
|
||||
<email>fredg@paravelsystems.com</email>
|
||||
</personname>
|
||||
<contrib>Rivendell C Library Author</contrib>
|
||||
</author>
|
||||
</info>
|
||||
|
||||
<!--
|
||||
Body
|
||||
-->
|
||||
<refsynopsisdiv id='synopsis'>
|
||||
<funcsynopsis>
|
||||
<funcsynopsisinfo>#include <rivwebcapi/rd_removeimage.h></funcsynopsisinfo>
|
||||
<funcprototype>
|
||||
<funcdef>int <function>RD_RemoveImage</function></funcdef>
|
||||
<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 unsigned <parameter>img_id</parameter></paramdef>
|
||||
<paramdef>const char <parameter>user_agent[]</parameter></paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1 id='description'><title>Description</title>
|
||||
<para>
|
||||
<command>RD_RemoveImage</command> is the function to use
|
||||
to remve an RSS image from the remote RSS repository.
|
||||
</para>
|
||||
<table xml:id="ex.postimage" frame="all">
|
||||
<title>RD_RemoveImage 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>
|
||||
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>
|
||||
img_id
|
||||
</entry>
|
||||
<entry>
|
||||
unsigned integer
|
||||
</entry>
|
||||
<entry>
|
||||
Image ID
|
||||
</entry>
|
||||
<entry>
|
||||
Mandatory
|
||||
</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>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
|
||||
</refsect1>
|
||||
<refsect2 id='returns'><title>RETURN VALUE</title>
|
||||
<para>
|
||||
On success, zero 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>
|
||||
<refsect3 id='errors'><title>ERRORS</title>
|
||||
<para>
|
||||
400 Missing Image ID
|
||||
</para>
|
||||
<para>
|
||||
403 User Authentification Error.
|
||||
</para>
|
||||
<para>
|
||||
404 Unauthorized or No Such Image
|
||||
</para>
|
||||
<para>
|
||||
nnn Unknown Error Occurred.
|
||||
</para>
|
||||
</refsect3>
|
||||
|
||||
</refentry>
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* Public Interface for the RDXport Service
|
||||
*
|
||||
* (C) Copyright 2010 Fred Gleason <fredg@paravelsystems.com>
|
||||
* (C) Copyright 2010-2020 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
|
||||
|
@ -490,8 +490,10 @@ rm -rf $RPM_BUILD_ROOT
|
||||
@LOCAL_PREFIX@/share/man/man7/rd_listschedcodes.7.gz
|
||||
@LOCAL_PREFIX@/share/man/man7/rd_listservices.7.gz
|
||||
@LOCAL_PREFIX@/share/man/man7/rd_listsystemsettings.7.gz
|
||||
@LOCAL_PREFIX@/share/man/man7/rd_postimage.7.gz
|
||||
@LOCAL_PREFIX@/share/man/man7/rd_removecart.7.gz
|
||||
@LOCAL_PREFIX@/share/man/man7/rd_removecut.7.gz
|
||||
@LOCAL_PREFIX@/share/man/man7/rd_removeimage.7.gz
|
||||
@LOCAL_PREFIX@/share/man/man7/rd_savelog.7.gz
|
||||
@LOCAL_PREFIX@/share/man/man7/rd_trimaudio.7.gz
|
||||
@LOCAL_PREFIX@/share/man/man7/rd_unassignschedcode.7.gz
|
||||
|
Loading…
x
Reference in New Issue
Block a user