mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-07-09 17:07:44 +02:00
2016-11-28 Fred Gleason <fredg@paravelsystems.com>
* Added 'CREATE' and 'GROUP_NAME' call fields to the 'Import' web API call in 'web/rdxport/import.cpp'.
This commit is contained in:
parent
74f5fab396
commit
a80aa50e29
@ -15493,3 +15493,6 @@
|
|||||||
2016-11-28 Fred Gleason <fredg@paravelsystems.com>
|
2016-11-28 Fred Gleason <fredg@paravelsystems.com>
|
||||||
* Updated 'docs/tables/services.txt' to reflect changes made in
|
* Updated 'docs/tables/services.txt' to reflect changes made in
|
||||||
database version 259.
|
database version 259.
|
||||||
|
2016-11-28 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Added 'CREATE' and 'GROUP_NAME' call fields to the 'Import' web
|
||||||
|
API call in 'web/rdxport/import.cpp'.
|
||||||
|
@ -1778,6 +1778,28 @@
|
|||||||
Mandatory, 0 = No, 1 = Yes
|
Mandatory, 0 = No, 1 = Yes
|
||||||
</entry>
|
</entry>
|
||||||
</row>
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry>
|
||||||
|
CREATE
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
Create cart/cut if it does not exist
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
Optional, 0 = No, 1 = Yes
|
||||||
|
</entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry>
|
||||||
|
GROUP_NAME
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
Add newly created cart/cut to specified group.
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
Optional
|
||||||
|
</entry>
|
||||||
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>
|
<entry>
|
||||||
FILENAME
|
FILENAME
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include <rdaudioconvert.h>
|
#include <rdaudioconvert.h>
|
||||||
#include <rdsettings.h>
|
#include <rdsettings.h>
|
||||||
#include <rdconf.h>
|
#include <rdconf.h>
|
||||||
|
#include <rdgroup.h>
|
||||||
#include <rdlibrary_conf.h>
|
#include <rdlibrary_conf.h>
|
||||||
|
|
||||||
#include <rdxport.h>
|
#include <rdxport.h>
|
||||||
@ -66,16 +67,24 @@ void Xport::Import()
|
|||||||
if(!xport_post->getValue("USE_METADATA",&use_metadata)) {
|
if(!xport_post->getValue("USE_METADATA",&use_metadata)) {
|
||||||
XmlExit("Missing USE_METADATA",400);
|
XmlExit("Missing USE_METADATA",400);
|
||||||
}
|
}
|
||||||
|
int create=0;
|
||||||
|
if(!xport_post->getValue("CREATE",&create)) {
|
||||||
|
create=-1;
|
||||||
|
}
|
||||||
|
QString group_name;
|
||||||
|
xport_post->getValue("GROUP_NAME",&group_name);
|
||||||
QString filename;
|
QString filename;
|
||||||
if(!xport_post->getValue("FILENAME",&filename)) {
|
if(!xport_post->getValue("FILENAME",&filename)) {
|
||||||
XmlExit("Missing FILENAME",400);
|
XmlExit("Missing FILENAME",400);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if(!RDCart::exists(cartnum)) {
|
if(!RDCart::exists(cartnum)) {
|
||||||
XmlExit("No such cart",404);
|
XmlExit("No such cart",404);
|
||||||
}
|
}
|
||||||
if(!RDCut::exists(cartnum,cutnum)) {
|
if(!RDCut::exists(cartnum,cutnum)) {
|
||||||
XmlExit("No such cut",404);
|
XmlExit("No such cut",404);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
if(!xport_post->isFile("FILENAME")) {
|
if(!xport_post->isFile("FILENAME")) {
|
||||||
XmlExit("Missing file data",400);
|
XmlExit("Missing file data",400);
|
||||||
}
|
}
|
||||||
@ -83,18 +92,64 @@ void Xport::Import()
|
|||||||
//
|
//
|
||||||
// Verify User Perms
|
// Verify User Perms
|
||||||
//
|
//
|
||||||
if(!xport_user->cartAuthorized(cartnum)) {
|
if(RDCart::exists(cartnum)) {
|
||||||
XmlExit("No such cart",404);
|
if(!xport_user->cartAuthorized(cartnum)) {
|
||||||
|
XmlExit("No such cart",404);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(create) {
|
||||||
|
if(!xport_user->groupAuthorized(group_name)) {
|
||||||
|
XmlExit("No such cart",404);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
XmlExit("No such cart",404);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(!xport_user->editAudio()) {
|
if(!xport_user->editAudio()) {
|
||||||
XmlExit("Unauthorized",401);
|
XmlExit("Unauthorized",401);
|
||||||
}
|
}
|
||||||
|
if(create&&(!xport_user->createCarts())) {
|
||||||
|
XmlExit("Unauthorized",401);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Load Configuration
|
// Load Configuration
|
||||||
//
|
//
|
||||||
RDCart *cart=new RDCart(cartnum);
|
RDCart *cart=new RDCart(cartnum);
|
||||||
RDCut *cut=new RDCut(cartnum,cutnum);
|
if(!RDCart::exists(cartnum)) {
|
||||||
|
if(create) {
|
||||||
|
if(group_name.isEmpty()) {
|
||||||
|
XmlExit("Missing GROUP_NAME",400);
|
||||||
|
}
|
||||||
|
RDGroup *group=new RDGroup(group_name);
|
||||||
|
if(!group->exists()) {
|
||||||
|
XmlExit("No such group",404);
|
||||||
|
}
|
||||||
|
if(!group->cartNumberValid(cartnum)) {
|
||||||
|
XmlExit("Cart number out of range for group",401);
|
||||||
|
}
|
||||||
|
cart->create(group_name,RDCart::Audio);
|
||||||
|
delete group;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
XmlExit("No such cart",404);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RDCut *cut=NULL;
|
||||||
|
if(RDCut::exists(cartnum,cutnum)) {
|
||||||
|
cut=new RDCut(cartnum,cutnum);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(create) {
|
||||||
|
cut=new RDCut(cartnum,cutnum,true);
|
||||||
|
cut->setDescription(QString().sprintf("Cut %03d",cutnum));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
XmlExit("No such cut",404);
|
||||||
|
}
|
||||||
|
}
|
||||||
RDLibraryConf *conf=new RDLibraryConf(xport_config->stationName(),0);
|
RDLibraryConf *conf=new RDLibraryConf(xport_config->stationName(),0);
|
||||||
RDSettings *settings=new RDSettings();
|
RDSettings *settings=new RDSettings();
|
||||||
switch(conf->defaultFormat()) {
|
switch(conf->defaultFormat()) {
|
||||||
|
@ -38,6 +38,14 @@
|
|||||||
<td><input type="text" name="USE_METADATA" size="2" maxlength="1"></td>
|
<td><input type="text" name="USE_METADATA" size="2" maxlength="1"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
<td align="right">CREATE:</td>
|
||||||
|
<td><input type="text" name="CREATE" size="2" maxlength="1"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="right">GROUP_NAME:</td>
|
||||||
|
<td><input type="text" name="GROUP_NAME" size="20" maxlength="20"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
<td align="right">FILE:</td>
|
<td align="right">FILE:</td>
|
||||||
<td><input type="file" name="FILENAME" size="20" maxlength="64"></td>
|
<td><input type="file" name="FILENAME" size="20" maxlength="64"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user