From 1f494fbc5dcb8128d7a4870b755b7535da2c421f Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Tue, 29 Mar 2016 14:57:07 -0400 Subject: [PATCH] 2016-03-29 Fred Gleason * Added the 'Copy Cut' ['CP'] RML in 'lib/rdmacro.cpp' and 'lib/rdmacro.h'. * Implemented the 'Copy Cut' ['CP'] RML in 'rdcatchd/local_macros.cpp'. --- ChangeLog | 4 ++++ docs/docbook/rml.xml | 34 ++++++++++++++++++++++++++++++++++ lib/rdmacro.cpp | 1 + lib/rdmacro.h | 20 ++++++++++---------- rdcatchd/local_macros.cpp | 33 +++++++++++++++++++++++++++++++++ 5 files changed, 82 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 42e73327..e29c6fcf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15046,3 +15046,7 @@ * Translated 'docs/rml.sxw' to XML5-DocBook in 'docs/docbook/rml.xml'. 2016-03-29 Fred Gleason * Alphabeticized the set of RML commands in 'docs/docbook/rml.xml'. +2016-03-29 Fred Gleason + * Added the 'Copy Cut' ['CP'] RML in 'lib/rdmacro.cpp' and + 'lib/rdmacro.h'. + * Implemented the 'Copy Cut' ['CP'] RML in 'rdcatchd/local_macros.cpp'. diff --git a/docs/docbook/rml.xml b/docs/docbook/rml.xml index bda3e517..076c1c99 100644 --- a/docs/docbook/rml.xml +++ b/docs/docbook/rml.xml @@ -373,6 +373,40 @@ + + <command>Copy Cut [CP]</command> + + + + Module + rdcatchd8 + + + Mnemonic + CP + + + + + Copy cut audio and metadata. + + + CP + srccart + srccut + dstcart + dstcut! + + + Copy the audio and metadata from cut number + srccut in cart + srccart to cut number + dstcut in cart + dstcart. The destination cart/cut must + already exist. + + + <command>Database Backup [DB]</command> diff --git a/lib/rdmacro.cpp b/lib/rdmacro.cpp index ce19f420..5f51fba2 100644 --- a/lib/rdmacro.cpp +++ b/lib/rdmacro.cpp @@ -167,6 +167,7 @@ bool RDMacro::parseString(const char *str,int n) case RDMacro::BO: case RDMacro::CC: case RDMacro::CL: + case RDMacro::CP: case RDMacro::DB: case RDMacro::DL: case RDMacro::DP: diff --git a/lib/rdmacro.h b/lib/rdmacro.h index e40ab14c..93f51bfb 100644 --- a/lib/rdmacro.h +++ b/lib/rdmacro.h @@ -37,16 +37,16 @@ class RDMacro { public: - enum Command {AL=0x414C,BO=0x424F,CC=0x4343,CL=0x434C,DB=0x4442,DL=0x444C, - DP=0x4450,DS=0x4453,DX=0x4458,EX=0x4558,FS=0x4653,GE=0x4745, - GI=0x4749,GO=0x474F,JC=0x4A43,JD=0x4A44,LB=0x4C42,LC=0x4C43, - LL=0x4C4C,LO=0x4C4F,MB=0x4D42,MD=0x4D44,MN=0x4D4E,MT=0x4D54, - NN=0x4E4E,PB=0x5042,PC=0x5043,PD=0x5044,PE=0x5045,PL=0x504C, - PM=0x504D,PN=0x504E,PP=0x5050,PS=0x5053,PT=0x5054,PU=0x5055, - PW=0x5057,PX=0x5058,RL=0x524C,RN=0x524E,RS=0x5253,RR=0x5252, - SA=0x5341,SC=0x5343,SD=0x5344,SG=0x5347,SI=0x5349,SL=0x534C, - SN=0x534e,SO=0x534F,SP=0x5350,SR=0x5352,ST=0x5354,SX=0x5358, - SY=0x5359,SZ=0x535A,TA=0x5441,UO=0x554F}; + enum Command {AL=0x414C,BO=0x424F,CC=0x4343,CL=0x434C,CP=0x4350,DB=0x4442, + DL=0x444C,DP=0x4450,DS=0x4453,DX=0x4458,EX=0x4558,FS=0x4653, + GE=0x4745,GI=0x4749,GO=0x474F,JC=0x4A43,JD=0x4A44,LB=0x4C42, + LC=0x4C43,LL=0x4C4C,LO=0x4C4F,MB=0x4D42,MD=0x4D44,MN=0x4D4E, + MT=0x4D54,NN=0x4E4E,PB=0x5042,PC=0x5043,PD=0x5044,PE=0x5045, + PL=0x504C,PM=0x504D,PN=0x504E,PP=0x5050,PS=0x5053,PT=0x5054, + PU=0x5055,PW=0x5057,PX=0x5058,RL=0x524C,RN=0x524E,RS=0x5253, + RR=0x5252,SA=0x5341,SC=0x5343,SD=0x5344,SG=0x5347,SI=0x5349, + SL=0x534C,SN=0x534e,SO=0x534F,SP=0x5350,SR=0x5352,ST=0x5354, + SX=0x5358,SY=0x5359,SZ=0x535A,TA=0x5441,UO=0x554F}; enum Role {Invalid=0,Cmd=1,Reply=2}; RDMacro(); RDMacro::Role role() const; diff --git a/rdcatchd/local_macros.cpp b/rdcatchd/local_macros.cpp index 7bf3de6d..ccfd9600 100644 --- a/rdcatchd/local_macros.cpp +++ b/rdcatchd/local_macros.cpp @@ -21,6 +21,7 @@ // #include +#include #include @@ -32,10 +33,42 @@ void MainObject::RunLocalMacros(RDMacro *rml) int chan; unsigned cartnum; unsigned cutnum; + unsigned dst_cartnum; + unsigned dst_cutnum; unsigned len; QDateTime dt; + RDUser *user; + bool ok=false; switch(rml->command()) { + case RDMacro::CP: + cartnum=rml->arg(0).toUInt(); + cutnum=rml->arg(1).toUInt(); + dst_cartnum=rml->arg(2).toUInt(); + dst_cutnum=rml->arg(3).toUInt(); + if((cartnum<1)||(cartnum>RD_MAX_CART_NUMBER)|| + (dst_cartnum<1)||(dst_cartnum>RD_MAX_CART_NUMBER)|| + (cutnum<1)||(cutnum>RD_MAX_CUT_NUMBER)|| + (dst_cutnum<1)||(dst_cutnum>RD_MAX_CUT_NUMBER)|| + (catch_ripc->user().isEmpty())) { + if(rml->echoRequested()) { + rml->acknowledge(false); + catch_ripc->sendRml(rml); + } + return; + } + user=new RDUser(catch_ripc->user()); + cut=new RDCut(cartnum,cutnum); + ok=cut->copyTo(catch_rdstation,user,RDCut::cutName(dst_cartnum,dst_cutnum), + catch_config); + delete cut; + delete user; + if(rml->echoRequested()) { + rml->acknowledge(ok); + catch_ripc->sendRml(rml); + } + break; + case RDMacro::EX: cart=new RDCart(rml->arg(0).toUInt()); if(cart->exists()) {