mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-05-28 14:42:34 +02:00
2017-04-20 Fred Gleason <fredg@paravelsystems.com>
* Added a '--enable-rdxport-debug' switch to 'configure.ac'.
This commit is contained in:
parent
e803cb40bc
commit
7cf2b5b2f7
@ -15747,3 +15747,5 @@
|
||||
'rdlogin/rdlogin.cpp'.
|
||||
2017-04-18 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Incremented the package version to 2.15.3int03.
|
||||
2017-04-20 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added a '--enable-rdxport-debug' switch to 'configure.ac'.
|
||||
|
11
configure.ac
11
configure.ac
@ -80,8 +80,10 @@ AC_ARG_ENABLE(lame,[ --disable-lame disable MPEG Layer 3 encode suppor
|
||||
[LAME_DISABLED=yes],[])
|
||||
AC_ARG_ENABLE(flac,[ --disable-flac disable FLAC encode/decode support],
|
||||
[FLAC_DISABLED=yes],[])
|
||||
AC_ARG_ENABLE(mp4v2,[ --disable-mp4 disable M4A decode support],
|
||||
AC_ARG_ENABLE(mp4v2,[ --disable-mp4 disable M4A decode support],
|
||||
[MP4V2_DISABLED=yes],[])
|
||||
AC_ARG_ENABLE(rdxport-debug,[ --enable-rdxport-debug enable DEBUG support for RDXport services],
|
||||
[RDXPORT_DEBUG_ENABLED=yes],[])
|
||||
|
||||
#
|
||||
# Check for Qt
|
||||
@ -242,6 +244,13 @@ if test -z $DOCBOOK_DISABLED ; then
|
||||
fi
|
||||
AM_CONDITIONAL([DOCBOOK_AM], [test "$USING_DOCBOOK" = yes])
|
||||
|
||||
#
|
||||
# RDXport Debug
|
||||
#
|
||||
if test $RDXPORT_DEBUG_ENABLED ; then
|
||||
AC_DEFINE(RDXPORT_DEBUG)
|
||||
fi
|
||||
|
||||
#
|
||||
# Set Hard Library Dependencies
|
||||
#
|
||||
|
@ -41,18 +41,18 @@ void Xport::AudioInfo()
|
||||
//
|
||||
int cartnum=0;
|
||||
if(!xport_post->getValue("CART_NUMBER",&cartnum)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
XmlExit("Missing CART_NUMBER",400,"audioinfo.cpp",LINE_NUMBER);
|
||||
}
|
||||
int cutnum=0;
|
||||
if(!xport_post->getValue("CUT_NUMBER",&cutnum)) {
|
||||
XmlExit("Missing CUT_NUMBER",400);
|
||||
XmlExit("Missing CUT_NUMBER",400,"audioinfo.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->cartAuthorized(cartnum)) {
|
||||
XmlExit("No such cart",404);
|
||||
XmlExit("No such cart",404,"audioinfo.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
@ -60,7 +60,7 @@ void Xport::AudioInfo()
|
||||
//
|
||||
RDWaveFile *wave=new RDWaveFile(RDCut::pathName(cartnum,cutnum));
|
||||
if(!wave->openWave()) {
|
||||
XmlExit("No such audio",404);
|
||||
XmlExit("No such audio",404,"audioinfo.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
@ -94,7 +94,7 @@ void Xport::AudioInfo()
|
||||
break;
|
||||
|
||||
default:
|
||||
XmlExit("Unknown audio format",400);
|
||||
XmlExit("Unknown audio format",400,"audioinfo.cpp",LINE_NUMBER);
|
||||
break;
|
||||
}
|
||||
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
|
||||
|
@ -39,7 +39,7 @@ void Xport::AudioStore()
|
||||
|
||||
memset(&stat,0,sizeof(stat));
|
||||
if(statvfs(xport_config->audioRoot(),&stat)<0) {
|
||||
XmlExit("Internal Error",400);
|
||||
XmlExit("Internal Error",400,"audiostore.cpp",LINE_NUMBER);
|
||||
}
|
||||
printf("Content-type: application/xml\n");
|
||||
printf("Status: 200\n\n");
|
||||
|
@ -48,10 +48,10 @@ void Xport::AddCart()
|
||||
// Verify Post
|
||||
//
|
||||
if(!xport_post->getValue("GROUP_NAME",&group_name)) {
|
||||
XmlExit("Missing GROUP_NAME",400);
|
||||
XmlExit("Missing GROUP_NAME",400,"carts.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(!xport_post->getValue("TYPE",&type)) {
|
||||
XmlExit("Missing TYPE",400);
|
||||
XmlExit("Missing TYPE",400,"carts.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(type.lower()=="audio") {
|
||||
cart_type=RDCart::Audio;
|
||||
@ -61,7 +61,7 @@ void Xport::AddCart()
|
||||
cart_type=RDCart::Macro;
|
||||
}
|
||||
else {
|
||||
XmlExit("Invalid TYPE",400);
|
||||
XmlExit("Invalid TYPE",400,"carts.cpp",LINE_NUMBER);
|
||||
}
|
||||
}
|
||||
xport_post->getValue("CART_NUMBER",&cart_number);
|
||||
@ -70,22 +70,22 @@ void Xport::AddCart()
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->groupAuthorized(group_name)) {
|
||||
XmlExit("No such group",404);
|
||||
XmlExit("No such group",404,"carts.cpp",LINE_NUMBER);
|
||||
}
|
||||
group=new RDGroup(group_name);
|
||||
if(cart_number==0) {
|
||||
if((cart_number=group->nextFreeCart())==0) {
|
||||
delete group;
|
||||
XmlExit("No free carts in group",500);
|
||||
XmlExit("No free carts in group",500,"carts.cpp",LINE_NUMBER);
|
||||
}
|
||||
}
|
||||
if(!group->cartNumberValid(cart_number)) {
|
||||
delete group;
|
||||
XmlExit("Cart number out of range for group",404);
|
||||
XmlExit("Cart number out of range for group",404,"carts.cpp",LINE_NUMBER);
|
||||
}
|
||||
delete group;
|
||||
if(!xport_user->createCarts()) {
|
||||
XmlExit("Forbidden",404);
|
||||
XmlExit("Forbidden",404,"carts.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
@ -94,11 +94,11 @@ void Xport::AddCart()
|
||||
cart=new RDCart(cart_number);
|
||||
if(cart->exists()) {
|
||||
delete cart;
|
||||
XmlExit("Cart already exists",400);
|
||||
XmlExit("Cart already exists",400,"carts.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(!cart->create(group_name,cart_type)) {
|
||||
delete cart;
|
||||
XmlExit("Unable to create cart",500);
|
||||
XmlExit("Unable to create cart",500,"carts.cpp",LINE_NUMBER);
|
||||
}
|
||||
printf("Content-type: application/xml\n");
|
||||
printf("Status: 200\n\n");
|
||||
@ -155,7 +155,7 @@ void Xport::ListCarts()
|
||||
q=new RDSqlQuery(sql);
|
||||
if(!q->first()) {
|
||||
delete q;
|
||||
XmlExit("No such group",404);
|
||||
XmlExit("No such group",404,"carts.cpp",LINE_NUMBER);
|
||||
}
|
||||
where=RDCartSearchText(filter,group_name,"",false);
|
||||
}
|
||||
@ -192,7 +192,7 @@ void Xport::ListCart()
|
||||
// Verify Post
|
||||
//
|
||||
if(!xport_post->getValue("CART_NUMBER",&cart_number)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
XmlExit("Missing CART_NUMBER",400,"carts.cpp",LINE_NUMBER);
|
||||
}
|
||||
xport_post->getValue("INCLUDE_CUTS",&include_cuts);
|
||||
|
||||
@ -200,7 +200,7 @@ void Xport::ListCart()
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->cartAuthorized(cart_number)) {
|
||||
XmlExit("No such cart",404);
|
||||
XmlExit("No such cart",404,"carts.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
@ -238,7 +238,7 @@ void Xport::EditCart()
|
||||
// Verify Post
|
||||
//
|
||||
if(!xport_post->getValue("CART_NUMBER",&cart_number)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
XmlExit("Missing CART_NUMBER",400,"carts.cpp",LINE_NUMBER);
|
||||
}
|
||||
xport_post->getValue("INCLUDE_CUTS",&include_cuts);
|
||||
|
||||
@ -246,25 +246,25 @@ void Xport::EditCart()
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->cartAuthorized(cart_number)) {
|
||||
XmlExit("No such cart",404);
|
||||
XmlExit("No such cart",404,"carts.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(!xport_user->modifyCarts()) {
|
||||
XmlExit("Unauthorized",404);
|
||||
XmlExit("Unauthorized",404,"carts.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(xport_post->getValue("GROUP_NAME",&group_name)) {
|
||||
if(!xport_user->groupAuthorized(group_name)) {
|
||||
XmlExit("No such group",404);
|
||||
XmlExit("No such group",404,"carts.cpp",LINE_NUMBER);
|
||||
}
|
||||
group=new RDGroup(group_name);
|
||||
if(!group->exists()) {
|
||||
delete group;
|
||||
XmlExit("No such group",404);
|
||||
XmlExit("No such group",404,"carts.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(group->enforceCartRange()) {
|
||||
if(((unsigned)cart_number<group->defaultLowCart())||
|
||||
((unsigned)cart_number>group->defaultHighCart())) {
|
||||
delete group;
|
||||
XmlExit("Invalid cart number for group",409);
|
||||
XmlExit("Invalid cart number for group",409,"carts.cpp",LINE_NUMBER);
|
||||
}
|
||||
}
|
||||
delete group;
|
||||
@ -276,17 +276,17 @@ void Xport::EditCart()
|
||||
cart=new RDCart(cart_number);
|
||||
if(!cart->exists()) {
|
||||
delete cart;
|
||||
XmlExit("No such cart",404);
|
||||
XmlExit("No such cart",404,"carts.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(xport_post->getValue("FORCED_LENGTH",&value)) {
|
||||
number=RDSetTimeLength(value);
|
||||
if(cart->type()==RDCart::Macro) {
|
||||
delete cart;
|
||||
XmlExit("Unsupported operation for cart type",400);
|
||||
XmlExit("Unsupported operation for cart type",400,"carts.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(!cart->validateLengths(number)) {
|
||||
delete cart;
|
||||
XmlExit("Forced length out of range",400);
|
||||
XmlExit("Forced length out of range",400,"carts.cpp",LINE_NUMBER);
|
||||
}
|
||||
}
|
||||
switch(cart->type()) {
|
||||
@ -299,7 +299,7 @@ void Xport::EditCart()
|
||||
value.stripWhiteSpace();
|
||||
if(value.right(1)!="!") {
|
||||
delete cart;
|
||||
XmlExit("Invalid macro data",400);
|
||||
XmlExit("Invalid macro data",400,"carts.cpp",LINE_NUMBER);
|
||||
}
|
||||
macro+=value;
|
||||
}
|
||||
@ -403,17 +403,17 @@ void Xport::RemoveCart()
|
||||
// Verify Post
|
||||
//
|
||||
if(!xport_post->getValue("CART_NUMBER",&cart_number)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
XmlExit("Missing CART_NUMBER",400,"carts.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->cartAuthorized(cart_number)) {
|
||||
XmlExit("No such cart",404);
|
||||
XmlExit("No such cart",404,"carts.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(!xport_user->deleteCarts()) {
|
||||
XmlExit("Unauthorized",404);
|
||||
XmlExit("Unauthorized",404,"carts.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
@ -422,14 +422,14 @@ void Xport::RemoveCart()
|
||||
cart=new RDCart(cart_number);
|
||||
if(!cart->exists()) {
|
||||
delete cart;
|
||||
XmlExit("No such cart",404);
|
||||
XmlExit("No such cart",404,"carts.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(!cart->remove(NULL,NULL,xport_config)) {
|
||||
delete cart;
|
||||
XmlExit("Unable to delete cart",500);
|
||||
XmlExit("Unable to delete cart",500,"carts.cpp",LINE_NUMBER);
|
||||
}
|
||||
delete cart;
|
||||
XmlExit("OK",200);
|
||||
XmlExit("OK",200,"carts.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,30 +42,30 @@ void Xport::CopyAudio()
|
||||
//
|
||||
int source_cartnum=0;
|
||||
if(!xport_post->getValue("SOURCE_CART_NUMBER",&source_cartnum)) {
|
||||
XmlExit("Missing SOURCE_CART_NUMBER",400);
|
||||
XmlExit("Missing SOURCE_CART_NUMBER",400,"copyaudio.cpp",LINE_NUMBER);
|
||||
}
|
||||
int source_cutnum=0;
|
||||
if(!xport_post->getValue("SOURCE_CUT_NUMBER",&source_cutnum)) {
|
||||
XmlExit("Missing SOURCE_CUT_NUMBER",400);
|
||||
XmlExit("Missing SOURCE_CUT_NUMBER",400,"copyaudio.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
int destination_cartnum=0;
|
||||
if(!xport_post->getValue("DESTINATION_CART_NUMBER",&destination_cartnum)) {
|
||||
XmlExit("Missing DESTINATION_CART_NUMBER",400);
|
||||
XmlExit("Missing DESTINATION_CART_NUMBER",400,"copyaudio.cpp",LINE_NUMBER);
|
||||
}
|
||||
int destination_cutnum=0;
|
||||
if(!xport_post->getValue("DESTINATION_CUT_NUMBER",&destination_cutnum)) {
|
||||
XmlExit("Missing DESTINATION_CUT_NUMBER",400);
|
||||
XmlExit("Missing DESTINATION_CUT_NUMBER",400,"copyaudio.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->cartAuthorized(source_cartnum)) {
|
||||
XmlExit("No such cart",404);
|
||||
XmlExit("No such cart",404,"copyaudio.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(!xport_user->cartAuthorized(destination_cartnum)) {
|
||||
XmlExit("No such cart",404);
|
||||
XmlExit("No such cart",404,"copyaudio.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
@ -75,8 +75,9 @@ void Xport::CopyAudio()
|
||||
if(link(RDCut::pathName(source_cartnum,source_cutnum),
|
||||
RDCut::pathName(destination_cartnum,destination_cutnum))!=0) {
|
||||
XmlExit("dst: "+RDCut::pathName(source_cartnum,source_cutnum)+" src: "+
|
||||
RDCut::pathName(destination_cartnum,destination_cutnum),400);
|
||||
XmlExit(strerror(errno),400);
|
||||
RDCut::pathName(destination_cartnum,destination_cutnum),400,
|
||||
"copyaudio.cpp",LINE_NUMBER);
|
||||
XmlExit(strerror(errno),400,"copyaudio.cpp",LINE_NUMBER);
|
||||
}
|
||||
XmlExit("OK",200);
|
||||
XmlExit("OK",200,"copyaudio.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
@ -38,23 +38,23 @@ void Xport::DeleteAudio()
|
||||
//
|
||||
int cartnum=0;
|
||||
if(!xport_post->getValue("CART_NUMBER",&cartnum)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
XmlExit("Missing CART_NUMBER",400,"deleteaudio.cpp",LINE_NUMBER);
|
||||
}
|
||||
int cutnum=0;
|
||||
if(!xport_post->getValue("CUT_NUMBER",&cutnum)) {
|
||||
XmlExit("Missing CUT_NUMBER",400);
|
||||
XmlExit("Missing CUT_NUMBER",400,"deleteaudio.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
// Process Request
|
||||
//
|
||||
if((!xport_user->deleteCarts())&&(!xport_user->adminConfig())) {
|
||||
XmlExit("User not authorized",404);
|
||||
XmlExit("User not authorized",404,"deleteaudio.cpp",LINE_NUMBER);
|
||||
}
|
||||
RDCut *cut=new RDCut(cartnum,cutnum);
|
||||
if(!cut->exists()) {
|
||||
delete cut;
|
||||
XmlExit("No such cut",404);
|
||||
XmlExit("No such cut",404,"deleteaudio.cpp",LINE_NUMBER);
|
||||
}
|
||||
unlink(RDCut::pathName(cartnum,cutnum));
|
||||
unlink(RDCut::pathName(cartnum,cutnum)+".energy");
|
||||
@ -64,5 +64,5 @@ void Xport::DeleteAudio()
|
||||
delete q;
|
||||
syslog(LOG_NOTICE,"unlink(%s): %s",(const char *)RDCut::pathName(cartnum,cutnum),strerror(errno));
|
||||
delete cut;
|
||||
XmlExit("OK",200);
|
||||
XmlExit("OK",200,"deleteaudio.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
@ -43,60 +43,60 @@ void Xport::Export()
|
||||
//
|
||||
int cartnum=0;
|
||||
if(!xport_post->getValue("CART_NUMBER",&cartnum)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
XmlExit("Missing CART_NUMBER",400,"export.cpp",LINE_NUMBER);
|
||||
}
|
||||
int cutnum=0;
|
||||
if(!xport_post->getValue("CUT_NUMBER",&cutnum)) {
|
||||
XmlExit("Missing CUT_NUMBER",400);
|
||||
XmlExit("Missing CUT_NUMBER",400,"export.cpp",LINE_NUMBER);
|
||||
}
|
||||
int format=0;
|
||||
if(!xport_post->getValue("FORMAT",&format)) {
|
||||
XmlExit("Missing FORMAT",400);
|
||||
XmlExit("Missing FORMAT",400,"export.cpp",LINE_NUMBER);
|
||||
}
|
||||
int channels=0;
|
||||
if(!xport_post->getValue("CHANNELS",&channels)) {
|
||||
XmlExit("Missing CHANNELS",400);
|
||||
XmlExit("Missing CHANNELS",400,"export.cpp",LINE_NUMBER);
|
||||
}
|
||||
int sample_rate=0;
|
||||
if(!xport_post->getValue("SAMPLE_RATE",&sample_rate)) {
|
||||
XmlExit("Missing SAMPLE_RATE",400);
|
||||
XmlExit("Missing SAMPLE_RATE",400,"export.cpp",LINE_NUMBER);
|
||||
}
|
||||
int bit_rate=0;
|
||||
if(!xport_post->getValue("BIT_RATE",&bit_rate)) {
|
||||
XmlExit("Missing BIT_RATE",400);
|
||||
XmlExit("Missing BIT_RATE",400,"export.cpp",LINE_NUMBER);
|
||||
}
|
||||
int quality=0;
|
||||
if(!xport_post->getValue("QUALITY",&quality)) {
|
||||
XmlExit("Missing QUALITY",400);
|
||||
XmlExit("Missing QUALITY",400,"export.cpp",LINE_NUMBER);
|
||||
}
|
||||
int start_point=-1;
|
||||
if(!xport_post->getValue("START_POINT",&start_point)) {
|
||||
XmlExit("Missing START_POINT",400);
|
||||
XmlExit("Missing START_POINT",400,"export.cpp",LINE_NUMBER);
|
||||
}
|
||||
int end_point=-1;
|
||||
if(!xport_post->getValue("END_POINT",&end_point)) {
|
||||
XmlExit("Missing END_POINT",400);
|
||||
XmlExit("Missing END_POINT",400,"export.cpp",LINE_NUMBER);
|
||||
}
|
||||
int normalization_level=0;
|
||||
if(!xport_post->getValue("NORMALIZATION_LEVEL",&normalization_level)) {
|
||||
XmlExit("Missing NORMALIZATION_LEVEL",400);
|
||||
XmlExit("Missing NORMALIZATION_LEVEL",400,"export.cpp",LINE_NUMBER);
|
||||
}
|
||||
int enable_metadata=false;
|
||||
if(!xport_post->getValue("ENABLE_METADATA",&enable_metadata)) {
|
||||
XmlExit("Missing ENABLE_METADATA",400);
|
||||
XmlExit("Missing ENABLE_METADATA",400,"export.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(!RDCart::exists(cartnum)) {
|
||||
XmlExit("No such cart",404);
|
||||
XmlExit("No such cart",404,"export.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(!RDCut::exists(cartnum,cutnum)) {
|
||||
XmlExit("No such cut",404);
|
||||
XmlExit("No such cut",404,"export.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->cartAuthorized(cartnum)) {
|
||||
XmlExit("No such cart",404);
|
||||
XmlExit("No such cart",404,"export.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
@ -214,6 +214,7 @@ void Xport::Export()
|
||||
Exit(200);
|
||||
}
|
||||
else {
|
||||
XmlExit(RDAudioConvert::errorText(conv_err),resp_code,conv_err);
|
||||
XmlExit(RDAudioConvert::errorText(conv_err),resp_code,"export.cpp",
|
||||
LINE_NUMBER,conv_err);
|
||||
}
|
||||
}
|
||||
|
@ -40,18 +40,18 @@ void Xport::ExportPeaks()
|
||||
//
|
||||
int cartnum=0;
|
||||
if(!xport_post->getValue("CART_NUMBER",&cartnum)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
XmlExit("Missing CART_NUMBER",400,"exportpeaks.cpp",LINE_NUMBER);
|
||||
}
|
||||
int cutnum=0;
|
||||
if(!xport_post->getValue("CUT_NUMBER",&cutnum)) {
|
||||
XmlExit("Missing CUT_NUMBER",400);
|
||||
XmlExit("Missing CUT_NUMBER",400,"exportpeaks.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->cartAuthorized(cartnum)) {
|
||||
XmlExit("No such cart",404);
|
||||
XmlExit("No such cart",404,"exportpeaks.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
@ -59,10 +59,10 @@ void Xport::ExportPeaks()
|
||||
//
|
||||
RDWaveFile *wave=new RDWaveFile(RDCut::pathName(cartnum,cutnum));
|
||||
if(!wave->openWave()) {
|
||||
XmlExit("No such audio",404);
|
||||
XmlExit("No such audio",404,"exportpeaks.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(!wave->hasEnergy()) {
|
||||
XmlExit("No peak data available",400);
|
||||
XmlExit("No peak data available",400,"exportpeaks.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -77,7 +77,7 @@ void Xport::ListGroup()
|
||||
//
|
||||
QString group_name;
|
||||
if(!xport_post->getValue("GROUP_NAME",&group_name)) {
|
||||
XmlExit("Missing GROUP_NAME",400);
|
||||
XmlExit("Missing GROUP_NAME",400,"groups.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
@ -90,7 +90,7 @@ void Xport::ListGroup()
|
||||
q=new RDSqlQuery(sql);
|
||||
if(!q->first()) {
|
||||
delete q;
|
||||
XmlExit("No such group",404);
|
||||
XmlExit("No such group",404,"groups.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -46,27 +46,27 @@ void Xport::Import()
|
||||
//
|
||||
int cartnum=0;
|
||||
if(!xport_post->getValue("CART_NUMBER",&cartnum)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
XmlExit("Missing CART_NUMBER",400,"import.cpp",LINE_NUMBER);
|
||||
}
|
||||
int cutnum=0;
|
||||
if(!xport_post->getValue("CUT_NUMBER",&cutnum)) {
|
||||
XmlExit("Missing CUT_NUMBER",400);
|
||||
XmlExit("Missing CUT_NUMBER",400,"import.cpp",LINE_NUMBER);
|
||||
}
|
||||
int channels=0;
|
||||
if(!xport_post->getValue("CHANNELS",&channels)) {
|
||||
XmlExit("Missing CHANNELS",400);
|
||||
XmlExit("Missing CHANNELS",400,"import.cpp",LINE_NUMBER);
|
||||
}
|
||||
int normalization_level=0;
|
||||
if(!xport_post->getValue("NORMALIZATION_LEVEL",&normalization_level)) {
|
||||
XmlExit("Missing NORMALIZATION_LEVEL",400);
|
||||
XmlExit("Missing NORMALIZATION_LEVEL",400,"import.cpp",LINE_NUMBER);
|
||||
}
|
||||
int autotrim_level=0;
|
||||
if(!xport_post->getValue("AUTOTRIM_LEVEL",&autotrim_level)) {
|
||||
XmlExit("Missing AUTOTRIM_LEVEL",400);
|
||||
XmlExit("Missing AUTOTRIM_LEVEL",400,"import.cpp",LINE_NUMBER);
|
||||
}
|
||||
int use_metadata=0;
|
||||
if(!xport_post->getValue("USE_METADATA",&use_metadata)) {
|
||||
XmlExit("Missing USE_METADATA",400);
|
||||
XmlExit("Missing USE_METADATA",400,"import.cpp",LINE_NUMBER);
|
||||
}
|
||||
int create=0;
|
||||
if(!xport_post->getValue("CREATE",&create)) {
|
||||
@ -76,10 +76,10 @@ void Xport::Import()
|
||||
xport_post->getValue("GROUP_NAME",&group_name);
|
||||
QString filename;
|
||||
if(!xport_post->getValue("FILENAME",&filename)) {
|
||||
XmlExit("Missing FILENAME",400);
|
||||
XmlExit("Missing FILENAME",400,"import.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(!xport_post->isFile("FILENAME")) {
|
||||
XmlExit("Missing file data",400);
|
||||
XmlExit("Missing file data",400,"import.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
@ -87,24 +87,24 @@ void Xport::Import()
|
||||
//
|
||||
if(RDCart::exists(cartnum)) {
|
||||
if(!xport_user->cartAuthorized(cartnum)) {
|
||||
XmlExit("No such cart",404);
|
||||
XmlExit("No such cart",404,"import.cpp",LINE_NUMBER);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(create) {
|
||||
if(!xport_user->groupAuthorized(group_name)) {
|
||||
XmlExit("No such group",404);
|
||||
XmlExit("No such group",404,"import.cpp",LINE_NUMBER);
|
||||
}
|
||||
}
|
||||
else {
|
||||
XmlExit("No such cart",404);
|
||||
XmlExit("No such cart",404,"import.cpp",LINE_NUMBER);
|
||||
}
|
||||
}
|
||||
if(!xport_user->editAudio()) {
|
||||
XmlExit("Forbidden",404);
|
||||
XmlExit("Forbidden",404,"import.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(create&&(!xport_user->createCarts())) {
|
||||
XmlExit("Forbidden",404);
|
||||
XmlExit("Forbidden",404,"import.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
@ -115,10 +115,10 @@ void Xport::Import()
|
||||
if(cartnum==0) {
|
||||
RDGroup *group=new RDGroup(group_name);
|
||||
if(!group->exists()) {
|
||||
XmlExit("No such group",404);
|
||||
XmlExit("No such group",404,"import.cpp",LINE_NUMBER);
|
||||
}
|
||||
if((cartnum=group->nextFreeCart())==0) {
|
||||
XmlExit("No available carts for specified group",404);
|
||||
XmlExit("No available carts for specified group",404,"import.cpp",LINE_NUMBER);
|
||||
}
|
||||
cart=new RDCart(cartnum);
|
||||
cart->create(group_name,RDCart::Audio);
|
||||
@ -131,10 +131,10 @@ void Xport::Import()
|
||||
cut=new RDCut(cartnum,cutnum);
|
||||
}
|
||||
if(!RDCart::exists(cartnum)) {
|
||||
XmlExit("No such cart",404);
|
||||
XmlExit("No such cart",404,"import.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(!RDCut::exists(cartnum,cutnum)) {
|
||||
XmlExit("No such cut",404);
|
||||
XmlExit("No such cut",404,"import.cpp",LINE_NUMBER);
|
||||
}
|
||||
RDLibraryConf *conf=new RDLibraryConf(xport_config->stationName(),0);
|
||||
RDSettings *settings=new RDSettings();
|
||||
@ -158,7 +158,7 @@ void Xport::Import()
|
||||
RDWaveFile *wave=new RDWaveFile(filename);
|
||||
if(!wave->openWave()) {
|
||||
delete wave;
|
||||
XmlExit("Format Not Supported",415);
|
||||
XmlExit("Format Not Supported",415,"import.cpp",LINE_NUMBER);
|
||||
}
|
||||
delete wave;
|
||||
RDAudioConvert *conv=new RDAudioConvert(xport_config->stationName());
|
||||
@ -174,7 +174,7 @@ void Xport::Import()
|
||||
}
|
||||
else {
|
||||
delete wave;
|
||||
XmlExit("Unable to access imported file",500);
|
||||
XmlExit("Unable to access imported file",500,"import.cpp",LINE_NUMBER);
|
||||
}
|
||||
delete wave;
|
||||
cut->checkInRecording(xport_config->stationName(),settings,msecs);
|
||||
@ -230,5 +230,6 @@ void Xport::Import()
|
||||
rmdir(xport_post->tempDir());
|
||||
exit(0);
|
||||
}
|
||||
XmlExit(RDAudioConvert::errorText(conv_err),resp_code,conv_err);
|
||||
XmlExit(RDAudioConvert::errorText(conv_err),resp_code,"import.cpp",
|
||||
LINE_NUMBER,conv_err);
|
||||
}
|
||||
|
@ -47,21 +47,21 @@ void Xport::AddLog()
|
||||
// Get Arguments
|
||||
//
|
||||
if(!xport_post->getValue("LOG_NAME",&log_name)) {
|
||||
XmlExit("Missing LOG_NAME",400);
|
||||
XmlExit("Missing LOG_NAME",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(!xport_post->getValue("SERVICE_NAME",&service_name)) {
|
||||
XmlExit("Missing SERVICE_NAME",400);
|
||||
XmlExit("Missing SERVICE_NAME",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
RDSvc *svc=new RDSvc(service_name);
|
||||
if(!svc->exists()) {
|
||||
XmlExit("No such service",404);
|
||||
XmlExit("No such service",404,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->createLog()) {
|
||||
XmlExit("Unauthorized",404);
|
||||
XmlExit("Unauthorized",404,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
RDLog *log=new RDLog(log_name);
|
||||
@ -70,7 +70,7 @@ void Xport::AddLog()
|
||||
log=new RDLog(log_name,true);
|
||||
if(!log->exists()) {
|
||||
delete log;
|
||||
XmlExit("Unable to create log",500);
|
||||
XmlExit("Unable to create log",500,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
log->setOriginUser(xport_user->name());
|
||||
log->setDescription("[new log]");
|
||||
@ -79,7 +79,7 @@ void Xport::AddLog()
|
||||
delete log;
|
||||
RDCreateLogTable(RDLog::tableName(log_name));
|
||||
|
||||
XmlExit("OK",200);
|
||||
XmlExit("OK",200,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
|
||||
@ -91,26 +91,26 @@ void Xport::DeleteLog()
|
||||
// Get Arguments
|
||||
//
|
||||
if(!xport_post->getValue("LOG_NAME",&log_name)) {
|
||||
XmlExit("Missing LOG_NAME",400);
|
||||
XmlExit("Missing LOG_NAME",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->deleteLog()) {
|
||||
XmlExit("Unauthorized",404);
|
||||
XmlExit("Unauthorized",404,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
RDLog *log=new RDLog(log_name);
|
||||
if(log->exists()) {
|
||||
if(!log->remove(xport_station,xport_user,xport_config)) {
|
||||
delete log;
|
||||
XmlExit("Unable to delete log",500);
|
||||
XmlExit("Unable to delete log",500,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
}
|
||||
delete log;
|
||||
|
||||
XmlExit("OK",200);
|
||||
XmlExit("OK",200,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
|
||||
@ -185,7 +185,7 @@ void Xport::ListLog()
|
||||
log=new RDLog(name);
|
||||
if(!log->exists()) {
|
||||
delete log;
|
||||
XmlExit("No such log",404);
|
||||
XmlExit("No such log",404,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
@ -212,7 +212,7 @@ void Xport::SaveLog()
|
||||
// Verify User Perms
|
||||
//
|
||||
if((!xport_user->addtoLog())||(!xport_user->removefromLog())||(!xport_user->arrangeLog())) {
|
||||
XmlExit("No user privilege",404);
|
||||
XmlExit("No user privilege",404,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
QString log_name;
|
||||
@ -228,28 +228,28 @@ void Xport::SaveLog()
|
||||
// Header Data
|
||||
//
|
||||
if(!xport_post->getValue("LOG_NAME",&log_name)) {
|
||||
XmlExit("Missing LOG_NAME",400);
|
||||
XmlExit("Missing LOG_NAME",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(!xport_post->getValue("SERVICE_NAME",&service_name)) {
|
||||
XmlExit("Missing SERVICE_NAME",400);
|
||||
XmlExit("Missing SERVICE_NAME",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(!xport_post->getValue("DESCRIPTION",&description)) {
|
||||
XmlExit("Missing DESCRIPTION",400);
|
||||
XmlExit("Missing DESCRIPTION",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(!xport_post->getValue("PURGE_DATE",&purge_date)) {
|
||||
XmlExit("Missing PURGE_DATE",400);
|
||||
XmlExit("Missing PURGE_DATE",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(!xport_post->getValue("AUTO_REFRESH",&auto_refresh)) {
|
||||
XmlExit("Missing AUTO_REFRESH",400);
|
||||
XmlExit("Missing AUTO_REFRESH",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(!xport_post->getValue("START_DATE",&start_date)) {
|
||||
XmlExit("Missing START_DATE",400);
|
||||
XmlExit("Missing START_DATE",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(!xport_post->getValue("END_DATE",&end_date)) {
|
||||
XmlExit("Missing END_DATE",400);
|
||||
XmlExit("Missing END_DATE",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(!xport_post->getValue("LINE_QUANTITY",&line_quantity)) {
|
||||
XmlExit("Missing LINE_QUANTITY",400);
|
||||
XmlExit("Missing LINE_QUANTITY",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
@ -269,39 +269,39 @@ void Xport::SaveLog()
|
||||
bool ok=false;
|
||||
|
||||
if(!xport_post->getValue(line+"_ID",&integer1,&ok)) {
|
||||
XmlExit("Missing "+line+"_ID",400);
|
||||
XmlExit("Missing "+line+"_ID",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(!ok) {
|
||||
XmlExit("Invalid "+line+"_ID",400);
|
||||
XmlExit("Invalid "+line+"_ID",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setId(integer1);
|
||||
|
||||
if(!xport_post->getValue(line+"_TYPE",&integer1)) {
|
||||
XmlExit("Missing "+line+"_TYPE",400);
|
||||
XmlExit("Missing "+line+"_TYPE",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setType((RDLogLine::Type)integer1);
|
||||
|
||||
if(!xport_post->getValue(line+"_CART_NUMBER",&integer1)) {
|
||||
XmlExit("Missing "+line+"_CART_NUMBER",400);
|
||||
XmlExit("Missing "+line+"_CART_NUMBER",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setCartNumber(integer1);
|
||||
|
||||
if(!xport_post->getValue(line+"_START_TIME",&integer1)) {
|
||||
XmlExit("Missing "+line+"_START_TIME",400);
|
||||
XmlExit("Missing "+line+"_START_TIME",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(!xport_post->getValue(line+"_TIME_TYPE",&integer2)) {
|
||||
XmlExit("Missing "+line+"_TIME_TYPE",400);
|
||||
XmlExit("Missing "+line+"_TIME_TYPE",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setStartTime((RDLogLine::StartTimeType)integer2,
|
||||
QTime().addMSecs(integer1));
|
||||
|
||||
if(!xport_post->getValue(line+"_GRACE_TIME",&integer1)) {
|
||||
XmlExit("Missing "+line+"_GRACE_TIME",400);
|
||||
XmlExit("Missing "+line+"_GRACE_TIME",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setGraceTime(integer1);
|
||||
|
||||
if(!xport_post->getValue(line+"_TRANS_TYPE",&str)) {
|
||||
XmlExit("Missing "+line+"_TRANS_TYPE",400);
|
||||
XmlExit("Missing "+line+"_TRANS_TYPE",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
integer1=-1;
|
||||
if(str.lower()=="play") {
|
||||
@ -314,139 +314,140 @@ void Xport::SaveLog()
|
||||
integer1=RDLogLine::Stop;
|
||||
}
|
||||
if(integer1<0) {
|
||||
XmlExit("Invalid transition type in "+line+"_TRANS_TYPE",400);
|
||||
XmlExit("Invalid transition type in "+line+"_TRANS_TYPE",400,
|
||||
"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setTransType((RDLogLine::TransType)integer1);
|
||||
|
||||
if(!xport_post->getValue(line+"_START_POINT",&integer1)) {
|
||||
XmlExit("Missing "+line+"_START_POINT",400);
|
||||
XmlExit("Missing "+line+"_START_POINT",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setStartPoint(integer1,RDLogLine::LogPointer);
|
||||
|
||||
if(!xport_post->getValue(line+"_END_POINT",&integer1)) {
|
||||
XmlExit("Missing "+line+"_END_POINT",400);
|
||||
XmlExit("Missing "+line+"_END_POINT",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setEndPoint(integer1,RDLogLine::LogPointer);
|
||||
|
||||
if(!xport_post->getValue(line+"_SEGUE_START_POINT",&integer1)) {
|
||||
XmlExit("Missing "+line+"_SEGUE_START_POINT",400);
|
||||
XmlExit("Missing "+line+"_SEGUE_START_POINT",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setSegueStartPoint(integer1,RDLogLine::LogPointer);
|
||||
|
||||
if(!xport_post->getValue(line+"_SEGUE_END_POINT",&integer1)) {
|
||||
XmlExit("Missing "+line+"_SEGUE_END_POINT",400);
|
||||
XmlExit("Missing "+line+"_SEGUE_END_POINT",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setSegueEndPoint(integer1,RDLogLine::LogPointer);
|
||||
|
||||
if(!xport_post->getValue(line+"_FADEUP_POINT",&integer1)) {
|
||||
XmlExit("Missing "+line+"_FADEUP_POINT",400);
|
||||
XmlExit("Missing "+line+"_FADEUP_POINT",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setFadeupPoint(integer1,RDLogLine::LogPointer);
|
||||
|
||||
if(!xport_post->getValue(line+"_FADEDOWN_POINT",&integer1)) {
|
||||
XmlExit("Missing "+line+"_FADEDOWN_POINT",400);
|
||||
XmlExit("Missing "+line+"_FADEDOWN_POINT",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setFadedownPoint(integer1,RDLogLine::LogPointer);
|
||||
|
||||
if(!xport_post->getValue(line+"_DUCK_UP_GAIN",&integer1)) {
|
||||
XmlExit("Missing "+line+"_DUCK_UP_GAIN",400);
|
||||
XmlExit("Missing "+line+"_DUCK_UP_GAIN",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setDuckUpGain(integer1);
|
||||
|
||||
if(!xport_post->getValue(line+"_DUCK_DOWN_GAIN",&integer1)) {
|
||||
XmlExit("Missing "+line+"_DUCK_DOWN_GAIN",400);
|
||||
XmlExit("Missing "+line+"_DUCK_DOWN_GAIN",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setDuckDownGain(integer1);
|
||||
|
||||
if(!xport_post->getValue(line+"_COMMENT",&str)) {
|
||||
XmlExit("Missing "+line+"_COMMENT",400);
|
||||
XmlExit("Missing "+line+"_COMMENT",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setMarkerComment(str);
|
||||
|
||||
if(!xport_post->getValue(line+"_LABEL",&str)) {
|
||||
XmlExit("Missing "+line+"_LABEL",400);
|
||||
XmlExit("Missing "+line+"_LABEL",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setMarkerLabel(str);
|
||||
|
||||
if(!xport_post->getValue(line+"_ORIGIN_USER",&str)) {
|
||||
XmlExit("Missing "+line+"_ORIGIN_USER",400);
|
||||
XmlExit("Missing "+line+"_ORIGIN_USER",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setOriginUser(str);
|
||||
|
||||
if(!xport_post->getValue(line+"_ORIGIN_DATETIME",&datetime)) {
|
||||
XmlExit("Missing "+line+"_ORIGIN_DATETIME",400);
|
||||
XmlExit("Missing "+line+"_ORIGIN_DATETIME",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setOriginDateTime(datetime);
|
||||
|
||||
if(!xport_post->getValue(line+"_EVENT_LENGTH",&integer1)) {
|
||||
XmlExit("Missing "+line+"_EVENT_LENGTH",400);
|
||||
XmlExit("Missing "+line+"_EVENT_LENGTH",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setEventLength(integer1);
|
||||
|
||||
if(!xport_post->getValue(line+"_LINK_EVENT_NAME",&str)) {
|
||||
XmlExit("Missing "+line+"_LINK_EVENT_NAME",400);
|
||||
XmlExit("Missing "+line+"_LINK_EVENT_NAME",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setLinkEventName(str);
|
||||
|
||||
if(!xport_post->getValue(line+"_LINK_START_TIME",&integer1)) {
|
||||
XmlExit("Missing "+line+"_LINK_START_TIME",400);
|
||||
XmlExit("Missing "+line+"_LINK_START_TIME",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setLinkStartTime(QTime().addMSecs(integer1));
|
||||
|
||||
if(!xport_post->getValue(line+"_LINK_LENGTH",&integer1)) {
|
||||
XmlExit("Missing "+line+"_LINK_LENGTH",400);
|
||||
XmlExit("Missing "+line+"_LINK_LENGTH",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setLinkLength(integer1);
|
||||
|
||||
if(!xport_post->getValue(line+"_LINK_START_SLOP",&integer1)) {
|
||||
XmlExit("Missing "+line+"_LINK_START_SLOP",400);
|
||||
XmlExit("Missing "+line+"_LINK_START_SLOP",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setLinkStartSlop(integer1);
|
||||
|
||||
if(!xport_post->getValue(line+"_LINK_END_SLOP",&integer1)) {
|
||||
XmlExit("Missing "+line+"_LINK_END_SLOP",400);
|
||||
XmlExit("Missing "+line+"_LINK_END_SLOP",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setLinkEndSlop(integer1);
|
||||
|
||||
if(!xport_post->getValue(line+"_LINK_ID",&integer1)) {
|
||||
XmlExit("Missing "+line+"_LINK_ID",400);
|
||||
XmlExit("Missing "+line+"_LINK_ID",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setLinkId(integer1);
|
||||
|
||||
if(!xport_post->getValue(line+"_LINK_EMBEDDED",&state)) {
|
||||
XmlExit("Missing "+line+"_LINK_EMBEDDED",400);
|
||||
XmlExit("Missing "+line+"_LINK_EMBEDDED",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setLinkEmbedded(state);
|
||||
|
||||
if(!xport_post->getValue(line+"_EXT_START_TIME",&time)) {
|
||||
XmlExit("Missing "+line+"_EXT_START_TIME",400);
|
||||
XmlExit("Missing "+line+"_EXT_START_TIME",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setExtStartTime(time);
|
||||
|
||||
if(!xport_post->getValue(line+"_EXT_CART_NAME",&str)) {
|
||||
XmlExit("Missing "+line+"_EXT_CART_NAME",400);
|
||||
XmlExit("Missing "+line+"_EXT_CART_NAME",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setExtCartName(str);
|
||||
|
||||
if(!xport_post->getValue(line+"_EXT_DATA",&str)) {
|
||||
XmlExit("Missing "+line+"_EXT_DATA",400);
|
||||
XmlExit("Missing "+line+"_EXT_DATA",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setExtData(str);
|
||||
|
||||
if(!xport_post->getValue(line+"_EXT_EVENT_ID",&str)) {
|
||||
XmlExit("Missing "+line+"_EXT_EVENT_ID",400);
|
||||
XmlExit("Missing "+line+"_EXT_EVENT_ID",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setExtEventId(str);
|
||||
|
||||
if(!xport_post->getValue(line+"_EXT_ANNC_TYPE",&str)) {
|
||||
XmlExit("Missing "+line+"_EXT_ANNC_TYPE",400);
|
||||
XmlExit("Missing "+line+"_EXT_ANNC_TYPE",400,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
ll->setExtAnncType(str);
|
||||
}
|
||||
|
||||
RDLog *log=new RDLog(log_name);
|
||||
if(!log->exists()) {
|
||||
XmlExit("No such log",404);
|
||||
XmlExit("No such log",404,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
log->setService(service_name);
|
||||
log->setDescription(description);
|
||||
@ -457,5 +458,6 @@ void Xport::SaveLog()
|
||||
|
||||
logevt->save();
|
||||
|
||||
XmlExit(QString().sprintf("OK Saved %d events",logevt->size()),200);
|
||||
XmlExit(QString().sprintf("OK Saved %d events",logevt->size()),
|
||||
200,"logs.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
@ -56,13 +56,14 @@ Xport::Xport(QObject *parent)
|
||||
// Drop root permissions
|
||||
//
|
||||
if(setgid(xport_config->gid())<0) {
|
||||
XmlExit("Unable to set Rivendell group",500);
|
||||
XmlExit("Unable to set Rivendell group",500,"rdxport.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(setuid(xport_config->uid())<0) {
|
||||
XmlExit("Unable to set Rivendell user",500);
|
||||
XmlExit("Unable to set Rivendell user",500,"rdxport.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(getuid()==0) {
|
||||
XmlExit("Rivendell user should never be \"root\"!",500);
|
||||
XmlExit("Rivendell user should never be \"root\"!",500,"rdxport.cpp",
|
||||
LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
@ -128,7 +129,8 @@ Xport::Xport(QObject *parent)
|
||||
//
|
||||
xport_post=new RDFormPost(RDFormPost::AutoEncoded,false);
|
||||
if(xport_post->error()!=RDFormPost::ErrorOk) {
|
||||
XmlExit(xport_post->errorString(xport_post->error()),400);
|
||||
XmlExit(xport_post->errorString(xport_post->error()),400,"rdxport.cpp",
|
||||
LINE_NUMBER);
|
||||
Exit(0);
|
||||
}
|
||||
|
||||
@ -136,7 +138,7 @@ Xport::Xport(QObject *parent)
|
||||
// Authenticate Connection
|
||||
//
|
||||
if(!Authenticate()) {
|
||||
XmlExit("Invalid User",403);
|
||||
XmlExit("Invalid User",403,"rdxport.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
@ -397,12 +399,23 @@ void Xport::Exit(int code)
|
||||
}
|
||||
|
||||
|
||||
void Xport::XmlExit(const QString &str,int code,RDAudioConvert::ErrorCode err)
|
||||
void Xport::XmlExit(const QString &str,int code,const QString &srcfile,
|
||||
int srcline,RDAudioConvert::ErrorCode err)
|
||||
{
|
||||
if(xport_post!=NULL) {
|
||||
delete xport_post;
|
||||
}
|
||||
#ifdef RDXPORT_DEBUG
|
||||
if(srcline>0) {
|
||||
RDXMLResult(str+"\""+srcfile+"\" "+QString().sprintf("line %d",srcline),
|
||||
code,err);
|
||||
}
|
||||
else {
|
||||
RDXMLResult(str,code,err);
|
||||
}
|
||||
#else
|
||||
RDXMLResult(str,code,err);
|
||||
#endif // RDXPORT_DEBUG
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,10 @@
|
||||
#include <rdsystem.h>
|
||||
#include <rduser.h>
|
||||
|
||||
#define STRINGIZE(x) STRINGIZE2(x)
|
||||
#define STRINGIZE2(x) #x
|
||||
#define LINE_NUMBER QString(STRINGIZE(__LINE__)).toInt()
|
||||
|
||||
class Xport : public QObject
|
||||
{
|
||||
public:
|
||||
@ -73,7 +77,8 @@ class Xport : public QObject
|
||||
void ListCartSchedCodes();
|
||||
void ListServices();
|
||||
void Exit(int code);
|
||||
void XmlExit(const QString &str,int code,
|
||||
void XmlExit(const QString &msg,int code,
|
||||
const QString &srcfile="",int line=-1,
|
||||
RDAudioConvert::ErrorCode err=RDAudioConvert::ErrorOk);
|
||||
RDFormPost *xport_post;
|
||||
RDUser *xport_user;
|
||||
|
@ -45,10 +45,10 @@ void Xport::Rehash()
|
||||
// Verify Post
|
||||
//
|
||||
if(!xport_post->getValue("CART_NUMBER",&cart_number)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
XmlExit("Missing CART_NUMBER",400,"rdhash.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(!xport_post->getValue("CUT_NUMBER",&cut_number)) {
|
||||
XmlExit("Missing CUT_NUMBER",400);
|
||||
XmlExit("Missing CUT_NUMBER",400,"rdhash.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
@ -57,9 +57,9 @@ void Xport::Rehash()
|
||||
RDCut *cut=new RDCut(cart_number,cut_number);
|
||||
if(!cut->exists()) {
|
||||
delete cut;
|
||||
XmlExit("No such cut",404);
|
||||
XmlExit("No such cut",404,"rdhash.cpp",LINE_NUMBER);
|
||||
}
|
||||
cut->setSha1Hash(RDSha1Hash(RDCut::pathName(cart_number,cut_number)));
|
||||
delete cut;
|
||||
XmlExit("OK",200);
|
||||
XmlExit("OK",200,"rdhash.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
@ -68,17 +68,17 @@ void Xport::AssignSchedCode()
|
||||
// Verify Post
|
||||
//
|
||||
if(!xport_post->getValue("CART_NUMBER",&cart_number)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
XmlExit("Missing CART_NUMBER",400,"schedcodes.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(!xport_post->getValue("CODE",&sched_code)) {
|
||||
XmlExit("Missing CODE",400);
|
||||
XmlExit("Missing CODE",400,"schedcodes.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->cartAuthorized(cart_number)) {
|
||||
XmlExit("No such cart",404);
|
||||
XmlExit("No such cart",404,"schedcodes.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
@ -87,17 +87,17 @@ void Xport::AssignSchedCode()
|
||||
cart=new RDCart(cart_number);
|
||||
code=new RDSchedCode(sched_code);
|
||||
if(!code->exists()) {
|
||||
XmlExit("No such scheduler code",404);
|
||||
XmlExit("No such scheduler code",404,"schedcodes.cpp",LINE_NUMBER);
|
||||
}
|
||||
codes=cart->schedCodesList();
|
||||
for(unsigned i=0;i<codes.size();i++) {
|
||||
if(codes[i]==sched_code) {
|
||||
delete cart;
|
||||
XmlExit("OK",200);
|
||||
XmlExit("OK",200,"schedcodes.cpp",LINE_NUMBER);
|
||||
}
|
||||
}
|
||||
cart->addSchedCode(sched_code);
|
||||
XmlExit("OK",200);
|
||||
XmlExit("OK",200,"schedcodes.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
|
||||
@ -113,17 +113,17 @@ void Xport::UnassignSchedCode()
|
||||
// Verify Post
|
||||
//
|
||||
if(!xport_post->getValue("CART_NUMBER",&cart_number)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
XmlExit("Missing CART_NUMBER",400,"schedcodes.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(!xport_post->getValue("CODE",&sched_code)) {
|
||||
XmlExit("Missing CODE",400);
|
||||
XmlExit("Missing CODE",400,"schedcodes.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->cartAuthorized(cart_number)) {
|
||||
XmlExit("No such cart",404);
|
||||
XmlExit("No such cart",404,"schedcodes.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
@ -132,12 +132,12 @@ void Xport::UnassignSchedCode()
|
||||
cart=new RDCart(cart_number);
|
||||
code=new RDSchedCode(sched_code);
|
||||
if(!code->exists()) {
|
||||
XmlExit("No such scheduler code",404);
|
||||
XmlExit("No such scheduler code",404,"schedcodes.cpp",LINE_NUMBER);
|
||||
}
|
||||
cart->removeSchedCode(sched_code);
|
||||
delete cart;
|
||||
delete code;
|
||||
XmlExit("OK",200);
|
||||
XmlExit("OK",200,"schedcodes.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
|
||||
@ -152,14 +152,14 @@ void Xport::ListCartSchedCodes()
|
||||
// Verify Post
|
||||
//
|
||||
if(!xport_post->getValue("CART_NUMBER",&cart_number)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
XmlExit("Missing CART_NUMBER",400,"schedcodes.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->cartAuthorized(cart_number)) {
|
||||
XmlExit("No such cart",404);
|
||||
XmlExit("No such cart",404,"schedcodes.cpp",LINE_NUMBER);
|
||||
}
|
||||
//
|
||||
// Generate Scheduler Code List
|
||||
|
@ -42,23 +42,23 @@ void Xport::TrimAudio()
|
||||
//
|
||||
int cartnum=0;
|
||||
if(!xport_post->getValue("CART_NUMBER",&cartnum)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
XmlExit("Missing CART_NUMBER",400,"trimaudio.cpp",LINE_NUMBER);
|
||||
}
|
||||
int cutnum=0;
|
||||
if(!xport_post->getValue("CUT_NUMBER",&cutnum)) {
|
||||
XmlExit("Missing CUT_NUMBER",400);
|
||||
XmlExit("Missing CUT_NUMBER",400,"trimaudio.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
int trim_level=0;
|
||||
if(!xport_post->getValue("TRIM_LEVEL",&trim_level)) {
|
||||
XmlExit("Missing TRIM_LEVEL",400);
|
||||
XmlExit("Missing TRIM_LEVEL",400,"trimaudio.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->cartAuthorized(cartnum)) {
|
||||
XmlExit("No such cart",404);
|
||||
XmlExit("No such cart",404,"trimaudio.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
@ -66,10 +66,10 @@ void Xport::TrimAudio()
|
||||
//
|
||||
RDWaveFile *wave=new RDWaveFile(RDCut::pathName(cartnum,cutnum));
|
||||
if(!wave->openWave()) {
|
||||
XmlExit("No such audio",404);
|
||||
XmlExit("No such audio",404,"trimaudio.cpp",LINE_NUMBER);
|
||||
}
|
||||
if(!wave->hasEnergy()) {
|
||||
XmlExit("No peak data available",400);
|
||||
XmlExit("No peak data available",400,"trimaudio.cpp",LINE_NUMBER);
|
||||
}
|
||||
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user