2017-05-17 Fred Gleason <fredg@paravelsystems.com>

* Added an 'RDSystem::xml()' method in 'lib/rdsystem.cpp' and
	'lib/rdsystem.h'.
	* Added a 'ListSystemSettings' web API call.
This commit is contained in:
Fred Gleason 2017-05-17 12:33:49 -04:00
parent c4af1a9f1b
commit bfcdaa6dfc
11 changed files with 145 additions and 0 deletions

View File

@ -15773,3 +15773,7 @@
CD-TEXT.
2017-05-11 Fred Gleason <fredg@paravelsystems.com>
* Removed debug printfs from 'lib/rdcddblookup.cpp'.
2017-05-17 Fred Gleason <fredg@paravelsystems.com>
* Added an 'RDSystem::xml()' method in 'lib/rdsystem.cpp' and
'lib/rdsystem.h'.
* Added a 'ListSystemSettings' web API call.

View File

@ -2585,6 +2585,51 @@
</table>
</sect1>
<sect1>
<title>ListSystemSettings</title>
<subtitle>Return information about system-wide settings</subtitle>
<para>
Command Code: <code>RDXPORT_COMMAND_LISTSYSTEMSETTINGS</code>
</para>
<para>
Required User Permissions: none
</para>
<table xml:id="ex.listsystemsettings" frame="all">
<title>ListSystemSettings Call Fields</title>
<tgroup cols="3" align="left" colsep="1" rowsep="1">
<colspec colname="FIELD NAME" />
<colspec colname="MEANING" />
<colspec colname="REMARKS" />
<thead>
<row>
<entry>
FIELD NAME
</entry>
<entry>
MEANING
</entry>
<entry>
REMARKS
</entry>
</row>
</thead>
<tbody>
<row>
<entry>
COMMAND
</entry>
<entry>
33
</entry>
<entry>
Mandatory
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1>
<title>Rehash</title>
<subtitle>Generate a SHA-1 hash for a cut and write it to the database</subtitle>

View File

@ -22,6 +22,7 @@
#include <rddb.h>
#include <rdconf.h>
#include <rdsystem.h>
#include <rdweb.h>
RDSystem::RDSystem()
{
@ -117,6 +118,20 @@ void RDSystem::setTempCartGroup(const QString &str) const
}
QString RDSystem::xml() const
{
QString xml="<systemSettings>\n";
xml+=RDXmlField("sampleRate",sampleRate());
xml+=RDXmlField("duplicateTitles",allowDuplicateCartTitles());
xml+=RDXmlField("maxPostLength",maxPostLength());
xml+=RDXmlField("isciXreferencePath",isciXreferencePath());
xml+=RDXmlField("tempCartGroup",tempCartGroup());
xml+="</systemSettings>\n";
return xml;
}
QVariant RDSystem::GetValue(const QString &field) const
{
QVariant ret;

View File

@ -37,6 +37,7 @@ class RDSystem
void setIsciXreferencePath(const QString &str) const;
QString tempCartGroup() const;
void setTempCartGroup(const QString &str) const;
QString xml() const;
private:
QVariant GetValue(const QString &field) const;

View File

@ -53,6 +53,7 @@
#define RDXPORT_COMMAND_DELETELOG 30
#define RDXPORT_COMMAND_CREATETICKET 31
#define RDXPORT_COMMAND_REHASH 32
#define RDXPORT_COMMAND_LISTSYSTEMSETTINGS 33
#endif // RDXPORT_INTERFACE_H

View File

@ -42,6 +42,7 @@ dist_rdxport_cgi_SOURCES = audioinfo.cpp\
rehash.cpp\
schedcodes.cpp\
services.cpp\
systemsettings.cpp\
trimaudio.cpp
rdxport_cgi_LDADD = @LIB_RDLIBS@ -lsndfile @LIBVORBIS@

View File

@ -266,6 +266,10 @@ Xport::Xport(QObject *parent)
ListServices();
break;
case RDXPORT_COMMAND_LISTSYSTEMSETTINGS:
ListSystemSettings();
break;
case RDXPORT_COMMAND_REHASH:
Rehash();
break;

View File

@ -76,6 +76,7 @@ class Xport : public QObject
void UnassignSchedCode();
void ListCartSchedCodes();
void ListServices();
void ListSystemSettings();
void Exit(int code);
void XmlExit(const QString &msg,int code,
const QString &srcfile="",int line=-1,

View File

@ -0,0 +1,45 @@
// listsystemsettings.cpp
//
// Rivendell web service portal -- ListSystemSettings service
//
// (C) Copyright 2011,2016 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 <stdint.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <rdformpost.h>
#include <rdweb.h>
#include <rdsystem.h>
#include <rdconf.h>
#include <rdxport.h>
void Xport::ListSystemSettings()
{
RDSystem *sys=new RDSystem();
//
// Send Data
//
printf("Content-type: application/xml\n\n");
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
printf("%s\n",(const char *)sys->xml());
Exit(0);
}

View File

@ -50,6 +50,7 @@ install-exec-am:
cp listlogs.html $(DESTDIR)@libexecdir@
cp listschedcodes.html $(DESTDIR)@libexecdir@
cp listservices.html $(DESTDIR)@libexecdir@
cp listsystemsettings.html $(DESTDIR)@libexecdir@
cp rehash.html $(DESTDIR)@libexecdir@
cp removecart.html $(DESTDIR)@libexecdir@
cp removecut.html $(DESTDIR)@libexecdir@
@ -87,6 +88,7 @@ uninstall-local:
rm -f $(DESTDIR)@libexecdir@/listlogs.html
rm -f $(DESTDIR)@libexecdir@/listschedcodes.html
rm -f $(DESTDIR)@libexecdir@/listservices.html
rm -f $(DESTDIR)@libexecdir@/listsystemsettings.html
rm -f $(DESTDIR)@libexecdir@/rehash.html
rm -f $(DESTDIR)@libexecdir@/removecart.html
rm -f $(DESTDIR)@libexecdir@/removecut.html
@ -123,6 +125,7 @@ EXTRA_DIST = addcart.html\
listlogs.html\
listschedcodes.html\
listservices.html\
listsystemsettings.html\
rehash.html\
removecart.html\
removecut.html\

View File

@ -0,0 +1,25 @@
<html>
<head>
<title>Rivendell LISTSYSTEMSETTINGS Service Test Harness</title>
<body>
<form action="/rd-bin/rdxport.cgi" method="post" enctype="multipart/form-data">
<input type="hidden" name="COMMAND" value="33">
<table cellpadding="0" cellspacing="2" border="0">
<tr>
<td align="right">LOGIN NAME:</td>
<td><input type="text" name="LOGIN_NAME" size="20" maxlength="255"></td>
</tr>
<tr>
<td align="right">PASSWORD:</td>
<td><input type="password" name="PASSWORD" size="20" maxlength="32"></td>
</tr>
<tr>
<td colspan="2" align="right">&nbsp;</td>
</tr>
<tr>
<td colspan="2" align="right"><input type="submit" value="OK"></td>
</tr>
</table>
</form>
</body>
</html>