mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2026-01-12 07:35:55 +01:00
Initial import of CVS-v2_8_branch
This commit is contained in:
51
web/Makefile.am
Normal file
51
web/Makefile.am
Normal file
@@ -0,0 +1,51 @@
|
||||
## automake.am
|
||||
##
|
||||
## Automake.am for rivendell/web
|
||||
##
|
||||
## (C) Copyright 2002-2007 Fred Gleason <fredg@paravelsystems.com>
|
||||
##
|
||||
## $Id: Makefile.am,v 1.4.8.1 2012/11/29 01:37:38 cvs Exp $
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as
|
||||
## published by the Free Software Foundation; either version 2 of
|
||||
## the License, or (at your option) any later version.
|
||||
##
|
||||
## 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.
|
||||
##
|
||||
## Use automake to process this into a Makefile.in
|
||||
|
||||
SUBDIRS = rdcastmanager\
|
||||
rdfeed\
|
||||
rdxport\
|
||||
tests
|
||||
|
||||
AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -DQTDIR=\"@QT_DIR@\" @QT_CXXFLAGS@
|
||||
INCLUDES = -I$(top_srcdir)/lib
|
||||
LIBS = @QT_LIBS@ -L$(top_srcdir)/lib
|
||||
MOC = @QT_MOC@
|
||||
|
||||
# The dependency for qt's Meta Object Compiler (moc)
|
||||
moc_%.cpp: %.h
|
||||
$(MOC) $< -o $@
|
||||
|
||||
EXTRA_DIST = web.pro
|
||||
|
||||
CLEANFILES = *~\
|
||||
*.idb\
|
||||
*ilk\
|
||||
*.obj\
|
||||
*.pdb\
|
||||
*.qm\
|
||||
moc_*
|
||||
|
||||
MAINTAINERCLEANFILES = *~\
|
||||
Makefile.in\
|
||||
moc_*
|
||||
53
web/rdcastmanager/Makefile.am
Normal file
53
web/rdcastmanager/Makefile.am
Normal file
@@ -0,0 +1,53 @@
|
||||
## automake.am
|
||||
##
|
||||
## Automake.am for rivendell/web/rdcastmanager
|
||||
##
|
||||
## (C) Copyright 2002-2007 Fred Gleason <fredg@paravelsystems.com>
|
||||
##
|
||||
## $Id: Makefile.am,v 1.4.8.1 2012/11/29 01:37:38 cvs Exp $
|
||||
##
|
||||
## 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.
|
||||
##
|
||||
## Use automake to process this into a Makefile.in
|
||||
|
||||
AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -DQTDIR=\"@QT_DIR@\" @QT_CXXFLAGS@
|
||||
INCLUDES = -I$(top_srcdir)/lib
|
||||
LIBS = @QT_LIBS@ -L$(top_srcdir)/lib
|
||||
MOC = @QT_MOC@
|
||||
|
||||
# The dependency for qt's Meta Object Compiler (moc)
|
||||
moc_%.cpp: %.h
|
||||
$(MOC) $< -o $@
|
||||
|
||||
libexec_PROGRAMS = rdcastmanager.cgi
|
||||
libexec_SCRIPTS = rdcastmanager.js
|
||||
|
||||
dist_rdcastmanager_cgi_SOURCES = rdcastmanager.cpp rdcastmanager.h
|
||||
|
||||
rdcastmanager_cgi_LDADD = @LIB_RDLIBS@ @LIBVORBIS@
|
||||
|
||||
EXTRA_DIST = rdcastmanager.js\
|
||||
rdcastmanager.pro
|
||||
|
||||
CLEANFILES = *~\
|
||||
*.idb\
|
||||
*ilk\
|
||||
*.obj\
|
||||
*.pdb\
|
||||
*.qm\
|
||||
moc_*
|
||||
|
||||
MAINTAINERCLEANFILES = *~\
|
||||
Makefile.in\
|
||||
moc_*
|
||||
1928
web/rdcastmanager/rdcastmanager.cpp
Normal file
1928
web/rdcastmanager/rdcastmanager.cpp
Normal file
File diff suppressed because it is too large
Load Diff
94
web/rdcastmanager/rdcastmanager.h
Normal file
94
web/rdcastmanager/rdcastmanager.h
Normal file
@@ -0,0 +1,94 @@
|
||||
// rdcastmanager.h
|
||||
//
|
||||
// Web-Based RSS Podcast Manager for Rivendell.
|
||||
//
|
||||
// (C) Copyright 2002-2007 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: rdcastmanager.h,v 1.5 2010/07/29 19:32:40 cvs Exp $
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
|
||||
#ifndef RDCASTMANAGER_H
|
||||
#define RDCASTMANAGER_H
|
||||
|
||||
#include <qobject.h>
|
||||
#include <qsqldatabase.h>
|
||||
#include <qhostaddress.h>
|
||||
|
||||
#include <rdformpost.h>
|
||||
|
||||
//
|
||||
// CGI Values
|
||||
//
|
||||
#define RDCASTMANAGER_POST_SIZE 4096
|
||||
#define RDCASTMANAGER_MAX_FILTER_LENGTH 256
|
||||
#define RDCASTMANAGER_COMMAND_LOGIN 0
|
||||
#define RDCASTMANAGER_COMMAND_LOGOUT 1
|
||||
#define RDCASTMANAGER_COMMAND_LIST_FEEDS 2
|
||||
#define RDCASTMANAGER_COMMAND_LIST_CASTS 3
|
||||
#define RDCASTMANAGER_COMMAND_EDIT_CAST 4
|
||||
#define RDCASTMANAGER_COMMAND_COMMIT_CAST 5
|
||||
#define RDCASTMANAGER_COMMAND_CONFIRM_DELETE_CAST 6
|
||||
#define RDCASTMANAGER_COMMAND_DELETE_CAST 7
|
||||
#define RDCASTMANAGER_COMMAND_SUBSCRIPTION_PICK_DATES 8
|
||||
#define RDCASTMANAGER_COMMAND_SUBSCRIPTION_REPORT 9
|
||||
#define RDCASTMANAGER_COMMAND_EPISODE_PICK_DATES 10
|
||||
#define RDCASTMANAGER_COMMAND_EPISODE_REPORT 11
|
||||
#define RDCASTMANAGER_COMMAND_PLAY_CAST 12
|
||||
#define RDCASTMANAGER_COMMAND_POST_EPISODE 13
|
||||
|
||||
class MainObject : public QObject
|
||||
{
|
||||
public:
|
||||
MainObject(QObject *parent=0,const char *name=0);
|
||||
|
||||
private:
|
||||
int AuthenticatePost();
|
||||
void ServeLogin();
|
||||
void ServeLogout();
|
||||
void ServeListFeeds();
|
||||
void ServeListCasts();
|
||||
void ServeEditCast(int cast_id=-1);
|
||||
void ServePlay();
|
||||
void CommitCast();
|
||||
void ConfirmDeleteCast();
|
||||
void DeleteCast();
|
||||
void ServeSubscriptionReport();
|
||||
void ServeEpisodeReport();
|
||||
void PostEpisode();
|
||||
void ServeDatePicker(int cmd);
|
||||
void TitleSection(const QString &title,int cmd,int colspan) const;
|
||||
void GetUserPerms();
|
||||
void GetContext();
|
||||
void SetContext(int cmd) const;
|
||||
void Exit(int code);
|
||||
RDFormPost *cast_post;
|
||||
QString cast_login_name;
|
||||
long int cast_session_id;
|
||||
QHostAddress cast_client_addr;
|
||||
QString cast_key_name;
|
||||
int cast_feed_id;
|
||||
int cast_cast_id;
|
||||
bool cast_add_priv;
|
||||
bool cast_edit_priv;
|
||||
bool cast_delete_priv;
|
||||
QDate cast_start_date;
|
||||
QDate cast_end_date;
|
||||
RDConfig *cast_config;
|
||||
};
|
||||
|
||||
|
||||
#endif // RDCASTMANAGER_H
|
||||
39
web/rdcastmanager/rdcastmanager.js
Normal file
39
web/rdcastmanager/rdcastmanager.js
Normal file
@@ -0,0 +1,39 @@
|
||||
// rdcastmanager.js
|
||||
//
|
||||
// Script for displaying an upload progress dialog in a web browser.
|
||||
//
|
||||
// (C) Copyright 2009 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: rdcastmanager.js,v 1.2 2010/07/29 19:32:40 cvs Exp $
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
function StartProgressbar()
|
||||
{
|
||||
var html='<table cellpadding=\"10\" cellspacing=\"0\" border=\"0\" width=\"600\" height=\"400\">\n'+
|
||||
'<tr height=\"200\" bgcolor=\"#e0e0e0\">'+
|
||||
'<td align=\"center\" valign=\"bottom\">\n'+
|
||||
'<big><big>File uploading, please stand by...</big></big></td></tr>\n'+
|
||||
'<tr bgcolor=\"#e0e0e0\"><td align=\"center\" valign=\"top\">\n'+
|
||||
'<img src=\"progressbar.gif\" border=\"1\"></td></tr>\n'+
|
||||
'</table>\n';
|
||||
|
||||
document.getElementById("bigframe").innerHTML=html;
|
||||
}
|
||||
|
||||
function PostCast()
|
||||
{
|
||||
window.setTimeout('StartProgressbar()',10);
|
||||
}
|
||||
0
web/rdcastmanager/rdcastmanager.pro
Normal file
0
web/rdcastmanager/rdcastmanager.pro
Normal file
53
web/rdfeed/Makefile.am
Normal file
53
web/rdfeed/Makefile.am
Normal file
@@ -0,0 +1,53 @@
|
||||
## automake.am
|
||||
##
|
||||
## Automake.am for rivendell/web/rdfeed
|
||||
##
|
||||
## (C) Copyright 2002-2007 Fred Gleason <fredg@paravelsystems.com>
|
||||
##
|
||||
## $Id: Makefile.am,v 1.7.8.1 2012/11/29 01:37:38 cvs Exp $
|
||||
##
|
||||
## 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.
|
||||
##
|
||||
## Use automake to process this into a Makefile.in
|
||||
|
||||
AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -DQTDIR=\"@QT_DIR@\" @QT_CXXFLAGS@
|
||||
INCLUDES = -I$(top_srcdir)/lib
|
||||
LIBS = @QT_LIBS@ -L$(top_srcdir)/lib
|
||||
MOC = @QT_MOC@
|
||||
|
||||
install-exec-local:
|
||||
if test ! -f $(DESTDIR)@libexecdir@/rdfeed.mp3 ; then ln -s $(DESTDIR)@libexecdir@/rdfeed.xml $(DESTDIR)@libexecdir@/rdfeed.mp3 ; fi
|
||||
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)@libexecdir@/rdfeed.mp3
|
||||
|
||||
libexec_PROGRAMS = rdfeed.xml
|
||||
|
||||
dist_rdfeed_xml_SOURCES = rdfeed_script.cpp rdfeed_script.h
|
||||
|
||||
rdfeed_xml_LDADD = @LIB_RDLIBS@ @LIBVORBIS@
|
||||
|
||||
EXTRA_DIST = rdfeed.pro
|
||||
|
||||
CLEANFILES = *~\
|
||||
*.idb\
|
||||
*ilk\
|
||||
*.obj\
|
||||
*.pdb\
|
||||
*.qm\
|
||||
moc_*
|
||||
|
||||
MAINTAINERCLEANFILES = *~\
|
||||
Makefile.in\
|
||||
moc_*
|
||||
0
web/rdfeed/rdfeed.pro
Normal file
0
web/rdfeed/rdfeed.pro
Normal file
397
web/rdfeed/rdfeed_script.cpp
Normal file
397
web/rdfeed/rdfeed_script.cpp
Normal file
@@ -0,0 +1,397 @@
|
||||
// rdfeed_script.cpp
|
||||
//
|
||||
// An RSS Feed Generator for Rivendell.
|
||||
//
|
||||
// (C) Copyright 2002-2007 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: rdfeed_script.cpp,v 1.5.4.1 2013/10/16 21:14:38 cvs Exp $
|
||||
//
|
||||
// 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 <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qdatetime.h>
|
||||
#include <qstringlist.h>
|
||||
|
||||
#include <rdconf.h>
|
||||
#include <rdconfig.h>
|
||||
#include <rdpodcast.h>
|
||||
#include <rddb.h>
|
||||
#include <rdweb.h>
|
||||
#include <rdfeedlog.h>
|
||||
#include <rdformpost.h>
|
||||
#include <rdfeed.h>
|
||||
#include <dbversion.h>
|
||||
|
||||
#include <rdfeed_script.h>
|
||||
|
||||
char server_name[PATH_MAX];
|
||||
|
||||
MainObject::MainObject(QObject *parent,const char *name)
|
||||
:QObject(parent,name)
|
||||
{
|
||||
char keyname[10];
|
||||
int cast_id=-1;
|
||||
bool count;
|
||||
|
||||
//
|
||||
// Validate Feed Key Name
|
||||
//
|
||||
if(getenv("QUERY_STRING")==NULL) {
|
||||
printf("Content-type: text/html\n\n");
|
||||
printf("rdfeed: missing feed key name\n");
|
||||
exit(0);
|
||||
}
|
||||
int arg=0;
|
||||
while((getenv("QUERY_STRING")[arg]!=0)&&
|
||||
(getenv("QUERY_STRING")[arg]!='&')&&(arg<9)) {
|
||||
keyname[arg]=getenv("QUERY_STRING")[arg];
|
||||
arg++;
|
||||
}
|
||||
if(arg==9) {
|
||||
printf("Content-type: text/html\n\n");
|
||||
printf("rdfeed: invalid feed key name\n");
|
||||
exit(0);
|
||||
}
|
||||
keyname[arg]=0;
|
||||
RDGetPostInt(getenv("QUERY_STRING")+arg+1,"cast_id",&cast_id);
|
||||
|
||||
//
|
||||
// Get the Server Name
|
||||
//
|
||||
if(getenv("SERVER_NAME")==NULL) {
|
||||
printf("Content-type: text/html\n\n");
|
||||
printf("rdfeed: missing SERVER_NAME\n");
|
||||
exit(0);
|
||||
}
|
||||
strncpy(server_name,getenv("SERVER_NAME"),PATH_MAX);
|
||||
|
||||
//
|
||||
// Read Configuration
|
||||
//
|
||||
RDConfig *config=new RDConfig();
|
||||
config->load();
|
||||
|
||||
//
|
||||
// Determine Range
|
||||
//
|
||||
if(getenv("HTTP_RANGE")!=NULL) {
|
||||
count=ShouldCount(getenv("HTTP_RANGE"));
|
||||
}
|
||||
else {
|
||||
count=true;
|
||||
}
|
||||
|
||||
//
|
||||
// Open Database
|
||||
//
|
||||
QSqlDatabase *db=QSqlDatabase::addDatabase(config->mysqlDriver());
|
||||
if(!db) {
|
||||
printf("Content-type: text/html\n\n");
|
||||
printf("rdfeed: unable to initialize connection to database\n");
|
||||
exit(0);
|
||||
}
|
||||
db->setDatabaseName(config->mysqlDbname());
|
||||
db->setUserName(config->mysqlUsername());
|
||||
db->setPassword(config->mysqlPassword());
|
||||
db->setHostName(config->mysqlHostname());
|
||||
if(!db->open()) {
|
||||
printf("Content-type: text/html\n\n");
|
||||
printf("rdfeed: unable to connect to database\n");
|
||||
db->removeDatabase(config->mysqlDbname());
|
||||
exit(0);
|
||||
}
|
||||
RDSqlQuery *q=new RDSqlQuery("select DB from VERSION");
|
||||
if(!q->first()) {
|
||||
printf("Content-type: text/html\n");
|
||||
printf("Status: 500\n\n");
|
||||
printf("rdfeed: missing/invalid database version!\n");
|
||||
db->removeDatabase(config->mysqlDbname());
|
||||
exit(0);
|
||||
}
|
||||
if(q->value(0).toUInt()!=RD_VERSION_DATABASE) {
|
||||
printf("Content-type: text/html\n");
|
||||
printf("Status: 500\n\n");
|
||||
printf("rdfeed: skewed database version!\n");
|
||||
db->removeDatabase(config->mysqlDbname());
|
||||
exit(0);
|
||||
}
|
||||
delete q;
|
||||
|
||||
if(cast_id<0) {
|
||||
ServeRss(keyname,count);
|
||||
}
|
||||
ServeLink(keyname,cast_id,count);
|
||||
}
|
||||
|
||||
|
||||
void MainObject::ServeRss(const char *keyname,bool count)
|
||||
{
|
||||
QString sql;
|
||||
RDSqlQuery *q;
|
||||
RDSqlQuery *q1;
|
||||
|
||||
sql=QString().sprintf("select CHANNEL_TITLE,CHANNEL_DESCRIPTION,\
|
||||
CHANNEL_CATEGORY,CHANNEL_LINK,CHANNEL_COPYRIGHT,\
|
||||
CHANNEL_WEBMASTER,CHANNEL_LANGUAGE,\
|
||||
LAST_BUILD_DATETIME,ORIGIN_DATETIME,\
|
||||
HEADER_XML,CHANNEL_XML,ITEM_XML,BASE_URL,ID, \
|
||||
UPLOAD_EXTENSION,CAST_ORDER,REDIRECT_PATH,\
|
||||
BASE_PREAMBLE from FEEDS \
|
||||
where KEY_NAME=\"%s\"",keyname);
|
||||
q=new RDSqlQuery(sql);
|
||||
if(!q->first()) {
|
||||
printf("Content-type: text/html\n\n");
|
||||
printf("rdfeed: no feed matches the supplied key name\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
//
|
||||
// Log the Access
|
||||
//
|
||||
if(count) {
|
||||
RDIncrementFeedCount(keyname);
|
||||
}
|
||||
|
||||
//
|
||||
// Redirect if necessary
|
||||
//
|
||||
if(!q->value(16).toString().isEmpty()) {
|
||||
Redirect(q->value(16).toString());
|
||||
delete q;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
//
|
||||
// Generate CGI Header
|
||||
//
|
||||
printf("Content-type: application/rss+xml\n\n");
|
||||
|
||||
//
|
||||
// Render Header XML
|
||||
//
|
||||
printf("%s\n",(const char *)q->value(9).toString());
|
||||
|
||||
//
|
||||
// Render Channel XML
|
||||
//
|
||||
printf("<channel>\n");
|
||||
printf("%s\n",(const char *)ResolveChannelWildcards(q));
|
||||
|
||||
//
|
||||
// Render Item XML
|
||||
//
|
||||
sql=QString().sprintf("select ITEM_TITLE,ITEM_DESCRIPTION,ITEM_CATEGORY,\
|
||||
ITEM_LINK,ITEM_AUTHOR,ITEM_SOURCE_TEXT,\
|
||||
ITEM_SOURCE_URL,ITEM_COMMENTS,\
|
||||
AUDIO_FILENAME,AUDIO_LENGTH,AUDIO_TIME,\
|
||||
EFFECTIVE_DATETIME,ID from PODCASTS \
|
||||
where (FEED_ID=%d)&&(STATUS=%d) \
|
||||
order by EFFECTIVE_DATETIME",
|
||||
q->value(13).toUInt(),RDPodcast::StatusActive);
|
||||
if(q->value(15).toString()=="N") {
|
||||
sql+=" desc";
|
||||
}
|
||||
q1=new RDSqlQuery(sql);
|
||||
while(q1->next()) {
|
||||
printf("<item>\n");
|
||||
printf("%s\n",(const char *)
|
||||
ResolveAuxWildcards(ResolveItemWildcards(keyname,q1,q),
|
||||
getenv("QUERY_STRING"),
|
||||
q->value(13).toUInt(),
|
||||
q1->value(7).toUInt()));
|
||||
// printf("%s\n",(const char *)ResolveItemWildcards(q1,q));
|
||||
printf("</item>\n");
|
||||
}
|
||||
delete q1;
|
||||
|
||||
printf("</channel>\n");
|
||||
printf("</rss>\n");
|
||||
delete q;
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
void MainObject::ServeLink(const char *keyname,int cast_id,bool count)
|
||||
{
|
||||
QString sql;
|
||||
RDSqlQuery *q;
|
||||
|
||||
sql=QString().sprintf("select FEEDS.BASE_URL,PODCASTS.AUDIO_FILENAME from \
|
||||
FEEDS left join PODCASTS \
|
||||
on FEEDS.ID=PODCASTS.FEED_ID \
|
||||
where (FEEDS.KEY_NAME=\"%s\")&&(PODCASTS.ID=%d)",
|
||||
(const char *)keyname,cast_id);
|
||||
q=new RDSqlQuery(sql);
|
||||
if(!q->first()) {
|
||||
delete q;
|
||||
RDCgiError("Unable to retrieve cast record!");
|
||||
}
|
||||
if(count) {
|
||||
RDIncrementCastCount(keyname,cast_id);
|
||||
}
|
||||
printf("Content-type: audio/x-mpeg\n");
|
||||
printf("Location: %s/%s\n\n",(const char *)q->value(0).toString(),
|
||||
(const char *)q->value(1).toString());
|
||||
delete q;
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
QString MainObject::ResolveChannelWildcards(RDSqlQuery *chan_q)
|
||||
{
|
||||
QString ret=chan_q->value(10).toString();
|
||||
ret.replace("%TITLE%",RDXmlEscape(chan_q->value(0).toString()));
|
||||
ret.replace("%DESCRIPTION%",RDXmlEscape(chan_q->value(1).toString()));
|
||||
ret.replace("%CATEGORY%",RDXmlEscape(chan_q->value(2).toString()));
|
||||
ret.replace("%LINK%",RDXmlEscape(chan_q->value(3).toString()));
|
||||
ret.replace("%COPYRIGHT%",RDXmlEscape(chan_q->value(4).toString()));
|
||||
ret.replace("%WEBMASTER%",RDXmlEscape(chan_q->value(5).toString()));
|
||||
ret.replace("%LANGUAGE%",RDXmlEscape(chan_q->value(6).toString()));
|
||||
ret.replace("%BUILD_DATE%",chan_q->value(7).toDateTime().
|
||||
toString("ddd, d MMM yyyy hh:mm:ss ")+"GMT");
|
||||
ret.replace("%PUBLISH_DATE%",chan_q->value(8).toDateTime().
|
||||
toString("ddd, d MMM yyyy hh:mm:ss ")+"GMT");
|
||||
ret.replace("%GENERATOR%",QString().sprintf("Rivendell %s",VERSION));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
QString MainObject::ResolveItemWildcards(const QString &keyname,
|
||||
RDSqlQuery *item_q,RDSqlQuery *chan_q)
|
||||
{
|
||||
RDFeed *feed=new RDFeed(keyname);
|
||||
QString ret=chan_q->value(11).toString();
|
||||
ret.replace("%ITEM_TITLE%",RDXmlEscape(item_q->value(0).toString()));
|
||||
ret.replace("%ITEM_DESCRIPTION%",
|
||||
RDXmlEscape(item_q->value(1).toString()));
|
||||
ret.replace("%ITEM_CATEGORY%",
|
||||
RDXmlEscape(item_q->value(2).toString()));
|
||||
ret.replace("%ITEM_LINK%",RDXmlEscape(item_q->value(3).toString()));
|
||||
ret.replace("%ITEM_AUTHOR%",RDXmlEscape(item_q->value(4).toString()));
|
||||
ret.replace("%ITEM_SOURCE_TEXT%",
|
||||
RDXmlEscape(item_q->value(5).toString()));
|
||||
ret.replace("%ITEM_SOURCE_URL%",
|
||||
RDXmlEscape(item_q->value(6).toString()));
|
||||
ret.replace("%ITEM_COMMENTS%",
|
||||
RDXmlEscape(item_q->value(7).toString()));
|
||||
ret.replace("%ITEM_AUDIO_URL%",
|
||||
(const char *)RDXmlEscape(feed->
|
||||
audioUrl(RDFeed::LinkCounted,server_name,
|
||||
item_q->value(12).toUInt())));
|
||||
ret.replace("%ITEM_AUDIO_LENGTH%",item_q->value(9).toString());
|
||||
ret.replace("%ITEM_AUDIO_TIME%",
|
||||
RDGetTimeLength(item_q->value(10).toInt(),false,false));
|
||||
ret.replace("%ITEM_PUBLISH_DATE%",item_q->value(11).toDateTime().
|
||||
toString("ddd, d MMM yyyy hh:mm:ss ")+"GMT");
|
||||
ret.replace("%ITEM_GUID%",RDPodcast::guid(chan_q->value(12).toString(),
|
||||
item_q->value(8).toString(),
|
||||
chan_q->value(11).toUInt(),
|
||||
item_q->value(12).toUInt()));
|
||||
delete feed;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
QString MainObject::ResolveAuxWildcards(QString xml,QString keyname,
|
||||
unsigned feed_id,unsigned cast_id)
|
||||
{
|
||||
QString sql;
|
||||
RDSqlQuery *q;
|
||||
RDSqlQuery *q1;
|
||||
|
||||
keyname.replace(" ","_");
|
||||
sql=QString().sprintf("select VAR_NAME from AUX_METADATA where FEED_ID=%u",
|
||||
feed_id);
|
||||
q=new RDSqlQuery(sql);
|
||||
if(q->size()==0) {
|
||||
delete q;
|
||||
return xml;
|
||||
}
|
||||
sql="select ";
|
||||
while(q->next()) {
|
||||
sql+=q->value(0).toString().mid(1,q->value(0).toString().length()-2);
|
||||
sql+=",";
|
||||
}
|
||||
sql=sql.left(sql.length()-1);
|
||||
sql+=QString().sprintf(" from %s_FIELDS where CAST_ID=%u",
|
||||
(const char *)keyname,cast_id);
|
||||
q->seek(-1);
|
||||
q1=new RDSqlQuery(sql);
|
||||
while(q1->next()) {
|
||||
q->next();
|
||||
xml.replace(q->value(0).toString(),
|
||||
RDXmlEscape(q1->value(0).toString()));
|
||||
}
|
||||
delete q1;
|
||||
delete q;
|
||||
|
||||
return xml;
|
||||
}
|
||||
|
||||
|
||||
bool MainObject::ShouldCount(const QString &hdr)
|
||||
{
|
||||
bool ret=false;
|
||||
QStringList lines=QStringList::split("\n",hdr);
|
||||
int n;
|
||||
QString str;
|
||||
|
||||
for(unsigned i=0;i<lines.size();i++) {
|
||||
if((n=lines[i].find("="))>0) {
|
||||
if(lines[i].left(n).lower()=="bytes") {
|
||||
str=lines[i].right(lines[i].length()-n-1).stripWhiteSpace();
|
||||
n=str.find("-");
|
||||
if(n==0) {
|
||||
ret=true;
|
||||
}
|
||||
if(n>0) {
|
||||
if(str.left(n)=="0") {
|
||||
ret=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void MainObject::Redirect(const QString &url)
|
||||
{
|
||||
printf("Status: 301 Moved Permanently\n");
|
||||
printf("Location: %s\n",(const char *)url);
|
||||
printf("Content-type: text/html\n");
|
||||
printf("\n");
|
||||
printf("The feed has been relocated to %s.\n",(const char *)url);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
QApplication a(argc,argv,false);
|
||||
new MainObject(NULL,"main");
|
||||
return a.exec();
|
||||
}
|
||||
51
web/rdfeed/rdfeed_script.h
Normal file
51
web/rdfeed/rdfeed_script.h
Normal file
@@ -0,0 +1,51 @@
|
||||
// rdfeed_script.h
|
||||
//
|
||||
// An RSS Feed Generator for Rivendell.
|
||||
//
|
||||
// (C) Copyright 2002-2007 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: rdfeed_script.h,v 1.2 2010/07/29 19:32:40 cvs Exp $
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
|
||||
#ifndef RDFEED_SCRIPT_H
|
||||
#define RDFEED_SCRIPT_H
|
||||
|
||||
#include <qobject.h>
|
||||
#include <qsqldatabase.h>
|
||||
|
||||
#include <rddb.h>
|
||||
|
||||
|
||||
class MainObject : public QObject
|
||||
{
|
||||
public:
|
||||
MainObject(QObject *parent=0,const char *name=0);
|
||||
|
||||
private:
|
||||
void ServeRss(const char *keyname,bool count);
|
||||
void ServeLink(const char *keyname,int cast_id,bool count);
|
||||
QString ResolveChannelWildcards(RDSqlQuery *chan_q);
|
||||
QString ResolveItemWildcards(const QString &keyname,
|
||||
RDSqlQuery *item_q,RDSqlQuery *chan_q);
|
||||
QString ResolveAuxWildcards(QString xml,QString keyname,unsigned feed_id,
|
||||
unsigned cast_id);
|
||||
bool ShouldCount(const QString &hdr);
|
||||
void Redirect(const QString &url);
|
||||
};
|
||||
|
||||
|
||||
#endif // RDFEED_SCRIPT_H
|
||||
62
web/rdxport/Makefile.am
Normal file
62
web/rdxport/Makefile.am
Normal file
@@ -0,0 +1,62 @@
|
||||
## automake.am
|
||||
##
|
||||
## Automake.am for rivendell/web/rdxport
|
||||
##
|
||||
## (C) Copyright 2010 Fred Gleason <fredg@paravelsystems.com>
|
||||
##
|
||||
## $Id: Makefile.am,v 1.6.6.3 2013/10/11 22:00:52 cvs Exp $
|
||||
##
|
||||
## 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.
|
||||
##
|
||||
## Use automake to process this into a Makefile.in
|
||||
|
||||
AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -DQTDIR=\"@QT_DIR@\" @QT_CXXFLAGS@
|
||||
INCLUDES = -I$(top_srcdir)/lib
|
||||
LIBS = @QT_LIBS@ -L$(top_srcdir)/lib
|
||||
MOC = @QT_MOC@
|
||||
|
||||
libexec_PROGRAMS = rdxport.cgi
|
||||
|
||||
install-exec-hook:
|
||||
chown root $(libexecdir)/rdxport.cgi
|
||||
chmod 4755 $(libexecdir)/rdxport.cgi
|
||||
|
||||
dist_rdxport_cgi_SOURCES = audioinfo.cpp\
|
||||
carts.cpp\
|
||||
copyaudio.cpp\
|
||||
deleteaudio.cpp\
|
||||
groups.cpp\
|
||||
export.cpp\
|
||||
exportpeaks.cpp\
|
||||
import.cpp\
|
||||
logs.cpp\
|
||||
rdxport.cpp rdxport.h\
|
||||
services.cpp\
|
||||
trimaudio.cpp
|
||||
|
||||
rdxport_cgi_LDADD = @LIB_RDLIBS@ -lsndfile @LIBVORBIS@
|
||||
|
||||
EXTRA_DIST = rdxport.pro
|
||||
|
||||
CLEANFILES = *~\
|
||||
*.idb\
|
||||
*ilk\
|
||||
*.obj\
|
||||
*.pdb\
|
||||
*.qm\
|
||||
moc_*
|
||||
|
||||
MAINTAINERCLEANFILES = *~\
|
||||
Makefile.in\
|
||||
moc_*
|
||||
114
web/rdxport/audioinfo.cpp
Normal file
114
web/rdxport/audioinfo.cpp
Normal file
@@ -0,0 +1,114 @@
|
||||
// audioinfo.cpp
|
||||
//
|
||||
// Rivendell web service portal -- AudioInfo service
|
||||
//
|
||||
// (C) Copyright 2011 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: audioinfo.cpp,v 1.4 2012/02/13 23:01:50 cvs Exp $
|
||||
//
|
||||
// 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 <rdcart.h>
|
||||
#include <rdwavefile.h>
|
||||
#include <rdconf.h>
|
||||
|
||||
#include <rdxport.h>
|
||||
|
||||
void Xport::AudioInfo()
|
||||
{
|
||||
RDWaveFile::Format format=RDWaveFile::Pcm16;;
|
||||
|
||||
//
|
||||
// Verify Post
|
||||
//
|
||||
int cartnum=0;
|
||||
if(!xport_post->getValue("CART_NUMBER",&cartnum)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
}
|
||||
int cutnum=0;
|
||||
if(!xport_post->getValue("CUT_NUMBER",&cutnum)) {
|
||||
XmlExit("Missing CUT_NUMBER",400);
|
||||
}
|
||||
|
||||
//
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->cartAuthorized(cartnum)) {
|
||||
XmlExit("No such cart",404);
|
||||
}
|
||||
|
||||
//
|
||||
// Open Audio File
|
||||
//
|
||||
RDWaveFile *wave=new RDWaveFile(RDCut::pathName(cartnum,cutnum));
|
||||
if(!wave->openWave()) {
|
||||
XmlExit("No such audio",404);
|
||||
}
|
||||
|
||||
//
|
||||
// Send Data
|
||||
//
|
||||
printf("Content-type: application/xml\n\n");
|
||||
|
||||
switch(wave->getFormatTag()) {
|
||||
case WAVE_FORMAT_PCM:
|
||||
format=RDWaveFile::Pcm16;
|
||||
break;
|
||||
|
||||
case WAVE_FORMAT_IEEE_FLOAT:
|
||||
format=RDWaveFile::Float32;
|
||||
break;
|
||||
|
||||
case WAVE_FORMAT_MPEG:
|
||||
switch(wave->getHeadLayer()) {
|
||||
case 1:
|
||||
format=RDWaveFile::MpegL1;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
format=RDWaveFile::MpegL2;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
format=RDWaveFile::MpegL3;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
XmlExit("Unknown audio format",400);
|
||||
break;
|
||||
}
|
||||
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
|
||||
printf("<audioInfo>\n");
|
||||
printf(" <cartNumber>%u</cartNumber>\n",cartnum);
|
||||
printf(" <cutNumber>%u</cutNumber>\n",cutnum);
|
||||
printf(" <format>%d</format>\n",format);
|
||||
printf(" <channels>%d</channels>\n",wave->getChannels());
|
||||
printf(" <sampleRate>%d</sampleRate>\n",wave->getSamplesPerSec());
|
||||
printf(" <frames>%u</frames>\n",wave->getSampleLength());
|
||||
printf(" <length>%u</length>\n",wave->getExtTimeLength());
|
||||
printf("</audioInfo>\n");
|
||||
delete wave;
|
||||
Exit(0);
|
||||
}
|
||||
771
web/rdxport/carts.cpp
Normal file
771
web/rdxport/carts.cpp
Normal file
@@ -0,0 +1,771 @@
|
||||
// carts.cpp
|
||||
//
|
||||
// Rivendell web service portal -- Cart services
|
||||
//
|
||||
// (C) Copyright 2010 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: carts.cpp,v 1.8.2.2.2.1 2014/03/19 22:13:01 cvs Exp $
|
||||
//
|
||||
// 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 <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <rdformpost.h>
|
||||
#include <rdweb.h>
|
||||
#include <rduser.h>
|
||||
#include <rdgroup.h>
|
||||
#include <rdconf.h>
|
||||
#include <rdescape_string.h>
|
||||
#include <rdcart_search_text.h>
|
||||
|
||||
#include <rdxport.h>
|
||||
|
||||
void Xport::AddCart()
|
||||
{
|
||||
RDCart *cart;
|
||||
RDGroup *group;
|
||||
QString group_name;
|
||||
QString type;
|
||||
RDCart::Type cart_type=RDCart::All;
|
||||
int cart_number=0;
|
||||
|
||||
//
|
||||
// Verify Post
|
||||
//
|
||||
if(!xport_post->getValue("GROUP_NAME",&group_name)) {
|
||||
XmlExit("Missing GROUP_NAME",400);
|
||||
}
|
||||
if(!xport_post->getValue("TYPE",&type)) {
|
||||
XmlExit("Missing TYPE",400);
|
||||
}
|
||||
if(type.lower()=="audio") {
|
||||
cart_type=RDCart::Audio;
|
||||
}
|
||||
else {
|
||||
if(type.lower()=="macro") {
|
||||
cart_type=RDCart::Macro;
|
||||
}
|
||||
else {
|
||||
XmlExit("Invalid TYPE",400);
|
||||
}
|
||||
}
|
||||
xport_post->getValue("CART_NUMBER",&cart_number);
|
||||
|
||||
//
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->groupAuthorized(group_name)) {
|
||||
XmlExit("No such group",404);
|
||||
}
|
||||
group=new RDGroup(group_name,this);
|
||||
if(cart_number==0) {
|
||||
if((cart_number=group->nextFreeCart())==0) {
|
||||
delete group;
|
||||
XmlExit("No free carts in group",500);
|
||||
}
|
||||
}
|
||||
if(!group->cartNumberValid(cart_number)) {
|
||||
delete group;
|
||||
XmlExit("Cart number out of range for group",401);
|
||||
}
|
||||
delete group;
|
||||
if(!xport_user->createCarts()) {
|
||||
XmlExit("Unauthorized",401);
|
||||
}
|
||||
|
||||
//
|
||||
// Process Request
|
||||
//
|
||||
cart=new RDCart(cart_number);
|
||||
if(cart->exists()) {
|
||||
delete cart;
|
||||
XmlExit("Cart already exists",403);
|
||||
}
|
||||
if(!cart->create(group_name,cart_type)) {
|
||||
delete cart;
|
||||
XmlExit("Unable to create cart",500);
|
||||
}
|
||||
printf("Content-type: application/xml\n");
|
||||
printf("Status: 200\n\n");
|
||||
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
|
||||
printf("<cartAdd>\n");
|
||||
if(cart->exists()) {
|
||||
printf("%s",(const char *)cart->xml(false));
|
||||
}
|
||||
delete cart;
|
||||
printf("</cartAdd>\n");
|
||||
|
||||
Exit(0);
|
||||
}
|
||||
|
||||
|
||||
void Xport::ListCarts()
|
||||
{
|
||||
QString sql;
|
||||
RDSqlQuery *q;
|
||||
QString where="";
|
||||
RDCart *cart;
|
||||
QString group_name;
|
||||
QString filter;
|
||||
int include_cuts;
|
||||
RDCart::Type cart_type=RDCart::All;
|
||||
QString type;
|
||||
|
||||
//
|
||||
// Verify Post
|
||||
//
|
||||
xport_post->getValue("GROUP_NAME",&group_name);
|
||||
xport_post->getValue("FILTER",&filter);
|
||||
xport_post->getValue("INCLUDE_CUTS",&include_cuts);
|
||||
xport_post->getValue("TYPE",&type);
|
||||
if(type.lower()=="audio") {
|
||||
cart_type=RDCart::Audio;
|
||||
}
|
||||
if(type.lower()=="macro") {
|
||||
cart_type=RDCart::Macro;
|
||||
}
|
||||
|
||||
//
|
||||
// Generate Cart List
|
||||
//
|
||||
if(group_name.isEmpty()||(group_name==tr("ALL"))) {
|
||||
where=RDAllCartSearchText(filter,"ALL",xport_user->name(),false);
|
||||
}
|
||||
else {
|
||||
sql=QString().
|
||||
sprintf("select GROUP_NAME from USER_PERMS \
|
||||
where (GROUP_NAME=\"%s\")&&(USER_NAME=\"%s\")",
|
||||
(const char *)RDEscapeString(group_name),
|
||||
(const char *)RDEscapeString(xport_user->name()));
|
||||
q=new RDSqlQuery(sql);
|
||||
if(!q->first()) {
|
||||
delete q;
|
||||
XmlExit("No such group",404);
|
||||
}
|
||||
where=RDCartSearchText(filter,group_name,"",false);
|
||||
}
|
||||
if(cart_type!=RDCart::All) {
|
||||
where+=QString().sprintf("&&(TYPE=%u)",cart_type);
|
||||
}
|
||||
sql="select NUMBER from CART where "+where+"order by NUMBER";
|
||||
q=new RDSqlQuery(sql);
|
||||
|
||||
//
|
||||
// Process Request
|
||||
//
|
||||
printf("Content-type: application/xml\n");
|
||||
printf("Status: 200\n\n");
|
||||
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
|
||||
printf("<cartList>\n");
|
||||
while(q->next()) {
|
||||
cart=new RDCart(q->value(0).toUInt());
|
||||
printf("%s",(const char *)cart->xml(include_cuts));
|
||||
delete cart;
|
||||
}
|
||||
printf("</cartList>\n");
|
||||
|
||||
delete q;
|
||||
Exit(0);
|
||||
}
|
||||
|
||||
|
||||
void Xport::ListCart()
|
||||
|
||||
{
|
||||
QString where="";
|
||||
RDCart *cart;
|
||||
int cart_number;
|
||||
int include_cuts;
|
||||
QString value;
|
||||
|
||||
//
|
||||
// Verify Post
|
||||
//
|
||||
if(!xport_post->getValue("CART_NUMBER",&cart_number)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
}
|
||||
xport_post->getValue("INCLUDE_CUTS",&include_cuts);
|
||||
|
||||
//
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->cartAuthorized(cart_number)) {
|
||||
XmlExit("No such cart",404);
|
||||
}
|
||||
|
||||
//
|
||||
// Process Request
|
||||
//
|
||||
printf("Content-type: application/xml\n");
|
||||
printf("Status: 200\n\n");
|
||||
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
|
||||
printf("<cartList>\n");
|
||||
cart=new RDCart(cart_number);
|
||||
printf("%s",(const char *)cart->xml(include_cuts));
|
||||
delete cart;
|
||||
printf("</cartList>\n");
|
||||
|
||||
Exit(0);
|
||||
}
|
||||
|
||||
|
||||
void Xport::EditCart()
|
||||
{
|
||||
QString where="";
|
||||
RDCart *cart;
|
||||
int cart_number;
|
||||
int include_cuts=0;
|
||||
QString group_name;
|
||||
QString value;
|
||||
int number;
|
||||
bool ok;
|
||||
int line;
|
||||
QString macro;
|
||||
bool length_changed=false;
|
||||
|
||||
//
|
||||
// Verify Post
|
||||
//
|
||||
if(!xport_post->getValue("CART_NUMBER",&cart_number)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
}
|
||||
xport_post->getValue("INCLUDE_CUTS",&include_cuts);
|
||||
|
||||
//
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->cartAuthorized(cart_number)) {
|
||||
XmlExit("No such cart",404);
|
||||
}
|
||||
if(!xport_user->modifyCarts()) {
|
||||
XmlExit("Unauthorized",401);
|
||||
}
|
||||
if(xport_post->getValue("GROUP_NAME",&group_name)) {
|
||||
if(!xport_user->groupAuthorized(group_name)) {
|
||||
XmlExit("No such group",404);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Process Request
|
||||
//
|
||||
cart=new RDCart(cart_number);
|
||||
if(!cart->exists()) {
|
||||
delete cart;
|
||||
XmlExit("No such cart",404);
|
||||
}
|
||||
if(xport_post->getValue("FORCED_LENGTH",&value)) {
|
||||
number=RDSetTimeLength(value);
|
||||
if(cart->type()==RDCart::Macro) {
|
||||
delete cart;
|
||||
XmlExit("Unsupported operation for cart type",403);
|
||||
}
|
||||
if(!cart->validateLengths(number)) {
|
||||
delete cart;
|
||||
XmlExit("Forced length out of range",403);
|
||||
}
|
||||
}
|
||||
switch(cart->type()) {
|
||||
case RDCart::Audio:
|
||||
break;
|
||||
|
||||
case RDCart::Macro:
|
||||
line=0;
|
||||
while(xport_post->getValue(QString().sprintf("MACRO%d",line++),&value)) {
|
||||
value.stripWhiteSpace();
|
||||
if(value.right(1)!="!") {
|
||||
delete cart;
|
||||
XmlExit("Invalid macro data",400);
|
||||
}
|
||||
macro+=value;
|
||||
}
|
||||
cart->setMacros(macro);
|
||||
break;
|
||||
|
||||
case RDCart::All:
|
||||
break;
|
||||
}
|
||||
if(!group_name.isEmpty()) {
|
||||
cart->setGroupName(group_name);
|
||||
}
|
||||
if(xport_post->getValue("TITLE",&value)) {
|
||||
cart->setTitle(value);
|
||||
}
|
||||
if(xport_post->getValue("ARTIST",&value)) {
|
||||
cart->setArtist(value);
|
||||
}
|
||||
if(xport_post->getValue("ALBUM",&value)) {
|
||||
cart->setAlbum(value);
|
||||
}
|
||||
if(xport_post->getValue("YEAR",&value)) {
|
||||
number=value.toInt(&ok);
|
||||
if((ok)&&(number>0)) {
|
||||
cart->setYear(number);
|
||||
}
|
||||
}
|
||||
if(xport_post->getValue("LABEL",&value)) {
|
||||
cart->setLabel(value);
|
||||
}
|
||||
if(xport_post->getValue("CLIENT",&value)) {
|
||||
cart->setClient(value);
|
||||
}
|
||||
if(xport_post->getValue("AGENCY",&value)) {
|
||||
cart->setAgency(value);
|
||||
}
|
||||
if(xport_post->getValue("PUBLISHER",&value)) {
|
||||
cart->setPublisher(value);
|
||||
}
|
||||
if(xport_post->getValue("COMPOSER",&value)) {
|
||||
cart->setComposer(value);
|
||||
}
|
||||
if(xport_post->getValue("USER_DEFINED",&value)) {
|
||||
cart->setUserDefined(value);
|
||||
}
|
||||
if(xport_post->getValue("USAGE_CODE",&value)) {
|
||||
number=value.toInt(&ok);
|
||||
if((ok)&&(number>0)) {
|
||||
cart->setUsageCode((RDCart::UsageCode)number);
|
||||
}
|
||||
}
|
||||
if(xport_post->getValue("ENFORCE_LENGTH",&value)) {
|
||||
number=value.toInt(&ok);
|
||||
if((ok)&&(number>=0)&&(number<2)) {
|
||||
cart->setEnforceLength(number);
|
||||
length_changed=true;
|
||||
}
|
||||
}
|
||||
if(xport_post->getValue("FORCED_LENGTH",&value)) {
|
||||
cart->setForcedLength(RDSetTimeLength(value));
|
||||
length_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("ASYNCRONOUS",&value)) {
|
||||
number=value.toInt(&ok);
|
||||
if((ok)&&(number>=0)&&(number<2)) {
|
||||
cart->setAsyncronous(number);
|
||||
length_changed=true;
|
||||
}
|
||||
}
|
||||
if(xport_post->getValue("OWNER",&value)) {
|
||||
cart->setOwner(value);
|
||||
}
|
||||
if(xport_post->getValue("NOTES",&value)) {
|
||||
cart->setNotes(value);
|
||||
}
|
||||
if(xport_post->getValue("SCHED_CODES",&value)) {
|
||||
cart->setSchedCodes(value);
|
||||
}
|
||||
if(length_changed) {
|
||||
cart->updateLength();
|
||||
}
|
||||
|
||||
printf("Content-type: application/xml\n");
|
||||
printf("Status: 200\n\n");
|
||||
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
|
||||
printf("<cartList>\n");
|
||||
printf("%s",(const char *)cart->xml(include_cuts));
|
||||
delete cart;
|
||||
printf("</cartList>\n");
|
||||
|
||||
Exit(0);
|
||||
}
|
||||
|
||||
|
||||
void Xport::RemoveCart()
|
||||
{
|
||||
RDCart *cart;
|
||||
int cart_number;
|
||||
|
||||
//
|
||||
// Verify Post
|
||||
//
|
||||
if(!xport_post->getValue("CART_NUMBER",&cart_number)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
}
|
||||
|
||||
//
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->cartAuthorized(cart_number)) {
|
||||
XmlExit("No such cart",404);
|
||||
}
|
||||
if(!xport_user->deleteCarts()) {
|
||||
XmlExit("Unauthorized",401);
|
||||
}
|
||||
|
||||
//
|
||||
// Process Request
|
||||
//
|
||||
cart=new RDCart(cart_number);
|
||||
if(!cart->exists()) {
|
||||
delete cart;
|
||||
XmlExit("No such cart",404);
|
||||
}
|
||||
if(!cart->remove(NULL,NULL,xport_config)) {
|
||||
delete cart;
|
||||
XmlExit("Unable to delete cart",500);
|
||||
}
|
||||
delete cart;
|
||||
XmlExit("OK",200);
|
||||
}
|
||||
|
||||
|
||||
void Xport::AddCut()
|
||||
{
|
||||
RDCart *cart;
|
||||
RDCut *cut;
|
||||
int cart_number;
|
||||
int cut_number;
|
||||
|
||||
//
|
||||
// Verify Post
|
||||
//
|
||||
if(!xport_post->getValue("CART_NUMBER",&cart_number)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
}
|
||||
|
||||
//
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->cartAuthorized(cart_number)) {
|
||||
XmlExit("No such cart",404);
|
||||
}
|
||||
if(!xport_user->editAudio()) {
|
||||
XmlExit("Unauthorized",401);
|
||||
}
|
||||
|
||||
//
|
||||
// Process Request
|
||||
//
|
||||
cart=new RDCart(cart_number);
|
||||
if(!cart->exists()) {
|
||||
delete cart;
|
||||
XmlExit("No such cart",404);
|
||||
}
|
||||
if((cut_number=cart->addCut(0,0,2))<0) {
|
||||
delete cart;
|
||||
XmlExit("No new cuts available",500);
|
||||
}
|
||||
printf("Content-type: application/xml\n");
|
||||
printf("Status: 200\n\n");
|
||||
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
|
||||
printf("<cutAdd>\n");
|
||||
cut=new RDCut(cart_number,cut_number);
|
||||
if(cut->exists()) {
|
||||
printf("%s",(const char *)cut->xml());
|
||||
}
|
||||
delete cut;
|
||||
delete cart;
|
||||
printf("</cutAdd>\n");
|
||||
|
||||
Exit(0);
|
||||
}
|
||||
|
||||
|
||||
void Xport::ListCuts()
|
||||
{
|
||||
RDCut *cut;
|
||||
int cart_number;
|
||||
QString sql;
|
||||
RDSqlQuery *q;
|
||||
|
||||
//
|
||||
// Verify Post
|
||||
//
|
||||
if(!xport_post->getValue("CART_NUMBER",&cart_number)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
}
|
||||
|
||||
//
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->cartAuthorized(cart_number)) {
|
||||
XmlExit("No such cart",404);
|
||||
}
|
||||
|
||||
//
|
||||
// Process Request
|
||||
//
|
||||
sql=QString().sprintf("select CUT_NAME from CUTS where CART_NUMBER=%u \
|
||||
order by CUT_NAME",
|
||||
cart_number);
|
||||
q=new RDSqlQuery(sql);
|
||||
printf("Content-type: application/xml\n");
|
||||
printf("Status: 200\n\n");
|
||||
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
|
||||
printf("<cutList>\n");
|
||||
while(q->next()) {
|
||||
cut=new RDCut(q->value(0).toString());
|
||||
if(cut->exists()) {
|
||||
printf("%s",(const char *)cut->xml());
|
||||
}
|
||||
delete cut;
|
||||
}
|
||||
delete q;
|
||||
printf("</cutList>\n");
|
||||
|
||||
Exit(0);
|
||||
}
|
||||
|
||||
|
||||
void Xport::ListCut()
|
||||
{
|
||||
RDCut *cut;
|
||||
int cart_number;
|
||||
int cut_number;
|
||||
|
||||
//
|
||||
// Verify Post
|
||||
//
|
||||
if(!xport_post->getValue("CART_NUMBER",&cart_number)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
}
|
||||
if(!xport_post->getValue("CUT_NUMBER",&cut_number)) {
|
||||
XmlExit("Missing CUT_NUMBER",400);
|
||||
}
|
||||
|
||||
//
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->cartAuthorized(cart_number)) {
|
||||
XmlExit("No such cart",404);
|
||||
}
|
||||
|
||||
//
|
||||
// Process Request
|
||||
//
|
||||
cut=new RDCut(cart_number,cut_number);
|
||||
if(!cut->exists()) {
|
||||
delete cut;
|
||||
XmlExit("No such cut",404);
|
||||
}
|
||||
printf("Content-type: application/xml\n");
|
||||
printf("Status: 200\n\n");
|
||||
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
|
||||
printf("<cutList>\n");
|
||||
printf("%s",(const char *)cut->xml());
|
||||
printf("</cutList>\n");
|
||||
delete cut;
|
||||
|
||||
Exit(0);
|
||||
}
|
||||
|
||||
|
||||
void Xport::EditCut()
|
||||
{
|
||||
RDCut *cut;
|
||||
int cart_number;
|
||||
int cut_number;
|
||||
QString str;
|
||||
int num;
|
||||
QDateTime datetime;
|
||||
QTime time;
|
||||
bool rotation_changed=false;
|
||||
bool length_changed=false;
|
||||
|
||||
//
|
||||
// Verify Post
|
||||
//
|
||||
if(!xport_post->getValue("CART_NUMBER",&cart_number)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
}
|
||||
if(!xport_post->getValue("CUT_NUMBER",&cut_number)) {
|
||||
XmlExit("Missing CUT_NUMBER",400);
|
||||
}
|
||||
|
||||
//
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->cartAuthorized(cart_number)) {
|
||||
XmlExit("No such cart",404);
|
||||
}
|
||||
if(!xport_user->editAudio()) {
|
||||
XmlExit("Unauthorized",401);
|
||||
}
|
||||
|
||||
//
|
||||
// Process Request
|
||||
//
|
||||
cut=new RDCut(cart_number,cut_number);
|
||||
if(!cut->exists()) {
|
||||
delete cut;
|
||||
XmlExit("No such cut",404);
|
||||
}
|
||||
if(xport_post->getValue("EVERGREEN",&num)) {
|
||||
cut->setEvergreen(num);
|
||||
rotation_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("DESCRIPTION",&str)) {
|
||||
cut->setDescription(str);
|
||||
}
|
||||
if(xport_post->getValue("OUTCUE",&str)) {
|
||||
cut->setOutcue(str);
|
||||
}
|
||||
if(xport_post->getValue("ISRC",&str)) {
|
||||
cut->setIsrc(str);
|
||||
}
|
||||
if(xport_post->getValue("ISCI",&str)) {
|
||||
cut->setIsci(str);
|
||||
}
|
||||
if(xport_post->getValue("START_DATETIME",&datetime)) {
|
||||
cut->setStartDatetime(datetime,!datetime.isNull());
|
||||
length_changed=true;
|
||||
rotation_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("END_DATETIME",&datetime)) {
|
||||
cut->setEndDatetime(datetime,!datetime.isNull());
|
||||
length_changed=true;
|
||||
rotation_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("MON",&num)) {
|
||||
cut->setWeekPart(1,num);
|
||||
rotation_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("TUE",&num)) {
|
||||
cut->setWeekPart(2,num);
|
||||
rotation_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("WED",&num)) {
|
||||
cut->setWeekPart(3,num);
|
||||
rotation_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("THU",&num)) {
|
||||
cut->setWeekPart(4,num);
|
||||
rotation_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("FRI",&num)) {
|
||||
cut->setWeekPart(5,num);
|
||||
rotation_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("SAT",&num)) {
|
||||
cut->setWeekPart(6,num);
|
||||
rotation_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("SUN",&num)) {
|
||||
cut->setWeekPart(7,num);
|
||||
rotation_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("START_DAYPART",&time)) {
|
||||
cut->setStartDaypart(time,!time.isNull());
|
||||
rotation_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("END_DAYPART",&time)) {
|
||||
cut->setEndDaypart(time,!time.isNull());
|
||||
rotation_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("WEIGHT",&num)) {
|
||||
cut->setWeight(num);
|
||||
rotation_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("START_POINT",&num)) {
|
||||
cut->setStartPoint(num);
|
||||
length_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("END_POINT",&num)) {
|
||||
cut->setEndPoint(num);
|
||||
length_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("FADEUP_POINT",&num)) {
|
||||
cut->setFadeupPoint(num);
|
||||
length_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("FADEDOWN_POINT",&num)) {
|
||||
cut->setFadedownPoint(num);
|
||||
length_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("SEGUE_START_POINT",&num)) {
|
||||
cut->setSegueStartPoint(num);
|
||||
length_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("SEGUE_END_POINT",&num)) {
|
||||
cut->setSegueEndPoint(num);
|
||||
length_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("HOOK_START_POINT",&num)) {
|
||||
cut->setHookStartPoint(num);
|
||||
length_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("HOOK_END_POINT",&num)) {
|
||||
cut->setHookEndPoint(num);
|
||||
length_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("TALK_START_POINT",&num)) {
|
||||
cut->setTalkStartPoint(num);
|
||||
length_changed=true;
|
||||
}
|
||||
if(xport_post->getValue("TALK_END_POINT",&num)) {
|
||||
cut->setTalkEndPoint(num);
|
||||
length_changed=true;
|
||||
}
|
||||
if(length_changed||rotation_changed) {
|
||||
RDCart *cart=new RDCart(cut->cartNumber());
|
||||
if(length_changed) {
|
||||
cart->updateLength();
|
||||
}
|
||||
if(rotation_changed) {
|
||||
cart->resetRotation();
|
||||
}
|
||||
delete cart;
|
||||
}
|
||||
delete cut;
|
||||
XmlExit("OK",200);
|
||||
}
|
||||
|
||||
|
||||
void Xport::RemoveCut()
|
||||
{
|
||||
RDCart *cart;
|
||||
int cart_number;
|
||||
int cut_number;
|
||||
|
||||
//
|
||||
// Verify Post
|
||||
//
|
||||
if(!xport_post->getValue("CART_NUMBER",&cart_number)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
}
|
||||
if(!xport_post->getValue("CUT_NUMBER",&cut_number)) {
|
||||
XmlExit("Missing CUT_NUMBER",400);
|
||||
}
|
||||
|
||||
//
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->cartAuthorized(cart_number)) {
|
||||
XmlExit("No such cart",404);
|
||||
}
|
||||
if(!xport_user->editAudio()) {
|
||||
XmlExit("Unauthorized",401);
|
||||
}
|
||||
|
||||
//
|
||||
// Process Request
|
||||
//
|
||||
cart=new RDCart(cart_number);
|
||||
if(!cart->exists()) {
|
||||
delete cart;
|
||||
XmlExit("No such cart",404);
|
||||
}
|
||||
if(!cart->removeCut(NULL,NULL,RDCut::cutName(cart_number,cut_number),
|
||||
xport_config)) {
|
||||
delete cart;
|
||||
XmlExit("No such cut",404);
|
||||
}
|
||||
delete cart;
|
||||
XmlExit("OK",200);
|
||||
}
|
||||
82
web/rdxport/copyaudio.cpp
Normal file
82
web/rdxport/copyaudio.cpp
Normal file
@@ -0,0 +1,82 @@
|
||||
// copyaudio.cpp
|
||||
//
|
||||
// Rivendell web service portal -- CopyAudio service
|
||||
//
|
||||
// (C) Copyright 2010 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: copyaudio.cpp,v 1.4 2012/02/13 23:01:50 cvs Exp $
|
||||
//
|
||||
// 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 <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <rdformpost.h>
|
||||
#include <rdweb.h>
|
||||
#include <rdcart.h>
|
||||
#include <rdaudioconvert.h>
|
||||
#include <rdsettings.h>
|
||||
#include <rdconf.h>
|
||||
|
||||
#include <rdxport.h>
|
||||
|
||||
void Xport::CopyAudio()
|
||||
{
|
||||
//
|
||||
// Verify Post
|
||||
//
|
||||
int source_cartnum=0;
|
||||
if(!xport_post->getValue("SOURCE_CART_NUMBER",&source_cartnum)) {
|
||||
XmlExit("Missing SOURCE_CART_NUMBER",400);
|
||||
}
|
||||
int source_cutnum=0;
|
||||
if(!xport_post->getValue("SOURCE_CUT_NUMBER",&source_cutnum)) {
|
||||
XmlExit("Missing SOURCE_CUT_NUMBER",400);
|
||||
}
|
||||
|
||||
int destination_cartnum=0;
|
||||
if(!xport_post->getValue("DESTINATION_CART_NUMBER",&destination_cartnum)) {
|
||||
XmlExit("Missing DESTINATION_CART_NUMBER",400);
|
||||
}
|
||||
int destination_cutnum=0;
|
||||
if(!xport_post->getValue("DESTINATION_CUT_NUMBER",&destination_cutnum)) {
|
||||
XmlExit("Missing DESTINATION_CUT_NUMBER",400);
|
||||
}
|
||||
|
||||
//
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->cartAuthorized(source_cartnum)) {
|
||||
XmlExit("No such cart",404);
|
||||
}
|
||||
if(!xport_user->cartAuthorized(destination_cartnum)) {
|
||||
XmlExit("No such cart",404);
|
||||
}
|
||||
|
||||
//
|
||||
// Make the copy
|
||||
//
|
||||
unlink(RDCut::pathName(destination_cartnum,destination_cutnum));
|
||||
if(link(RDCut::pathName(source_cartnum,source_cutnum),
|
||||
RDCut::pathName(destination_cartnum,destination_cutnum))!=0) {
|
||||
XmlExit(strerror(errno),400);
|
||||
}
|
||||
XmlExit("OK",200);
|
||||
}
|
||||
66
web/rdxport/deleteaudio.cpp
Normal file
66
web/rdxport/deleteaudio.cpp
Normal file
@@ -0,0 +1,66 @@
|
||||
// deleteaudio.cpp
|
||||
//
|
||||
// Rivendell web service portal -- DeleteAudio service
|
||||
//
|
||||
// (C) Copyright 2010 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: deleteaudio.cpp,v 1.6.2.1 2012/07/17 19:29:43 cvs Exp $
|
||||
//
|
||||
// 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 <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <rdformpost.h>
|
||||
#include <rdweb.h>
|
||||
#include <rdcart.h>
|
||||
#include <rdconf.h>
|
||||
|
||||
#include <rdxport.h>
|
||||
|
||||
void Xport::DeleteAudio()
|
||||
{
|
||||
//
|
||||
// Verify Post
|
||||
//
|
||||
int cartnum=0;
|
||||
if(!xport_post->getValue("CART_NUMBER",&cartnum)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
}
|
||||
int cutnum=0;
|
||||
if(!xport_post->getValue("CUT_NUMBER",&cutnum)) {
|
||||
XmlExit("Missing CUT_NUMBER",400);
|
||||
}
|
||||
|
||||
//
|
||||
// Process Request
|
||||
//
|
||||
if((!xport_user->deleteCarts())&&(!xport_user->adminConfig())) {
|
||||
XmlExit("User not authorized",401);
|
||||
}
|
||||
RDCut *cut=new RDCut(cartnum,cutnum);
|
||||
if(!cut->exists()) {
|
||||
delete cut;
|
||||
XmlExit("No such cut",404);
|
||||
}
|
||||
unlink(RDCut::pathName(cartnum,cutnum));
|
||||
unlink(RDCut::pathName(cartnum,cutnum)+".energy");
|
||||
syslog(LOG_NOTICE,"unlink(%s): %s",(const char *)RDCut::pathName(cartnum,cutnum),strerror(errno));
|
||||
delete cut;
|
||||
XmlExit("OK",200);
|
||||
}
|
||||
202
web/rdxport/export.cpp
Normal file
202
web/rdxport/export.cpp
Normal file
@@ -0,0 +1,202 @@
|
||||
// export.cpp
|
||||
//
|
||||
// Rivendell web service portal -- Export service
|
||||
//
|
||||
// (C) Copyright 2010 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: export.cpp,v 1.6.2.2 2013/10/02 18:25:12 cvs Exp $
|
||||
//
|
||||
// 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 <rdcart.h>
|
||||
#include <rdaudioconvert.h>
|
||||
#include <rdsettings.h>
|
||||
#include <rdconf.h>
|
||||
|
||||
#include <rdxport.h>
|
||||
|
||||
void Xport::Export()
|
||||
{
|
||||
RDAudioConvert::ErrorCode conv_err=RDAudioConvert::ErrorOk;
|
||||
int resp_code=0;
|
||||
|
||||
//
|
||||
// Verify Post
|
||||
//
|
||||
int cartnum=0;
|
||||
if(!xport_post->getValue("CART_NUMBER",&cartnum)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
}
|
||||
int cutnum=0;
|
||||
if(!xport_post->getValue("CUT_NUMBER",&cutnum)) {
|
||||
XmlExit("Missing CUT_NUMBER",400);
|
||||
}
|
||||
int format=0;
|
||||
if(!xport_post->getValue("FORMAT",&format)) {
|
||||
XmlExit("Missing FORMAT",400);
|
||||
}
|
||||
int channels=0;
|
||||
if(!xport_post->getValue("CHANNELS",&channels)) {
|
||||
XmlExit("Missing CHANNELS",400);
|
||||
}
|
||||
int sample_rate=0;
|
||||
if(!xport_post->getValue("SAMPLE_RATE",&sample_rate)) {
|
||||
XmlExit("Missing SAMPLE_RATE",400);
|
||||
}
|
||||
int bit_rate=0;
|
||||
if(!xport_post->getValue("BIT_RATE",&bit_rate)) {
|
||||
XmlExit("Missing BIT_RATE",400);
|
||||
}
|
||||
int quality=0;
|
||||
if(!xport_post->getValue("QUALITY",&quality)) {
|
||||
XmlExit("Missing QUALITY",400);
|
||||
}
|
||||
int start_point=-1;
|
||||
if(!xport_post->getValue("START_POINT",&start_point)) {
|
||||
XmlExit("Missing START_POINT",400);
|
||||
}
|
||||
int end_point=-1;
|
||||
if(!xport_post->getValue("END_POINT",&end_point)) {
|
||||
XmlExit("Missing END_POINT",400);
|
||||
}
|
||||
int normalization_level=0;
|
||||
if(!xport_post->getValue("NORMALIZATION_LEVEL",&normalization_level)) {
|
||||
XmlExit("Missing NORMALIZATION_LEVEL",400);
|
||||
}
|
||||
int enable_metadata=false;
|
||||
if(!xport_post->getValue("ENABLE_METADATA",&enable_metadata)) {
|
||||
XmlExit("Missing ENABLE_METADATA",400);
|
||||
}
|
||||
if(!RDCart::exists(cartnum)) {
|
||||
XmlExit("No such cart",404);
|
||||
}
|
||||
if(!RDCut::exists(cartnum,cutnum)) {
|
||||
XmlExit("No such cut",404);
|
||||
}
|
||||
|
||||
//
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->cartAuthorized(cartnum)) {
|
||||
XmlExit("No such cart",404);
|
||||
}
|
||||
|
||||
//
|
||||
// Generate Metadata
|
||||
//
|
||||
RDWaveData *wavedata=NULL;
|
||||
float speed_ratio=1.0;
|
||||
if(enable_metadata!=0) {
|
||||
wavedata=new RDWaveData();
|
||||
}
|
||||
if(wavedata!=NULL) {
|
||||
RDCart *cart=new RDCart(cartnum);
|
||||
RDCut *cut=new RDCut(cartnum,cutnum);
|
||||
cart->getMetadata(wavedata);
|
||||
cut->getMetadata(wavedata);
|
||||
if(cart->enforceLength()) {
|
||||
speed_ratio=(float)cut->length()/(float)cart->forcedLength();
|
||||
}
|
||||
delete cut;
|
||||
delete cart;
|
||||
}
|
||||
|
||||
//
|
||||
// Export Cut
|
||||
//
|
||||
int fd;
|
||||
ssize_t n;
|
||||
uint8_t data[2048];
|
||||
QString tmpdir=RDTempDir();
|
||||
QString tmpfile=tmpdir+"/exported_audio";
|
||||
RDSettings *settings=new RDSettings();
|
||||
settings->setFormat((RDSettings::Format)format);
|
||||
settings->setChannels(channels);
|
||||
settings->setSampleRate(sample_rate);
|
||||
settings->setBitRate(bit_rate);
|
||||
settings->setQuality(quality);
|
||||
settings->setNormalizationLevel(normalization_level);
|
||||
RDAudioConvert *conv=new RDAudioConvert(xport_config->stationName());
|
||||
conv->setSourceFile(RDCut::pathName(cartnum,cutnum));
|
||||
conv->setDestinationFile(tmpfile);
|
||||
conv->setDestinationSettings(settings);
|
||||
conv->setDestinationWaveData(wavedata);
|
||||
conv->setRange(start_point,end_point);
|
||||
conv->setSpeedRatio(speed_ratio);
|
||||
switch(conv_err=conv->convert()) {
|
||||
case RDAudioConvert::ErrorOk:
|
||||
switch(settings->format()) {
|
||||
case RDSettings::Pcm16:
|
||||
printf("Content-type: audio/x-wav\n\n");
|
||||
break;
|
||||
|
||||
case RDSettings::MpegL1:
|
||||
case RDSettings::MpegL2:
|
||||
case RDSettings::MpegL2Wav:
|
||||
case RDSettings::MpegL3:
|
||||
printf("Content-type: audio/x-mpeg\n\n");
|
||||
break;
|
||||
|
||||
case RDSettings::OggVorbis:
|
||||
printf("Content-type: audio/ogg\n\n");
|
||||
break;
|
||||
|
||||
case RDSettings::Flac:
|
||||
printf("Content-type: audio/flac\n\n");
|
||||
break;
|
||||
}
|
||||
fflush(NULL);
|
||||
if((fd=open(tmpfile,O_RDONLY))>=0) {
|
||||
while((n=read(fd,data,2048))>0) {
|
||||
write(1,data,n);
|
||||
}
|
||||
}
|
||||
close(fd);
|
||||
break;
|
||||
|
||||
case RDAudioConvert::ErrorFormatNotSupported:
|
||||
case RDAudioConvert::ErrorInvalidSettings:
|
||||
resp_code=415;
|
||||
break;
|
||||
|
||||
case RDAudioConvert::ErrorNoSource:
|
||||
case RDAudioConvert::ErrorNoDestination:
|
||||
case RDAudioConvert::ErrorInvalidSource:
|
||||
case RDAudioConvert::ErrorNoSpace:
|
||||
case RDAudioConvert::ErrorInternal:
|
||||
case RDAudioConvert::ErrorNoDisc:
|
||||
case RDAudioConvert::ErrorNoTrack:
|
||||
case RDAudioConvert::ErrorInvalidSpeed:
|
||||
case RDAudioConvert::ErrorFormatError:
|
||||
resp_code=500;
|
||||
break;
|
||||
}
|
||||
delete conv;
|
||||
delete settings;
|
||||
if(wavedata!=NULL) {
|
||||
delete wavedata;
|
||||
}
|
||||
unlink(tmpfile);
|
||||
rmdir(tmpdir);
|
||||
exit(0);
|
||||
}
|
||||
79
web/rdxport/exportpeaks.cpp
Normal file
79
web/rdxport/exportpeaks.cpp
Normal file
@@ -0,0 +1,79 @@
|
||||
// exportpeaks.cpp
|
||||
//
|
||||
// Rivendell web service portal -- ExportPeaks service
|
||||
//
|
||||
// (C) Copyright 2010 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: exportpeaks.cpp,v 1.4 2012/02/13 23:01:50 cvs Exp $
|
||||
//
|
||||
// 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 <rdcart.h>
|
||||
#include <rdaudioconvert.h>
|
||||
#include <rdsettings.h>
|
||||
#include <rdconf.h>
|
||||
|
||||
#include <rdxport.h>
|
||||
|
||||
void Xport::ExportPeaks()
|
||||
{
|
||||
//
|
||||
// Verify Post
|
||||
//
|
||||
int cartnum=0;
|
||||
if(!xport_post->getValue("CART_NUMBER",&cartnum)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
}
|
||||
int cutnum=0;
|
||||
if(!xport_post->getValue("CUT_NUMBER",&cutnum)) {
|
||||
XmlExit("Missing CUT_NUMBER",400);
|
||||
}
|
||||
|
||||
//
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->cartAuthorized(cartnum)) {
|
||||
XmlExit("No such cart",404);
|
||||
}
|
||||
|
||||
//
|
||||
// Open Audio File
|
||||
//
|
||||
RDWaveFile *wave=new RDWaveFile(RDCut::pathName(cartnum,cutnum));
|
||||
if(!wave->openWave()) {
|
||||
XmlExit("No such audio",404);
|
||||
}
|
||||
if(!wave->hasEnergy()) {
|
||||
XmlExit("No peak data available",400);
|
||||
}
|
||||
|
||||
//
|
||||
// Send Data
|
||||
//
|
||||
printf("Content-type: application/octet-stream\n\n");
|
||||
fflush(NULL);
|
||||
unsigned short *peaks=new unsigned short[wave->energySize()];
|
||||
wave->readEnergy(peaks,wave->energySize());
|
||||
write(1,peaks,sizeof(unsigned short)*wave->energySize());
|
||||
Exit(0);
|
||||
}
|
||||
110
web/rdxport/groups.cpp
Normal file
110
web/rdxport/groups.cpp
Normal file
@@ -0,0 +1,110 @@
|
||||
// groups.cpp
|
||||
//
|
||||
// Rivendell web service portal -- Group services
|
||||
//
|
||||
// (C) Copyright 2010 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: groups.cpp,v 1.5 2012/02/13 23:01:50 cvs Exp $
|
||||
//
|
||||
// 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 <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <rdformpost.h>
|
||||
#include <rdweb.h>
|
||||
#include <rduser.h>
|
||||
#include <rdgroup.h>
|
||||
#include <rdconf.h>
|
||||
#include <rdescape_string.h>
|
||||
|
||||
#include <rdxport.h>
|
||||
|
||||
void Xport::ListGroups()
|
||||
{
|
||||
QString sql;
|
||||
RDSqlQuery *q;
|
||||
RDGroup *group;
|
||||
|
||||
//
|
||||
// Generate Group List
|
||||
//
|
||||
sql=QString().sprintf("select GROUP_NAME from USER_PERMS \
|
||||
where USER_NAME=\"%s\" order by GROUP_NAME",
|
||||
(const char *)RDEscapeString(xport_user->name()));
|
||||
q=new RDSqlQuery(sql);
|
||||
|
||||
//
|
||||
// Process Request
|
||||
//
|
||||
printf("Content-type: application/xml\n");
|
||||
printf("Status: 200\n\n");
|
||||
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
|
||||
printf("<groupList>\n");
|
||||
while(q->next()) {
|
||||
group=new RDGroup(q->value(0).toString());
|
||||
printf("%s",(const char *)group->xml());
|
||||
delete group;
|
||||
}
|
||||
printf("</groupList>\n");
|
||||
|
||||
delete q;
|
||||
Exit(0);
|
||||
}
|
||||
|
||||
|
||||
void Xport::ListGroup()
|
||||
{
|
||||
QString sql;
|
||||
RDSqlQuery *q;
|
||||
RDGroup *group;
|
||||
|
||||
//
|
||||
// Verify Post
|
||||
//
|
||||
QString group_name;
|
||||
if(!xport_post->getValue("GROUP_NAME",&group_name)) {
|
||||
XmlExit("Missing GROUP_NAME",400);
|
||||
}
|
||||
|
||||
//
|
||||
// Check Group Accessibility
|
||||
//
|
||||
sql=QString().sprintf("select GROUP_NAME from USER_PERMS \
|
||||
where (USER_NAME=\"%s\")&&(GROUP_NAME=\"%s\")",
|
||||
(const char *)RDEscapeString(xport_user->name()),
|
||||
(const char *)RDEscapeString(group_name));
|
||||
q=new RDSqlQuery(sql);
|
||||
if(!q->first()) {
|
||||
delete q;
|
||||
XmlExit("No such group",404);
|
||||
}
|
||||
|
||||
//
|
||||
// Process Request
|
||||
//
|
||||
printf("Content-type: application/xml\n");
|
||||
printf("Status: 200\n\n");
|
||||
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
|
||||
group=new RDGroup(q->value(0).toString());
|
||||
printf("%s",(const char *)group->xml());
|
||||
delete group;
|
||||
|
||||
delete q;
|
||||
Exit(0);
|
||||
}
|
||||
170
web/rdxport/import.cpp
Normal file
170
web/rdxport/import.cpp
Normal file
@@ -0,0 +1,170 @@
|
||||
// import.cpp
|
||||
//
|
||||
// Rivendell web service portal -- Import service
|
||||
//
|
||||
// (C) Copyright 2010 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: import.cpp,v 1.12.2.2 2014/01/15 19:56:32 cvs Exp $
|
||||
//
|
||||
// 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 <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <rdformpost.h>
|
||||
#include <rdweb.h>
|
||||
#include <rdcart.h>
|
||||
#include <rdaudioconvert.h>
|
||||
#include <rdsettings.h>
|
||||
#include <rdconf.h>
|
||||
#include <rdlibrary_conf.h>
|
||||
|
||||
#include <rdxport.h>
|
||||
|
||||
void Xport::Import()
|
||||
{
|
||||
unsigned length_deviation=0;
|
||||
unsigned msecs;
|
||||
int resp_code=0;
|
||||
|
||||
//
|
||||
// Verify Post
|
||||
//
|
||||
int cartnum=0;
|
||||
if(!xport_post->getValue("CART_NUMBER",&cartnum)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
}
|
||||
int cutnum=0;
|
||||
if(!xport_post->getValue("CUT_NUMBER",&cutnum)) {
|
||||
XmlExit("Missing CUT_NUMBER",400);
|
||||
}
|
||||
int channels=0;
|
||||
if(!xport_post->getValue("CHANNELS",&channels)) {
|
||||
XmlExit("Missing CHANNELS",400);
|
||||
}
|
||||
int normalization_level=0;
|
||||
if(!xport_post->getValue("NORMALIZATION_LEVEL",&normalization_level)) {
|
||||
XmlExit("Missing NORMALIZATION_LEVEL",400);
|
||||
}
|
||||
int autotrim_level=0;
|
||||
if(!xport_post->getValue("AUTOTRIM_LEVEL",&autotrim_level)) {
|
||||
XmlExit("Missing AUTOTRIM_LEVEL",400);
|
||||
}
|
||||
int use_metadata=0;
|
||||
if(!xport_post->getValue("USE_METADATA",&use_metadata)) {
|
||||
XmlExit("Missing USE_METADATA",400);
|
||||
}
|
||||
QString filename;
|
||||
if(!xport_post->getValue("FILENAME",&filename)) {
|
||||
XmlExit("Missing FILENAME",400);
|
||||
}
|
||||
if(!RDCart::exists(cartnum)) {
|
||||
XmlExit("No such cart",404);
|
||||
}
|
||||
if(!RDCut::exists(cartnum,cutnum)) {
|
||||
XmlExit("No such cut",404);
|
||||
}
|
||||
if(!xport_post->isFile("FILENAME")) {
|
||||
XmlExit("Missing file data",400);
|
||||
}
|
||||
|
||||
//
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->cartAuthorized(cartnum)) {
|
||||
XmlExit("No such cart",404);
|
||||
}
|
||||
if(!xport_user->editAudio()) {
|
||||
XmlExit("Unauthorized",401);
|
||||
}
|
||||
|
||||
//
|
||||
// Load Configuration
|
||||
//
|
||||
RDCart *cart=new RDCart(cartnum);
|
||||
RDCut *cut=new RDCut(cartnum,cutnum);
|
||||
RDLibraryConf *conf=new RDLibraryConf(xport_config->stationName(),0);
|
||||
RDSettings *settings=new RDSettings();
|
||||
switch(conf->defaultFormat()) {
|
||||
case 0:
|
||||
settings->setFormat(RDSettings::Pcm16);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
settings->setFormat(RDSettings::MpegL2Wav);
|
||||
break;
|
||||
}
|
||||
settings->setChannels(channels);
|
||||
settings->setSampleRate(xport_system->sampleRate());
|
||||
settings->setBitRate(channels*conf->defaultBitrate());
|
||||
settings->setNormalizationLevel(normalization_level);
|
||||
RDWaveFile *wave=new RDWaveFile(filename);
|
||||
if(!wave->openWave()) {
|
||||
delete wave;
|
||||
XmlExit("Format Not Supported",415);
|
||||
}
|
||||
msecs=wave->getExtTimeLength();
|
||||
delete wave;
|
||||
RDAudioConvert *conv=new RDAudioConvert(xport_config->stationName());
|
||||
conv->setSourceFile(filename);
|
||||
conv->setDestinationFile(RDCut::pathName(cartnum,cutnum));
|
||||
conv->setDestinationSettings(settings);
|
||||
RDAudioConvert::ErrorCode conv_err=conv->convert();
|
||||
switch(conv_err) {
|
||||
case RDAudioConvert::ErrorOk:
|
||||
cut->checkInRecording(xport_config->stationName(),settings,msecs);
|
||||
if(use_metadata>0) {
|
||||
cart->setMetadata(conv->sourceWaveData());
|
||||
cut->setMetadata(conv->sourceWaveData());
|
||||
}
|
||||
if(autotrim_level!=0) {
|
||||
cut->autoTrim(RDCut::AudioBoth,100*autotrim_level);
|
||||
}
|
||||
cart->updateLength();
|
||||
cart->resetRotation();
|
||||
cart->calculateAverageLength(&length_deviation);
|
||||
cart->setLengthDeviation(length_deviation);
|
||||
resp_code=200;
|
||||
break;
|
||||
|
||||
case RDAudioConvert::ErrorFormatNotSupported:
|
||||
case RDAudioConvert::ErrorInvalidSettings:
|
||||
resp_code=415;
|
||||
break;
|
||||
|
||||
case RDAudioConvert::ErrorNoSource:
|
||||
case RDAudioConvert::ErrorNoDestination:
|
||||
case RDAudioConvert::ErrorInvalidSource:
|
||||
case RDAudioConvert::ErrorInternal:
|
||||
case RDAudioConvert::ErrorNoSpace:
|
||||
case RDAudioConvert::ErrorNoDisc:
|
||||
case RDAudioConvert::ErrorNoTrack:
|
||||
case RDAudioConvert::ErrorInvalidSpeed:
|
||||
resp_code=500;
|
||||
break;
|
||||
|
||||
case RDAudioConvert::ErrorFormatError:
|
||||
resp_code=400;
|
||||
break;
|
||||
}
|
||||
delete conv;
|
||||
delete settings;
|
||||
delete conf;
|
||||
delete cut;
|
||||
delete cart;
|
||||
XmlExit(RDAudioConvert::errorText(conv_err),resp_code,conv_err);
|
||||
}
|
||||
123
web/rdxport/logs.cpp
Normal file
123
web/rdxport/logs.cpp
Normal file
@@ -0,0 +1,123 @@
|
||||
// logs.cpp
|
||||
//
|
||||
// Rivendell web service portal -- Log services
|
||||
//
|
||||
// (C) Copyright 2013 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: logs.cpp,v 1.1.2.4 2013/10/23 23:32:54 cvs Exp $
|
||||
//
|
||||
// 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 <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <rddb.h>
|
||||
#include <rdformpost.h>
|
||||
#include <rdweb.h>
|
||||
#include <rduser.h>
|
||||
#include <rdlog.h>
|
||||
#include <rdconf.h>
|
||||
#include <rdescape_string.h>
|
||||
|
||||
#include <rdxport.h>
|
||||
|
||||
void Xport::ListLogs()
|
||||
{
|
||||
QString sql;
|
||||
RDSqlQuery *q;
|
||||
RDLog *log;
|
||||
QString service_name="";
|
||||
QString trackable;
|
||||
|
||||
//
|
||||
// Get Options
|
||||
//
|
||||
xport_post->getValue("SERVICE_NAME",&service_name);
|
||||
xport_post->getValue("TRACKABLE",&trackable);
|
||||
|
||||
//
|
||||
// Generate Log List
|
||||
//
|
||||
sql="select NAME from LOGS";
|
||||
if((!service_name.isEmpty())||(trackable=="1")) {
|
||||
sql+=" where";
|
||||
if(!service_name.isEmpty()) {
|
||||
sql+=" (SERVICE=\""+RDEscapeString(service_name)+"\")&&";
|
||||
}
|
||||
if(trackable=="1") {
|
||||
sql+=" (SCHEDULED_TRACKS>0)&&";
|
||||
}
|
||||
sql=sql.left(sql.length()-2);
|
||||
}
|
||||
sql+=" order by NAME";
|
||||
q=new RDSqlQuery(sql);
|
||||
|
||||
//
|
||||
// Process Request
|
||||
//
|
||||
printf("Content-type: application/xml\n");
|
||||
printf("Status: 200\n\n");
|
||||
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
|
||||
printf("<logList>\n");
|
||||
while(q->next()) {
|
||||
log=new RDLog(q->value(0).toString());
|
||||
printf("%s",(const char *)log->xml());
|
||||
delete log;
|
||||
}
|
||||
printf("</logList>\n");
|
||||
|
||||
delete q;
|
||||
Exit(0);
|
||||
}
|
||||
|
||||
|
||||
void Xport::ListLog()
|
||||
{
|
||||
RDLog *log;
|
||||
QString name="";
|
||||
|
||||
//
|
||||
// Get Options
|
||||
//
|
||||
xport_post->getValue("NAME",&name);
|
||||
|
||||
//
|
||||
// Verify that log exists
|
||||
//
|
||||
log=new RDLog(name);
|
||||
if(!log->exists()) {
|
||||
delete log;
|
||||
XmlExit("No such log",404);
|
||||
}
|
||||
|
||||
//
|
||||
// Generate Log Listing
|
||||
//
|
||||
RDLogEvent *log_event=log->createLogEvent();
|
||||
log_event->load(true);
|
||||
|
||||
//
|
||||
// Process Request
|
||||
//
|
||||
printf("Content-type: application/xml\n");
|
||||
printf("Status: 200\n\n");
|
||||
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
|
||||
printf("%s\n",(const char *)log_event->xml());
|
||||
|
||||
Exit(0);
|
||||
}
|
||||
287
web/rdxport/rdxport.cpp
Normal file
287
web/rdxport/rdxport.cpp
Normal file
@@ -0,0 +1,287 @@
|
||||
// rdxport.cpp
|
||||
//
|
||||
// Rivendell web service portal
|
||||
//
|
||||
// (C) Copyright 2010 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: rdxport.cpp,v 1.10.2.3 2013/10/14 04:23:54 cvs Exp $
|
||||
//
|
||||
// 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 <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qdatetime.h>
|
||||
#include <qstringlist.h>
|
||||
|
||||
#include <rddb.h>
|
||||
#include <rdweb.h>
|
||||
#include <rdformpost.h>
|
||||
#include <rdxport_interface.h>
|
||||
#include <dbversion.h>
|
||||
|
||||
#include <rdxport.h>
|
||||
|
||||
Xport::Xport(QObject *parent,const char *name)
|
||||
:QObject(parent,name)
|
||||
{
|
||||
xport_user=NULL;
|
||||
|
||||
//
|
||||
// Read Configuration
|
||||
//
|
||||
xport_config=new RDConfig();
|
||||
xport_config->load();
|
||||
|
||||
//
|
||||
// Drop Root Perms
|
||||
//
|
||||
if(setgid(xport_config->gid())<0) {
|
||||
XmlExit("Unable to set Rivendell group",500);
|
||||
}
|
||||
if(setuid(xport_config->uid())<0) {
|
||||
XmlExit("Unable to set Rivendell user",500);
|
||||
}
|
||||
if(getuid()==0) {
|
||||
XmlExit("Rivendell user should never be \"root\"!",500);
|
||||
}
|
||||
|
||||
//
|
||||
// Open Database
|
||||
//
|
||||
QSqlDatabase *db=QSqlDatabase::addDatabase(xport_config->mysqlDriver());
|
||||
if(!db) {
|
||||
printf("Content-type: text/html\n\n");
|
||||
printf("rdfeed: unable to initialize connection to database\n");
|
||||
Exit(0);
|
||||
}
|
||||
db->setDatabaseName(xport_config->mysqlDbname());
|
||||
db->setUserName(xport_config->mysqlUsername());
|
||||
db->setPassword(xport_config->mysqlPassword());
|
||||
db->setHostName(xport_config->mysqlHostname());
|
||||
if(!db->open()) {
|
||||
printf("Content-type: text/html\n\n");
|
||||
printf("rdxport: unable to connect to database\n");
|
||||
db->removeDatabase(xport_config->mysqlDbname());
|
||||
Exit(0);
|
||||
}
|
||||
RDSqlQuery *q=new RDSqlQuery("select DB from VERSION");
|
||||
if(!q->first()) {
|
||||
printf("Content-type: text/html\n");
|
||||
printf("Status: 500\n\n");
|
||||
printf("rdxport: missing/invalid database version!\n");
|
||||
db->removeDatabase(xport_config->mysqlDbname());
|
||||
Exit(0);
|
||||
}
|
||||
if(q->value(0).toUInt()!=RD_VERSION_DATABASE) {
|
||||
printf("Content-type: text/html\n");
|
||||
printf("Status: 500\n\n");
|
||||
printf("rdxport: skewed database version!\n");
|
||||
db->removeDatabase(xport_config->mysqlDbname());
|
||||
Exit(0);
|
||||
}
|
||||
delete q;
|
||||
|
||||
//
|
||||
// Determine Connection Type
|
||||
//
|
||||
if(getenv("REQUEST_METHOD")==NULL) {
|
||||
printf("Content-type: text/html\n\n");
|
||||
printf("rdxport: missing REQUEST_METHOD\n");
|
||||
db->removeDatabase(xport_config->mysqlDbname());
|
||||
Exit(0);
|
||||
}
|
||||
if(QString(getenv("REQUEST_METHOD")).lower()!="post") {
|
||||
printf("Content-type: text/html\n\n");
|
||||
printf("rdxport: invalid web method\n");
|
||||
db->removeDatabase(xport_config->mysqlDbname());
|
||||
Exit(0);
|
||||
}
|
||||
|
||||
//
|
||||
// Load System Settings
|
||||
//
|
||||
xport_system=new RDSystem();
|
||||
|
||||
//
|
||||
// Generate Post
|
||||
//
|
||||
xport_post=new RDFormPost(RDFormPost::AutoEncoded,false);
|
||||
if(xport_post->error()!=RDFormPost::ErrorOk) {
|
||||
XmlExit(xport_post->errorString(xport_post->error()),400);
|
||||
Exit(0);
|
||||
}
|
||||
|
||||
//
|
||||
// Authenticate Connection
|
||||
//
|
||||
if(!Authenticate()) {
|
||||
XmlExit("Invalid User",403);
|
||||
}
|
||||
|
||||
//
|
||||
// Read Command Variable and Dispatch
|
||||
//
|
||||
int command=xport_post->value("COMMAND").toInt();
|
||||
switch(command) {
|
||||
case RDXPORT_COMMAND_EXPORT:
|
||||
Export();
|
||||
break;
|
||||
|
||||
case RDXPORT_COMMAND_IMPORT:
|
||||
Import();
|
||||
break;
|
||||
|
||||
case RDXPORT_COMMAND_DELETEAUDIO:
|
||||
DeleteAudio();
|
||||
break;
|
||||
|
||||
case RDXPORT_COMMAND_LISTGROUPS:
|
||||
ListGroups();
|
||||
break;
|
||||
|
||||
case RDXPORT_COMMAND_LISTGROUP:
|
||||
ListGroup();
|
||||
break;
|
||||
|
||||
case RDXPORT_COMMAND_ADDCART:
|
||||
AddCart();
|
||||
break;
|
||||
|
||||
case RDXPORT_COMMAND_LISTCARTS:
|
||||
ListCarts();
|
||||
break;
|
||||
|
||||
case RDXPORT_COMMAND_LISTCART:
|
||||
ListCart();
|
||||
break;
|
||||
|
||||
case RDXPORT_COMMAND_EDITCART:
|
||||
EditCart();
|
||||
break;
|
||||
|
||||
case RDXPORT_COMMAND_REMOVECART:
|
||||
RemoveCart();
|
||||
break;
|
||||
|
||||
case RDXPORT_COMMAND_ADDCUT:
|
||||
AddCut();
|
||||
break;
|
||||
|
||||
case RDXPORT_COMMAND_LISTCUTS:
|
||||
ListCuts();
|
||||
break;
|
||||
|
||||
case RDXPORT_COMMAND_LISTCUT:
|
||||
ListCut();
|
||||
break;
|
||||
|
||||
case RDXPORT_COMMAND_EDITCUT:
|
||||
EditCut();
|
||||
break;
|
||||
|
||||
case RDXPORT_COMMAND_REMOVECUT:
|
||||
RemoveCut();
|
||||
break;
|
||||
|
||||
case RDXPORT_COMMAND_EXPORT_PEAKS:
|
||||
ExportPeaks();
|
||||
break;
|
||||
|
||||
case RDXPORT_COMMAND_TRIMAUDIO:
|
||||
TrimAudio();
|
||||
break;
|
||||
|
||||
case RDXPORT_COMMAND_COPYAUDIO:
|
||||
CopyAudio();
|
||||
break;
|
||||
|
||||
case RDXPORT_COMMAND_AUDIOINFO:
|
||||
AudioInfo();
|
||||
break;
|
||||
|
||||
case RDXPORT_COMMAND_LISTLOGS:
|
||||
ListLogs();
|
||||
break;
|
||||
|
||||
case RDXPORT_COMMAND_LISTLOG:
|
||||
ListLog();
|
||||
break;
|
||||
|
||||
case RDXPORT_COMMAND_LISTSERVICES:
|
||||
ListServices();
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Content-type: text/html\n\n");
|
||||
printf("rdxport: missing/invalid command\n");
|
||||
db->removeDatabase(xport_config->mysqlDbname());
|
||||
Exit(0);
|
||||
break;
|
||||
}
|
||||
|
||||
Exit(0);
|
||||
}
|
||||
|
||||
|
||||
bool Xport::Authenticate()
|
||||
{
|
||||
QString name;
|
||||
QString passwd;
|
||||
|
||||
if(!xport_post->getValue("LOGIN_NAME",&name)) {
|
||||
return false;
|
||||
}
|
||||
if(!xport_post->getValue("PASSWORD",&passwd)) {
|
||||
return false;
|
||||
}
|
||||
xport_user=new RDUser(name);
|
||||
|
||||
return xport_user->checkPassword(passwd,false);
|
||||
}
|
||||
|
||||
|
||||
void Xport::Exit(int code)
|
||||
{
|
||||
if(xport_post!=NULL) {
|
||||
delete xport_post;
|
||||
}
|
||||
exit(code);
|
||||
}
|
||||
|
||||
|
||||
void Xport::XmlExit(const QString &str,int code,RDAudioConvert::ErrorCode err)
|
||||
{
|
||||
if(xport_post!=NULL) {
|
||||
delete xport_post;
|
||||
}
|
||||
RDXMLResult(str,code,err);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
QApplication a(argc,argv,false);
|
||||
new Xport(NULL,"main");
|
||||
return a.exec();
|
||||
}
|
||||
72
web/rdxport/rdxport.h
Normal file
72
web/rdxport/rdxport.h
Normal file
@@ -0,0 +1,72 @@
|
||||
// rdxport.h
|
||||
//
|
||||
// Rivendell web service portal
|
||||
//
|
||||
// (C) Copyright 2010 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: rdxport.h,v 1.7.2.3 2013/10/14 04:23:54 cvs Exp $
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
|
||||
#ifndef RDXPORT_H
|
||||
#define RDXPORT_H
|
||||
|
||||
#include <qobject.h>
|
||||
|
||||
#include <rdconfig.h>
|
||||
#include <rduser.h>
|
||||
#include <rdsystem.h>
|
||||
|
||||
class Xport : public QObject
|
||||
{
|
||||
public:
|
||||
Xport(QObject *parent=0,const char *name=0);
|
||||
|
||||
private:
|
||||
bool Authenticate();
|
||||
void Export();
|
||||
void Import();
|
||||
void DeleteAudio();
|
||||
void AddCart();
|
||||
void ListCarts();
|
||||
void ListCart();
|
||||
void EditCart();
|
||||
void RemoveCart();
|
||||
void AddCut();
|
||||
void ListCuts();
|
||||
void ListCut();
|
||||
void EditCut();
|
||||
void RemoveCut();
|
||||
void ListGroups();
|
||||
void ListGroup();
|
||||
void ExportPeaks();
|
||||
void TrimAudio();
|
||||
void CopyAudio();
|
||||
void AudioInfo();
|
||||
void ListLogs();
|
||||
void ListLog();
|
||||
void ListServices();
|
||||
void Exit(int code);
|
||||
void XmlExit(const QString &str,int code,
|
||||
RDAudioConvert::ErrorCode err=RDAudioConvert::ErrorOk);
|
||||
RDFormPost *xport_post;
|
||||
RDUser *xport_user;
|
||||
RDConfig *xport_config;
|
||||
RDSystem *xport_system;
|
||||
};
|
||||
|
||||
|
||||
#endif // RDXPORT_H
|
||||
0
web/rdxport/rdxport.pro
Normal file
0
web/rdxport/rdxport.pro
Normal file
77
web/rdxport/services.cpp
Normal file
77
web/rdxport/services.cpp
Normal file
@@ -0,0 +1,77 @@
|
||||
// services.cpp
|
||||
//
|
||||
// Rivendell web service portal -- Service services
|
||||
//
|
||||
// (C) Copyright 2010 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: services.cpp,v 1.1.2.1 2013/10/11 22:00:53 cvs Exp $
|
||||
//
|
||||
// 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 <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <rddb.h>
|
||||
#include <rdformpost.h>
|
||||
#include <rdweb.h>
|
||||
#include <rduser.h>
|
||||
#include <rdsvc.h>
|
||||
#include <rdconf.h>
|
||||
#include <rdescape_string.h>
|
||||
|
||||
#include <rdxport.h>
|
||||
|
||||
void Xport::ListServices()
|
||||
{
|
||||
QString sql;
|
||||
RDSqlQuery *q;
|
||||
RDSvc *svc;
|
||||
QString trackable;
|
||||
|
||||
//
|
||||
// Get Options
|
||||
//
|
||||
xport_post->getValue("TRACKABLE",&trackable);
|
||||
|
||||
//
|
||||
// Generate Service List
|
||||
//
|
||||
sql="select NAME from SERVICES";
|
||||
if(trackable=="1") {
|
||||
sql+=" where (TRACK_GROUP!=\"\")&&(TRACK_GROUP is not null)";
|
||||
}
|
||||
sql+=" order by NAME";
|
||||
q=new RDSqlQuery(sql);
|
||||
|
||||
//
|
||||
// Process Request
|
||||
//
|
||||
printf("Content-type: application/xml\n");
|
||||
printf("Status: 200\n\n");
|
||||
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
|
||||
printf("<serviceList>\n");
|
||||
while(q->next()) {
|
||||
svc=new RDSvc(q->value(0).toString());
|
||||
printf("%s",(const char *)svc->xml());
|
||||
delete svc;
|
||||
}
|
||||
printf("</serviceList>\n");
|
||||
|
||||
delete q;
|
||||
Exit(0);
|
||||
}
|
||||
98
web/rdxport/trimaudio.cpp
Normal file
98
web/rdxport/trimaudio.cpp
Normal file
@@ -0,0 +1,98 @@
|
||||
// trimaudio.cpp
|
||||
//
|
||||
// Rivendell web service portal -- TrimAudio service
|
||||
//
|
||||
// (C) Copyright 2010 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// $Id: trimaudio.cpp,v 1.4 2012/02/13 23:01:50 cvs Exp $
|
||||
//
|
||||
// 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 <rdcart.h>
|
||||
#include <rdaudioconvert.h>
|
||||
#include <rdsettings.h>
|
||||
#include <rdconf.h>
|
||||
|
||||
#include <rdxport.h>
|
||||
|
||||
void Xport::TrimAudio()
|
||||
{
|
||||
int point;
|
||||
|
||||
//
|
||||
// Verify Post
|
||||
//
|
||||
int cartnum=0;
|
||||
if(!xport_post->getValue("CART_NUMBER",&cartnum)) {
|
||||
XmlExit("Missing CART_NUMBER",400);
|
||||
}
|
||||
int cutnum=0;
|
||||
if(!xport_post->getValue("CUT_NUMBER",&cutnum)) {
|
||||
XmlExit("Missing CUT_NUMBER",400);
|
||||
}
|
||||
|
||||
int trim_level=0;
|
||||
if(!xport_post->getValue("TRIM_LEVEL",&trim_level)) {
|
||||
XmlExit("Missing TRIM_LEVEL",400);
|
||||
}
|
||||
|
||||
//
|
||||
// Verify User Perms
|
||||
//
|
||||
if(!xport_user->cartAuthorized(cartnum)) {
|
||||
XmlExit("No such cart",404);
|
||||
}
|
||||
|
||||
//
|
||||
// Open Audio File
|
||||
//
|
||||
RDWaveFile *wave=new RDWaveFile(RDCut::pathName(cartnum,cutnum));
|
||||
if(!wave->openWave()) {
|
||||
XmlExit("No such audio",404);
|
||||
}
|
||||
if(!wave->hasEnergy()) {
|
||||
XmlExit("No peak data available",400);
|
||||
}
|
||||
|
||||
//
|
||||
// Send Data
|
||||
//
|
||||
printf("Content-type: application/xml\n\n");
|
||||
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
|
||||
printf("<trimPoint>\n");
|
||||
printf(" <cartNumber>%u</cartNumber>\n",cartnum);
|
||||
printf(" <cutNumber>%d</cutNumber>\n",cutnum);
|
||||
printf(" <trimLevel>%d</trimLevel>\n",trim_level);
|
||||
point=wave->startTrim(REFERENCE_LEVEL-trim_level);
|
||||
if(point>=0) {
|
||||
point=(double)point*1000.0/(double)wave->getSamplesPerSec();
|
||||
}
|
||||
printf(" <startTrimPoint>%d</startTrimPoint>\n",point);
|
||||
point=wave->endTrim(REFERENCE_LEVEL-trim_level);
|
||||
if(point>=0) {
|
||||
point=(double)point*1000.0/(double)wave->getSamplesPerSec();
|
||||
}
|
||||
printf(" <endTrimPoint>%d</endTrimPoint>\n",point);
|
||||
printf("</trimPoint>\n");
|
||||
Exit(0);
|
||||
}
|
||||
96
web/tests/Makefile.am
Normal file
96
web/tests/Makefile.am
Normal file
@@ -0,0 +1,96 @@
|
||||
## automake.am
|
||||
##
|
||||
## Automake.am for rivendell/web/tests
|
||||
##
|
||||
## (C) Copyright 2010,2013 Fred Gleason <fredg@paravelsystems.com>
|
||||
##
|
||||
## $Id: Makefile.am,v 1.6.6.4 2013/10/14 04:23:55 cvs Exp $
|
||||
##
|
||||
## 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.
|
||||
##
|
||||
## Use automake to process this into a Makefile.in
|
||||
|
||||
install-exec-am:
|
||||
mkdir -p $(DESTDIR)@libexecdir@
|
||||
cp addcart.html $(DESTDIR)@libexecdir@
|
||||
cp addcut.html $(DESTDIR)@libexecdir@
|
||||
cp audioinfo.html $(DESTDIR)@libexecdir@
|
||||
cp copyaudio.html $(DESTDIR)@libexecdir@
|
||||
cp delete_audio.html $(DESTDIR)@libexecdir@
|
||||
cp editcart.html $(DESTDIR)@libexecdir@
|
||||
cp export.html $(DESTDIR)@libexecdir@
|
||||
cp exportpeaks.html $(DESTDIR)@libexecdir@
|
||||
cp import.html $(DESTDIR)@libexecdir@
|
||||
cp import.html $(DESTDIR)@libexecdir@
|
||||
cp listcart.html $(DESTDIR)@libexecdir@
|
||||
cp listcarts.html $(DESTDIR)@libexecdir@
|
||||
cp listcut.html $(DESTDIR)@libexecdir@
|
||||
cp listcuts.html $(DESTDIR)@libexecdir@
|
||||
cp listgroup.html $(DESTDIR)@libexecdir@
|
||||
cp listgroups.html $(DESTDIR)@libexecdir@
|
||||
cp listlog.html $(DESTDIR)@libexecdir@
|
||||
cp listlogs.html $(DESTDIR)@libexecdir@
|
||||
cp listservices.html $(DESTDIR)@libexecdir@
|
||||
cp removecart.html $(DESTDIR)@libexecdir@
|
||||
cp removecut.html $(DESTDIR)@libexecdir@
|
||||
cp trimaudio.html $(DESTDIR)@libexecdir@
|
||||
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)@libexecdir@/addcart.html
|
||||
rm -f $(DESTDIR)@libexecdir@/addcut.html
|
||||
rm -f $(DESTDIR)@libexecdir@/audioinfo.html
|
||||
rm -f $(DESTDIR)@libexecdir@/copyaudio.html
|
||||
rm -f $(DESTDIR)@libexecdir@/delete_audio.html
|
||||
rm -f $(DESTDIR)@libexecdir@/editcart.html
|
||||
rm -f $(DESTDIR)@libexecdir@/export.html
|
||||
rm -f $(DESTDIR)@libexecdir@/exportpeaks.html
|
||||
rm -f $(DESTDIR)@libexecdir@/import.html
|
||||
rm -f $(DESTDIR)@libexecdir@/listcart.html
|
||||
rm -f $(DESTDIR)@libexecdir@/listcarts.html
|
||||
rm -f $(DESTDIR)@libexecdir@/listcut.html
|
||||
rm -f $(DESTDIR)@libexecdir@/listcuts.html
|
||||
rm -f $(DESTDIR)@libexecdir@/listgroup.html
|
||||
rm -f $(DESTDIR)@libexecdir@/listgroups.html
|
||||
rm -f $(DESTDIR)@libexecdir@/listlog.html
|
||||
rm -f $(DESTDIR)@libexecdir@/listlogs.html
|
||||
rm -f $(DESTDIR)@libexecdir@/listservices.html
|
||||
rm -f $(DESTDIR)@libexecdir@/removecart.html
|
||||
rm -f $(DESTDIR)@libexecdir@/removecut.html
|
||||
rm -f $(DESTDIR)@libexecdir@/trimaudio.html
|
||||
|
||||
EXTRA_DIST = addcart.html\
|
||||
addcut.html\
|
||||
audioinfo.html\
|
||||
copyaudio.html\
|
||||
delete_audio.html\
|
||||
editcart.html\
|
||||
export.html\
|
||||
exportpeaks.html\
|
||||
import.html\
|
||||
listcart.html\
|
||||
listcarts.html\
|
||||
listcut.html\
|
||||
listcuts.html\
|
||||
listgroup.html\
|
||||
listgroups.html\
|
||||
listlog.html\
|
||||
listlogs.html\
|
||||
listservices.html\
|
||||
removecart.html\
|
||||
removecut.html\
|
||||
trimaudio.html
|
||||
|
||||
CLEANFILES = *~
|
||||
MAINTAINERCLEANFILES = *~\
|
||||
Makefile.in
|
||||
41
web/tests/addcart.html
Normal file
41
web/tests/addcart.html
Normal file
@@ -0,0 +1,41 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Rivendell ADDCART Service Test Harness</title>
|
||||
<body>
|
||||
<form action="/rd-bin/rdxport.cgi" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="COMMAND" value="12">
|
||||
<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 align="right">GROUP NAME:</td>
|
||||
<td><input type="text" name="GROUP_NAME" size="12" maxlength="10"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">TYPE:</td>
|
||||
<td><select name="TYPE">
|
||||
<option value="audio">audio</option>
|
||||
<option value="macro">macro</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">CART NUMBER:</td>
|
||||
<td><input type="text" name="CART_NUMBER" size="20" maxlength="6"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><input type="submit" value="OK"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
29
web/tests/addcut.html
Normal file
29
web/tests/addcut.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Rivendell ADDCUT Service Test Harness</title>
|
||||
<body>
|
||||
<form action="/rd-bin/rdxport.cgi" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="COMMAND" value="10">
|
||||
<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 align="right">CART NUMBER:</td>
|
||||
<td><input type="text" name="CART_NUMBER" size="20" maxlength="6"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><input type="submit" value="OK"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
33
web/tests/audioinfo.html
Normal file
33
web/tests/audioinfo.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Rivendell AUDIOINFO Service Test Harness</title>
|
||||
<body>
|
||||
<form action="/rd-bin/rdxport.cgi" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="COMMAND" value="19">
|
||||
<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 align="right">CART NUMBER:</td>
|
||||
<td><input type="text" name="CART_NUMBER" size="20" maxlength="6"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">CUT NUMBER:</td>
|
||||
<td><input type="text" name="CUT_NUMBER" size="20" maxlength="3"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><input type="submit" value="OK"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
41
web/tests/copyaudio.html
Normal file
41
web/tests/copyaudio.html
Normal file
@@ -0,0 +1,41 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Rivendell COPYAUDIO Service Test Harness</title>
|
||||
<body>
|
||||
<form action="/rd-bin/rdxport.cgi" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="COMMAND" value="18">
|
||||
<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 align="right">SOURCE_CART NUMBER:</td>
|
||||
<td><input type="text" name="SOURCE_CART_NUMBER" size="8" maxlength="6"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">SOURCE_CUT NUMBER:</td>
|
||||
<td><input type="text" name="SOURCE_CUT_NUMBER" size="6" maxlength="3"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">DESTINATION_CART NUMBER:</td>
|
||||
<td><input type="text" name="DESTINATION_CART_NUMBER" size="8" maxlength="6"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">DESTINATION_CUT NUMBER:</td>
|
||||
<td><input type="text" name="DESTINATION_CUT_NUMBER" size="6" maxlength="3"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><input type="submit" value="OK"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
33
web/tests/delete_audio.html
Normal file
33
web/tests/delete_audio.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Rivendell DELETE AUDIO Service Test Harness</title>
|
||||
<body>
|
||||
<form action="/rd-bin/rdxport.cgi" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="COMMAND" value="3">
|
||||
<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 align="right">CART NUMBER:</td>
|
||||
<td><input type="text" name="CART_NUMBER" size="8" maxlength="6"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">CUT NUMBER:</td>
|
||||
<td><input type="text" name="CUT_NUMBER" size="6" maxlength="3"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><input type="submit" value="OK"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
43
web/tests/editcart.html
Normal file
43
web/tests/editcart.html
Normal file
@@ -0,0 +1,43 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Rivendell EDITCART Service Test Harness</title>
|
||||
<body>
|
||||
<form action="/rd-bin/rdxport.cgi" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="COMMAND" value="14">
|
||||
<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 align="right">CART NUMBER:</td>
|
||||
<td><input type="text" name="CART_NUMBER" size="20" maxlength="255"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">INCLUDE CUTS:</td>
|
||||
<td><input type="text" name="INCLUDE_CUTS" 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">TITLE:</td>
|
||||
<td><input type="text" name="TITLE" size="20" maxlength="255"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><input type="submit" value="OK"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
90
web/tests/export.html
Normal file
90
web/tests/export.html
Normal file
@@ -0,0 +1,90 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Rivendell EXPORT Service Test Harness</title>
|
||||
<body>
|
||||
<form action="/rd-bin/rdxport.cgi" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="COMMAND" value="1">
|
||||
<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 align="right">CART NUMBER:</td>
|
||||
<td><input type="text" name="CART_NUMBER" size="8" maxlength="6"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">CUT NUMBER:</td>
|
||||
<td><input type="text" name="CUT_NUMBER" size="6" maxlength="3"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">FORMAT:</td>
|
||||
<td><select name="FORMAT">
|
||||
<option value="0">PCM16</option>
|
||||
<option value="2">MPEG Layer 2</option>
|
||||
<option value="3">MPEG Layer 3</option>
|
||||
<option value="4">FLAC</option>
|
||||
<option value="5">OggVorbis</option>
|
||||
<option value="6">MPEG Layer 2 - WAV</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">CHANNELS:</td>
|
||||
<td><input type="text" name="CHANNELS" size="3" maxlength="1"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">SAMPLE RATE:</td>
|
||||
<td><input type="text" name="SAMPLE_RATE" size="8" maxlength="5"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">BIT RATE:</td>
|
||||
<td><input type="text" name="BIT_RATE" size="6" maxlength="6"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">QUALITY:</td>
|
||||
<td><select name="QUALITY">
|
||||
<option value="-1">None</option>
|
||||
<option value="0">0</option>
|
||||
<option value="1">1</option>
|
||||
<option value="2">2</option>
|
||||
<option value="3">3</option>
|
||||
<option value="4">4</option>
|
||||
<option value="5">5</option>
|
||||
<option value="6">6</option>
|
||||
<option value="7">7</option>
|
||||
<option value="8">8</option>
|
||||
<option value="9">9</option>
|
||||
<option value="10">10</option>
|
||||
</select>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">START POINT:</td>
|
||||
<td><input type="text" name="START_POINT" size="10" value="-1"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">END POINT:</td>
|
||||
<td><input type="text" name="END_POINT" size="10" value="-1"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">NORMALIZATION LEVEL:</td>
|
||||
<td><input type="text" name="NORMALIZATION_LEVEL" size="6" maxlength="4"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">ENABLE METADATA:</td>
|
||||
<td><input type="text" name="ENABLE_METADATA" size="6" maxlength="4"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><input type="submit" value="OK"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
33
web/tests/exportpeaks.html
Normal file
33
web/tests/exportpeaks.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Rivendell EXPORT PEAKS Service Test Harness</title>
|
||||
<body>
|
||||
<form action="/rd-bin/rdxport.cgi" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="COMMAND" value="16">
|
||||
<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 align="right">CART NUMBER:</td>
|
||||
<td><input type="text" name="CART_NUMBER" size="8" maxlength="6"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">CUT NUMBER:</td>
|
||||
<td><input type="text" name="CUT_NUMBER" size="6" maxlength="3"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><input type="submit" value="OK"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
53
web/tests/import.html
Normal file
53
web/tests/import.html
Normal file
@@ -0,0 +1,53 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Rivendel IMPORT Service Test Harness</title>
|
||||
<body>
|
||||
<form action="/rd-bin/rdxport.cgi" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="COMMAND" value="2">
|
||||
<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 align="right">CART NUMBER:</td>
|
||||
<td><input type="text" name="CART_NUMBER" size="8" maxlength="6"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">CUT NUMBER:</td>
|
||||
<td><input type="text" name="CUT_NUMBER" size="6" maxlength="3"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">CHANNELS:</td>
|
||||
<td><input type="text" name="CHANNELS" size="3" maxlength="1"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">NORMALIZATION LEVEL:</td>
|
||||
<td><input type="text" name="NORMALIZATION_LEVEL" size="6" maxlength="4"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">AUTOTRIM LEVEL:</td>
|
||||
<td><input type="text" name="AUTOTRIM_LEVEL" size="6" maxlength="4"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">USE METADATA:</td>
|
||||
<td><input type="text" name="USE_METADATA" size="2" maxlength="1"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">FILE:</td>
|
||||
<td><input type="file" name="FILENAME" size="20" maxlength="64"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><input type="submit" value="OK"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
33
web/tests/listcart.html
Normal file
33
web/tests/listcart.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Rivendell LISTCART Service Test Harness</title>
|
||||
<body>
|
||||
<form action="/rd-bin/rdxport.cgi" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="COMMAND" value="7">
|
||||
<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 align="right">CART NUMBER:</td>
|
||||
<td><input type="text" name="CART_NUMBER" size="20" maxlength="255"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">INCLUDE CUTS:</td>
|
||||
<td><input type="text" name="INCLUDE_CUTS" size="2" maxlength="1"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><input type="submit" value="OK"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
37
web/tests/listcarts.html
Normal file
37
web/tests/listcarts.html
Normal file
@@ -0,0 +1,37 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Rivendell LISTCARTS Service Test Harness</title>
|
||||
<body>
|
||||
<form action="/rd-bin/rdxport.cgi" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="COMMAND" value="6">
|
||||
<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 align="right">GROUP NAME:</td>
|
||||
<td><input type="text" name="GROUP_NAME" size="20" maxlength="255"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">FILTER:</td>
|
||||
<td><input type="text" name="FILTER" size="60" maxlength="255"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">INCLUDE CUTS:</td>
|
||||
<td><input type="text" name="INCLUDE_CUTS" size="2" maxlength="1"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><input type="submit" value="OK"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
33
web/tests/listcut.html
Normal file
33
web/tests/listcut.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Rivendell LISTCUT Service Test Harness</title>
|
||||
<body>
|
||||
<form action="/rd-bin/rdxport.cgi" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="COMMAND" value="8">
|
||||
<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 align="right">CART NUMBER:</td>
|
||||
<td><input type="text" name="CART_NUMBER" size="20" maxlength="6"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">CUT NUMBER:</td>
|
||||
<td><input type="text" name="CUT_NUMBER" size="20" maxlength="3"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><input type="submit" value="OK"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
29
web/tests/listcuts.html
Normal file
29
web/tests/listcuts.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Rivendell LISTCUTS Service Test Harness</title>
|
||||
<body>
|
||||
<form action="/rd-bin/rdxport.cgi" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="COMMAND" value="9">
|
||||
<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 align="right">CART NUMBER:</td>
|
||||
<td><input type="text" name="CART_NUMBER" size="20" maxlength="6"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><input type="submit" value="OK"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
29
web/tests/listgroup.html
Normal file
29
web/tests/listgroup.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Rivendell LISTGROUP Service Test Harness</title>
|
||||
<body>
|
||||
<form action="/rd-bin/rdxport.cgi" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="COMMAND" value="5">
|
||||
<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 align="right">GROUP NAME:</td>
|
||||
<td><input type="text" name="GROUP_NAME" size="20" maxlength="255"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><input type="submit" value="OK"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
25
web/tests/listgroups.html
Normal file
25
web/tests/listgroups.html
Normal file
@@ -0,0 +1,25 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Rivendell LISTGROUPS Service Test Harness</title>
|
||||
<body>
|
||||
<form action="/rd-bin/rdxport.cgi" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="COMMAND" value="4">
|
||||
<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"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><input type="submit" value="OK"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
29
web/tests/listlog.html
Normal file
29
web/tests/listlog.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Rivendell LISTLOG Service Test Harness</title>
|
||||
<body>
|
||||
<form action="/rd-bin/rdxport.cgi" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="COMMAND" value="22">
|
||||
<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 align="right">NAME:</td>
|
||||
<td><input type="text" name="NAME" size="20" maxlength="64"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><input type="submit" value="OK"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
33
web/tests/listlogs.html
Normal file
33
web/tests/listlogs.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Rivendell LISTLOGS Service Test Harness</title>
|
||||
<body>
|
||||
<form action="/rd-bin/rdxport.cgi" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="COMMAND" value="20">
|
||||
<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 align="right">SERVICE NAME:</td>
|
||||
<td><input type="text" name="SERVICE_NAME" size="20" maxlength="10"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">TRACKABLE:</td>
|
||||
<td><input type="text" name="TRACKABLE" size="2" maxlength="1"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><input type="submit" value="OK"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
29
web/tests/listservices.html
Normal file
29
web/tests/listservices.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Rivendell LISTSERVICES Service Test Harness</title>
|
||||
<body>
|
||||
<form action="/rd-bin/rdxport.cgi" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="COMMAND" value="21">
|
||||
<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 align="right">TRACKABLE:</td>
|
||||
<td><input type="text" name="TRACKABLE" size="2" maxlength="1"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><input type="submit" value="OK"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
29
web/tests/removecart.html
Normal file
29
web/tests/removecart.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Rivendell REMOVECART Service Test Harness</title>
|
||||
<body>
|
||||
<form action="/rd-bin/rdxport.cgi" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="COMMAND" value="13">
|
||||
<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 align="right">CART NUMBER:</td>
|
||||
<td><input type="text" name="CART_NUMBER" size="20" maxlength="6"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><input type="submit" value="OK"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
33
web/tests/removecut.html
Normal file
33
web/tests/removecut.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Rivendell REMOVECUT Service Test Harness</title>
|
||||
<body>
|
||||
<form action="/rd-bin/rdxport.cgi" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="COMMAND" value="11">
|
||||
<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 align="right">CART NUMBER:</td>
|
||||
<td><input type="text" name="CART_NUMBER" size="20" maxlength="6"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">CUT NUMBER:</td>
|
||||
<td><input type="text" name="CUT_NUMBER" size="20" maxlength="3"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><input type="submit" value="OK"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
37
web/tests/trimaudio.html
Normal file
37
web/tests/trimaudio.html
Normal file
@@ -0,0 +1,37 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Rivendell TRIMAUDIO Service Test Harness</title>
|
||||
<body>
|
||||
<form action="/rd-bin/rdxport.cgi" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="COMMAND" value="17">
|
||||
<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 align="right">CART NUMBER:</td>
|
||||
<td><input type="text" name="CART_NUMBER" size="20" maxlength="6"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">CUT NUMBER:</td>
|
||||
<td><input type="text" name="CUT_NUMBER" size="20" maxlength="3"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">TRIM LEVEL:</td>
|
||||
<td><input type="text" name="TRIM_LEVEL" size="20" maxlength="6"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><input type="submit" value="OK"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
0
web/web.pro
Normal file
0
web/web.pro
Normal file
Reference in New Issue
Block a user