mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-14 22:51:13 +02:00
2020-09-23 Fred Gleason <fredg@paravelsystems.com>
* Added 'RD_PostPodcast()', 'RDRemovePodcast()' and 'RD_SavePodcast()' calls to the rivwebcapi API. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
## automake.am
|
||||
##
|
||||
## (C) Copyright 2015 Todd Baker <bakert@rfa.org>
|
||||
## (C) Copyright 2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
## (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
|
||||
@@ -53,12 +53,16 @@ noinst_PROGRAMS = addcart_test \
|
||||
listservices_test \
|
||||
listsystemsettings_test \
|
||||
postimage_test \
|
||||
postpodcast_test \
|
||||
postrss_test \
|
||||
postpodcast_test \
|
||||
removecart_test \
|
||||
removecut_test \
|
||||
removeimage_test \
|
||||
removepodcast_test \
|
||||
removerss_test \
|
||||
savelog_test \
|
||||
savepodcast_test \
|
||||
trimaudio_test \
|
||||
unassignschedcode_test
|
||||
|
||||
@@ -158,9 +162,15 @@ listsystemsettings_test_LDADD = -lrivwebcapi -lexpat -lcurl -lm
|
||||
dist_postimage_test_SOURCES = postimage_test.c
|
||||
postimage_test_LDADD = -lrivwebcapi -lexpat -lcurl -lm
|
||||
|
||||
dist_postpodcast_test_SOURCES = postpodcast_test.c
|
||||
postpodcast_test_LDADD = -lrivwebcapi -lexpat -lcurl -lm
|
||||
|
||||
dist_postrss_test_SOURCES = postrss_test.c
|
||||
postrss_test_LDADD = -lrivwebcapi -lexpat -lcurl -lm
|
||||
|
||||
dist_postpodcast_test_SOURCES = postpodcast_test.c
|
||||
postpodcast_test_LDADD = -lrivwebcapi -lexpat -lcurl -lm
|
||||
|
||||
dist_removecart_test_SOURCES = removecart_test.c
|
||||
removecart_test_LDADD = -lrivwebcapi -lexpat -lcurl -lm
|
||||
|
||||
@@ -170,12 +180,18 @@ removecut_test_LDADD = -lrivwebcapi -lexpat -lcurl -lm
|
||||
dist_removeimage_test_SOURCES = removeimage_test.c
|
||||
removeimage_test_LDADD = -lrivwebcapi -lexpat -lcurl -lm
|
||||
|
||||
dist_removepodcast_test_SOURCES = removepodcast_test.c
|
||||
removepodcast_test_LDADD = -lrivwebcapi -lexpat -lcurl -lm
|
||||
|
||||
dist_removerss_test_SOURCES = removerss_test.c
|
||||
removerss_test_LDADD = -lrivwebcapi -lexpat -lcurl -lm
|
||||
|
||||
dist_savelog_test_SOURCES = savelog_test.c common.c common.h
|
||||
savelog_test_LDADD = -lrivwebcapi -lexpat -lcurl -lm
|
||||
|
||||
dist_savepodcast_test_SOURCES = savepodcast_test.c common.c common.h
|
||||
savepodcast_test_LDADD = -lrivwebcapi -lexpat -lcurl -lm
|
||||
|
||||
dist_trimaudio_test_SOURCES = trimaudio_test.c
|
||||
trimaudio_test_LDADD = -lrivwebcapi -lexpat -lcurl -lm
|
||||
|
||||
|
205
apis/rivwebcapi/tests/postpodcast_test.c
Normal file
205
apis/rivwebcapi/tests/postpodcast_test.c
Normal file
@@ -0,0 +1,205 @@
|
||||
/* postpodcast_test.c
|
||||
*
|
||||
* Test the post RSS item audio 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_createticket.h>
|
||||
#include <rivwebcapi/rd_getuseragent.h>
|
||||
#include <rivwebcapi/rd_getversion.h>
|
||||
#include <rivwebcapi/rd_postpodcast.h>
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
|
||||
char buf[BUFSIZ];
|
||||
char *p;
|
||||
long int cast_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 podcast item that you want to Post ==> ");
|
||||
if (fgets(buf,sizeof(buf),stdin) != NULL)
|
||||
{
|
||||
cast_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_PostPodcast(host,
|
||||
user,
|
||||
passwd,
|
||||
ticket,
|
||||
(unsigned)cast_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 podcast item 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(" Podcast: %ld was successfully posted!\n",cast_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_PostPodcast( host,
|
||||
user,
|
||||
passwd,
|
||||
ticket,
|
||||
(unsigned)cast_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 podcast item 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(" Podcast item: %ld was successfully deleted!\n",cast_id);
|
||||
printf("\n");
|
||||
|
||||
exit(0);
|
||||
}
|
205
apis/rivwebcapi/tests/removepodcast_test.c
Normal file
205
apis/rivwebcapi/tests/removepodcast_test.c
Normal file
@@ -0,0 +1,205 @@
|
||||
/* removepodcast_test.c
|
||||
*
|
||||
* Test the remove podcast 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_createticket.h>
|
||||
#include <rivwebcapi/rd_getuseragent.h>
|
||||
#include <rivwebcapi/rd_getversion.h>
|
||||
#include <rivwebcapi/rd_removepodcast.h>
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
|
||||
char buf[BUFSIZ];
|
||||
char *p;
|
||||
long int cast_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 podcast item that you want to remove ==> ");
|
||||
if (fgets(buf,sizeof(buf),stdin) != NULL)
|
||||
{
|
||||
cast_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_RemovePodcast( host,
|
||||
user,
|
||||
passwd,
|
||||
ticket,
|
||||
(unsigned)cast_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(" Podcast item: %ld was successfully removed!\n",cast_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_RemovePodcast(host,
|
||||
user,
|
||||
passwd,
|
||||
ticket,
|
||||
(unsigned)cast_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(" Podcast item: %ld was successfully removed!\n",cast_id);
|
||||
printf("\n");
|
||||
|
||||
exit(0);
|
||||
}
|
@@ -60,7 +60,7 @@ int main(int argc,char *argv[])
|
||||
passwd = "";
|
||||
}
|
||||
|
||||
printf("Please enter the ID number of the RSS feed that you want to Post ==> ");
|
||||
printf("Please enter the ID number of the RSS feed that you want to remove ==> ");
|
||||
if (fgets(buf,sizeof(buf),stdin) != NULL)
|
||||
{
|
||||
feed_id = strtol(buf, &p,10);
|
||||
@@ -112,7 +112,7 @@ int main(int argc,char *argv[])
|
||||
//
|
||||
// List the Results
|
||||
//
|
||||
printf(" Feed: %ld was successfully posted!\n",feed_id);
|
||||
printf(" Feed: %ld was successfully removed!\n",feed_id);
|
||||
printf("\n");
|
||||
|
||||
// Add test of create_ticket function
|
||||
|
210
apis/rivwebcapi/tests/savepodcast_test.c
Normal file
210
apis/rivwebcapi/tests/savepodcast_test.c
Normal file
@@ -0,0 +1,210 @@
|
||||
/* import_test.c
|
||||
*
|
||||
* Test the Save RSS item audio API 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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <rivwebcapi/rd_createticket.h>
|
||||
#include <rivwebcapi/rd_getuseragent.h>
|
||||
#include <rivwebcapi/rd_getversion.h>
|
||||
#include <rivwebcapi/rd_savepodcast.h>
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
|
||||
int i;
|
||||
char buf[BUFSIZ];
|
||||
char *p;
|
||||
long int cast_id=0;
|
||||
char filename[BUFSIZ];
|
||||
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 Podcast ID Number that you want to save to ==> ");
|
||||
if (fgets(buf,sizeof(buf),stdin) != NULL)
|
||||
{
|
||||
cast_id = strtol(buf, &p,10);
|
||||
|
||||
if ( (buf[0] != '\n') &&
|
||||
((*p != '\n') && (*p != '\0')))
|
||||
{
|
||||
fprintf(stderr," Illegal Characters detected! Exiting.\n");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
printf("Please enter the File Name that you want to save ==> ");
|
||||
if (fgets(filename,sizeof(filename),stdin) != NULL)
|
||||
{
|
||||
if((0xFF&filename[strlen(filename)-1])<32) {
|
||||
filename[strlen(filename)-1]=0;
|
||||
}
|
||||
}
|
||||
|
||||
// Add the Rivendell-C-API Version
|
||||
strcat(user_agent,RD_GetUserAgent());
|
||||
strcat(user_agent,RD_GetVersion());
|
||||
strcat(user_agent," (Test Suite)");
|
||||
|
||||
//
|
||||
// Call the function
|
||||
//
|
||||
int result= RD_SavePodcast(host,
|
||||
user,
|
||||
passwd,
|
||||
ticket,
|
||||
(unsigned)cast_id,
|
||||
filename,
|
||||
user_agent);
|
||||
if(result<0) {
|
||||
fprintf(stderr,"Something went wrong! Result Code = %d\n",result);
|
||||
exit(256);
|
||||
}
|
||||
|
||||
if ((result< 200 || result > 299) &&
|
||||
(result != 0))
|
||||
{
|
||||
switch(result) {
|
||||
case 404:
|
||||
fprintf(stderr,"ERROR: no such podcast item \n");
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "Unknown Error occurred ==> %d",result);
|
||||
break;
|
||||
}
|
||||
exit(256);
|
||||
}
|
||||
|
||||
//
|
||||
// List the results
|
||||
//
|
||||
printf(" Podcast item: %ld was successfully saved!\n",cast_id);
|
||||
|
||||
|
||||
// Add test of create_ticket function
|
||||
|
||||
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);
|
||||
|
||||
result=RD_SavePodcast(host,
|
||||
user,
|
||||
passwd,
|
||||
ticket,
|
||||
(unsigned)cast_id,
|
||||
filename,
|
||||
user_agent);
|
||||
|
||||
if(result<0) {
|
||||
fprintf(stderr,"Something went wrong! Result Code = %d\n",result);
|
||||
exit(256);
|
||||
}
|
||||
|
||||
if ((result< 200 || result > 299) &&
|
||||
(result != 0))
|
||||
{
|
||||
switch(result) {
|
||||
case 404:
|
||||
fprintf(stderr,"ERROR: no such podcast item \n");
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "Unknown Error occurred ==> %d",result);
|
||||
break;
|
||||
}
|
||||
exit(256);
|
||||
}
|
||||
|
||||
//
|
||||
// List the results
|
||||
//
|
||||
printf(" Podcast item: %ld was successfully saved!\n",cast_id);
|
||||
|
||||
exit(0);
|
||||
}
|
Reference in New Issue
Block a user