2017-08-31 Fred Gleason <fredg@paravelsystems.com>

* Modified web client components to use a distinctive http USER_AGENT
	string.
This commit is contained in:
Fred Gleason 2017-08-31 12:38:39 -04:00
parent 8d9a2ecadc
commit aef7c2229b
80 changed files with 216 additions and 69 deletions

View File

@ -15988,3 +15988,6 @@
* Added an 'RDRenderer' class in 'lib/rdrenderer.cpp' and * Added an 'RDRenderer' class in 'lib/rdrenderer.cpp' and
'lib/rdrenderer.h'. 'lib/rdrenderer.h'.
* Refactored rdrender(1) to use the 'RDRenderer' class. * Refactored rdrender(1) to use the 'RDRenderer' class.
2017-08-31 Fred Gleason <fredg@paravelsystems.com>
* Modified web client components to use a distinctive http USER_AGENT
string.

View File

@ -131,6 +131,7 @@ MainObject::MainObject(QObject *parent,const char *name)
// //
rd_config=new RDConfig(RD_CONF_FILE); rd_config=new RDConfig(RD_CONF_FILE);
rd_config->load(); rd_config->load();
rd_config->setModuleName("caed");
// //
// Make sure we're the only instance running // Make sure we're the only instance running

View File

@ -134,6 +134,7 @@ MainObject::MainObject(QObject *parent)
// //
rdconfig=new RDConfig(RD_CONF_FILE); rdconfig=new RDConfig(RD_CONF_FILE);
rdconfig->load(); rdconfig->load();
rdconfig->setModuleName("nexgen_filter");
// //
// Open Database // Open Database

View File

@ -52,6 +52,7 @@ MainObject::MainObject(QObject *parent)
rd_config=new RDConfig(RD_CONF_FILE); rd_config=new RDConfig(RD_CONF_FILE);
rd_config->load(); rd_config->load();
rd_config->setModuleName("panel_copy");
// //
// Read Switches // Read Switches

View File

@ -52,6 +52,7 @@ MainObject::MainObject(QObject *parent)
rd_config=new RDConfig(RD_CONF_FILE); rd_config=new RDConfig(RD_CONF_FILE);
rd_config->load(); rd_config->load();
rd_config->setModuleName("rdcatch_copy");
// //
// Read Switches // Read Switches

View File

@ -79,6 +79,7 @@ MainObject::MainObject(QObject *parent)
rdconfig=new RDConfig(RD_CONF_FILE); rdconfig=new RDConfig(RD_CONF_FILE);
rdconfig->load(); rdconfig->load();
rdconfig->setModuleName("rivendell_filter");
// //
// Open Local Database // Open Local Database

View File

@ -59,6 +59,8 @@ MainObject::MainObject(QObject *parent)
rd_config=new RDConfig(RD_CONF_FILE); rd_config=new RDConfig(RD_CONF_FILE);
rd_config->load(); rd_config->load();
rd_config->setModuleName("sas_filter");
filter_switch_count=0; filter_switch_count=0;
filter_macro_count=0; filter_macro_count=0;

View File

@ -62,6 +62,7 @@ MainObject::MainObject(QObject *parent)
rdconfig=new RDConfig(RD_CONF_FILE); rdconfig=new RDConfig(RD_CONF_FILE);
rdconfig->load(); rdconfig->load();
rdconfig->setModuleName("wings_filter");
// //
// Open Database // Open Database

View File

@ -2,7 +2,7 @@
// //
// Export an Audio File using the RdXport Web Service // Export an Audio File using the RdXport Web Service
// //
// (C) Copyright 2010,2016 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2010,2016-2017 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License version 2 as
@ -175,6 +175,8 @@ RDAudioExport::ErrorCode RDAudioExport::runExport(const QString &username,
curl_easy_setopt(curl,CURLOPT_WRITEDATA,f); curl_easy_setopt(curl,CURLOPT_WRITEDATA,f);
curl_easy_setopt(curl,CURLOPT_POST,1); curl_easy_setopt(curl,CURLOPT_POST,1);
curl_easy_setopt(curl,CURLOPT_POSTFIELDS,(const char *)post); curl_easy_setopt(curl,CURLOPT_POSTFIELDS,(const char *)post);
curl_easy_setopt(curl,CURLOPT_USERAGENT,
(const char *)conv_config->userAgent());
curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT);
curl_easy_setopt(curl,CURLOPT_PROGRESSFUNCTION,ExportProgressCallback); curl_easy_setopt(curl,CURLOPT_PROGRESSFUNCTION,ExportProgressCallback);
curl_easy_setopt(curl,CURLOPT_PROGRESSDATA,this); curl_easy_setopt(curl,CURLOPT_PROGRESSDATA,this);

View File

@ -2,7 +2,7 @@
// //
// Import an Audio File using the RdXport Web Service // Import an Audio File using the RdXport Web Service
// //
// (C) Copyright 2010-2014,2016 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2010-2014,2016-2017 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License version 2 as
@ -169,6 +169,8 @@ RDAudioImport::ErrorCode RDAudioImport::runImport(const QString &username,
} }
curl_easy_setopt(curl,CURLOPT_WRITEDATA,stdout); curl_easy_setopt(curl,CURLOPT_WRITEDATA,stdout);
curl_easy_setopt(curl,CURLOPT_HTTPPOST,first); curl_easy_setopt(curl,CURLOPT_HTTPPOST,first);
curl_easy_setopt(curl,CURLOPT_USERAGENT,
(const char *)conv_config->userAgent());
curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT);
curl_easy_setopt(curl,CURLOPT_PROGRESSFUNCTION,ImportProgressCallback); curl_easy_setopt(curl,CURLOPT_PROGRESSFUNCTION,ImportProgressCallback);
curl_easy_setopt(curl,CURLOPT_PROGRESSDATA,this); curl_easy_setopt(curl,CURLOPT_PROGRESSDATA,this);

View File

@ -2,7 +2,7 @@
// //
// Get information about a cut in the audio store. // Get information about a cut in the audio store.
// //
// (C) Copyright 2011,2016 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2011,2016-2017 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License version 2 as
@ -141,6 +141,8 @@ RDAudioInfo::ErrorCode RDAudioInfo::runInfo(const QString &username,
curl_easy_setopt(curl,CURLOPT_WRITEDATA,&conv_xml); curl_easy_setopt(curl,CURLOPT_WRITEDATA,&conv_xml);
curl_easy_setopt(curl,CURLOPT_POST,1); curl_easy_setopt(curl,CURLOPT_POST,1);
curl_easy_setopt(curl,CURLOPT_POSTFIELDS,(const char *)post); curl_easy_setopt(curl,CURLOPT_POSTFIELDS,(const char *)post);
curl_easy_setopt(curl,CURLOPT_USERAGENT,
(const char *)conv_config->userAgent());
curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT);
switch(curl_err=curl_easy_perform(curl)) { switch(curl_err=curl_easy_perform(curl)) {

View File

@ -2,7 +2,7 @@
// //
// Get information about the audio store. // Get information about the audio store.
// //
// (C) Copyright 2014-2016 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2014-2017 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License version 2 as
@ -97,6 +97,8 @@ RDAudioStore::ErrorCode RDAudioStore::runStore(const QString &username,
curl_easy_setopt(curl,CURLOPT_WRITEDATA,&conv_xml); curl_easy_setopt(curl,CURLOPT_WRITEDATA,&conv_xml);
curl_easy_setopt(curl,CURLOPT_POST,1); curl_easy_setopt(curl,CURLOPT_POST,1);
curl_easy_setopt(curl,CURLOPT_POSTFIELDS,(const char *)post); curl_easy_setopt(curl,CURLOPT_POSTFIELDS,(const char *)post);
curl_easy_setopt(curl,CURLOPT_USERAGENT,
(const char *)conv_config->userAgent());
curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT);
switch(curl_err=curl_easy_perform(curl)) { switch(curl_err=curl_easy_perform(curl)) {

View File

@ -32,6 +32,7 @@
#include <rd.h> #include <rd.h>
#include <rdconf.h> #include <rdconf.h>
#include <rdconfig.h>
#include <rdcart.h> #include <rdcart.h>
#include <rdcut.h> #include <rdcut.h>
#include <rdtextvalidator.h> #include <rdtextvalidator.h>
@ -1641,6 +1642,8 @@ bool RDCart::removeCutAudio(RDStation *station,RDUser *user,unsigned cart_num,
curl_easy_setopt(curl,CURLOPT_URL,url); curl_easy_setopt(curl,CURLOPT_URL,url);
curl_easy_setopt(curl,CURLOPT_POST,1); curl_easy_setopt(curl,CURLOPT_POST,1);
curl_easy_setopt(curl,CURLOPT_POSTFIELDS,(const char *)post); curl_easy_setopt(curl,CURLOPT_POSTFIELDS,(const char *)post);
curl_easy_setopt(curl,CURLOPT_USERAGENT,
(const char *)RDConfig::userAgent(""));
curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT);
curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,CartWriteCallback); curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,CartWriteCallback);
curl_easy_setopt(curl,CURLOPT_WRITEDATA,&xml); curl_easy_setopt(curl,CURLOPT_WRITEDATA,&xml);

View File

@ -49,7 +49,7 @@ RDConfig::RDConfig()
} }
RDConfig::RDConfig(QString filename) RDConfig::RDConfig(const QString &filename)
{ {
clear(); clear();
conf_filename=filename; conf_filename=filename;
@ -67,37 +67,62 @@ void RDConfig::setFilename(QString filename)
conf_filename=filename; conf_filename=filename;
} }
QString RDConfig::moduleName() const
{
return conf_module_name;
}
void RDConfig::setModuleName(const QString &modname)
{
conf_module_name=modname;
}
QString RDConfig::userAgent() const
{
return RDConfig::userAgent(conf_module_name);
}
QString RDConfig::audioRoot() const QString RDConfig::audioRoot() const
{ {
return conf_audio_root; return conf_audio_root;
} }
QString RDConfig::audioExtension() const QString RDConfig::audioExtension() const
{ {
return conf_audio_extension; return conf_audio_extension;
} }
QString RDConfig::audioFileName (QString cutname) QString RDConfig::audioFileName (QString cutname)
{ {
return audioRoot() + QString("/") + cutname + QString(".") + return audioRoot() + QString("/") + cutname + QString(".") +
audioExtension(); audioExtension();
}; };
QString RDConfig::label() const QString RDConfig::label() const
{ {
return conf_label; return conf_label;
} }
QString RDConfig::audioStoreMountSource() const QString RDConfig::audioStoreMountSource() const
{ {
return conf_audio_store_mount_source; return conf_audio_store_mount_source;
} }
QString RDConfig::audioStoreMountType() const QString RDConfig::audioStoreMountType() const
{ {
return conf_audio_store_mount_type; return conf_audio_store_mount_type;
} }
QString RDConfig::audioStoreMountOptions() const QString RDConfig::audioStoreMountOptions() const
{ {
return conf_audio_store_mount_options; return conf_audio_store_mount_options;
@ -523,6 +548,7 @@ void RDConfig::clear()
#else #else
conf_filename=RD_CONF_FILE; conf_filename=RD_CONF_FILE;
#endif #endif
conf_module_name="";
conf_mysql_hostname=""; conf_mysql_hostname="";
conf_mysql_username=""; conf_mysql_username="";
conf_mysql_dbname=""; conf_mysql_dbname="";
@ -573,3 +599,12 @@ void RDConfig::clear()
conf_sas_tty_device=""; conf_sas_tty_device="";
conf_destinations.clear(); conf_destinations.clear();
} }
QString RDConfig::userAgent(const QString &modname)
{
if(modname.isEmpty()) {
return QString("Mozilla/5.0")+" rivendell/"+VERSION;
}
return QString("Mozilla/5.0 rivendell/")+VERSION+" ("+modname+")";
}

View File

@ -47,9 +47,12 @@ class RDConfig
#endif // WIN32 #endif // WIN32
RDConfig(); RDConfig();
RDConfig(QString filename); RDConfig(const QString &filename);
QString filename() const; QString filename() const;
void setFilename(QString filename); void setFilename(QString filename);
QString moduleName() const;
void setModuleName(const QString &modname);
QString userAgent() const;
QString mysqlHostname() const; QString mysqlHostname() const;
QString mysqlUsername() const; QString mysqlUsername() const;
QString mysqlDbname() const; QString mysqlDbname() const;
@ -103,9 +106,11 @@ class RDConfig
QString destination(unsigned n); QString destination(unsigned n);
void load(); void load();
void clear(); void clear();
static QString userAgent(const QString &modname);
private: private:
QString conf_filename; QString conf_filename;
QString conf_module_name;
QString conf_mysql_hostname; QString conf_mysql_hostname;
QString conf_mysql_username; QString conf_mysql_username;
QString conf_mysql_dbname; QString conf_mysql_dbname;

View File

@ -102,6 +102,8 @@ RDCopyAudio::ErrorCode RDCopyAudio::runCopy(const QString &username,
curl_easy_setopt(curl,CURLOPT_URL,url); curl_easy_setopt(curl,CURLOPT_URL,url);
curl_easy_setopt(curl,CURLOPT_POST,1); curl_easy_setopt(curl,CURLOPT_POST,1);
curl_easy_setopt(curl,CURLOPT_POSTFIELDS,(const char *)post); curl_easy_setopt(curl,CURLOPT_POSTFIELDS,(const char *)post);
curl_easy_setopt(curl,CURLOPT_USERAGENT,
(const char *)conv_config->userAgent());
curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT);
switch(curl_easy_perform(curl)) { switch(curl_easy_perform(curl)) {

View File

@ -2,7 +2,7 @@
// //
// Delete a file from the audio store via the Rivendell Web Service // Delete a file from the audio store via the Rivendell Web Service
// //
// (C) Copyright 2010,2016 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2010,2016-2017 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License version 2 as
@ -67,9 +67,10 @@ int DeleteErrorCallback(CURL *curl,curl_infotype type,char *msg,size_t size,
} }
RDDelete::RDDelete(QObject *parent) RDDelete::RDDelete(RDConfig *config,QObject *parent)
: QObject(parent) : QObject(parent)
{ {
conv_config=config;
} }
@ -104,9 +105,10 @@ RDDelete::ErrorCode RDDelete::runDelete(const QString &username,
(const char *)password),256); (const char *)password),256);
curl_easy_setopt(curl,CURLOPT_USERPWD,userpwd); curl_easy_setopt(curl,CURLOPT_USERPWD,userpwd);
curl_easy_setopt(curl,CURLOPT_HTTPAUTH,CURLAUTH_ANY); curl_easy_setopt(curl,CURLOPT_HTTPAUTH,CURLAUTH_ANY);
printf("HERE\n");
curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,DeleteWriteCallback); curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,DeleteWriteCallback);
curl_easy_setopt(curl,CURLOPT_WRITEDATA,&xml); curl_easy_setopt(curl,CURLOPT_WRITEDATA,&xml);
curl_easy_setopt(curl,CURLOPT_USERAGENT,
(const char *)conv_config->userAgent());
if(log_debug) { if(log_debug) {
curl_easy_setopt(curl,CURLOPT_VERBOSE,1); curl_easy_setopt(curl,CURLOPT_VERBOSE,1);
curl_easy_setopt(curl,CURLOPT_DEBUGFUNCTION,DeleteErrorCallback); curl_easy_setopt(curl,CURLOPT_DEBUGFUNCTION,DeleteErrorCallback);

View File

@ -24,6 +24,8 @@
#include <qobject.h> #include <qobject.h>
#include <qurl.h> #include <qurl.h>
#include <rdconfig.h>
class RDDelete : public QObject class RDDelete : public QObject
{ {
Q_OBJECT; Q_OBJECT;
@ -34,7 +36,7 @@ class RDDelete : public QObject
ErrorUnspecified=8,ErrorInvalidUser=9, ErrorUnspecified=8,ErrorInvalidUser=9,
ErrorInvalidLogin=11,ErrorRemoteAccess=12, ErrorInvalidLogin=11,ErrorRemoteAccess=12,
ErrorRemoteConnection=13,ErrorUnknown=14}; ErrorRemoteConnection=13,ErrorUnknown=14};
RDDelete(QObject *parent=0); RDDelete(RDConfig *config,QObject *parent=0);
void setTargetUrl(const QString &url); void setTargetUrl(const QString &url);
RDDelete::ErrorCode runDelete(const QString &username, RDDelete::ErrorCode runDelete(const QString &username,
const QString &password, const QString &password,
@ -43,6 +45,7 @@ class RDDelete : public QObject
private: private:
QUrl conv_target_url; QUrl conv_target_url;
RDConfig *conv_config;
}; };

View File

@ -2,7 +2,7 @@
// //
// Download a File // Download a File
// //
// (C) Copyright 2010,2016 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2010,2016-2017 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License version 2 as
@ -68,9 +68,10 @@ int DownloadErrorCallback(CURL *curl,curl_infotype type,char *msg,size_t size,
} }
RDDownload::RDDownload(const QString &station_name,QObject *parent) RDDownload::RDDownload(RDConfig *config,QObject *parent)
: QObject(parent) : QObject(parent)
{ {
conv_config=config;
conv_aborting=false; conv_aborting=false;
} }
@ -142,6 +143,8 @@ RDDownload::ErrorCode RDDownload::runDownload(const QString &username,
curl_easy_setopt(curl,CURLOPT_PROGRESSFUNCTION,DownloadProgressCallback); curl_easy_setopt(curl,CURLOPT_PROGRESSFUNCTION,DownloadProgressCallback);
curl_easy_setopt(curl,CURLOPT_PROGRESSDATA,this); curl_easy_setopt(curl,CURLOPT_PROGRESSDATA,this);
curl_easy_setopt(curl,CURLOPT_NOPROGRESS,0); curl_easy_setopt(curl,CURLOPT_NOPROGRESS,0);
curl_easy_setopt(curl,CURLOPT_USERAGENT,
(const char *)conv_config->userAgent());
if(log_debug) { if(log_debug) {
curl_easy_setopt(curl,CURLOPT_VERBOSE,1); curl_easy_setopt(curl,CURLOPT_VERBOSE,1);
curl_easy_setopt(curl,CURLOPT_DEBUGFUNCTION,DownloadErrorCallback); curl_easy_setopt(curl,CURLOPT_DEBUGFUNCTION,DownloadErrorCallback);

View File

@ -2,7 +2,7 @@
// //
// Download a File // Download a File
// //
// (C) Copyright 2010,2016 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2010,2016-2017 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License version 2 as
@ -24,6 +24,8 @@
#include <qobject.h> #include <qobject.h>
#include <qurl.h> #include <qurl.h>
#include <rdconfig.h>
class RDDownload : public QObject class RDDownload : public QObject
{ {
Q_OBJECT; Q_OBJECT;
@ -34,7 +36,7 @@ class RDDownload : public QObject
ErrorUnspecified=8,ErrorInvalidUser=9,ErrorAborted=10, ErrorUnspecified=8,ErrorInvalidUser=9,ErrorAborted=10,
ErrorInvalidLogin=11,ErrorRemoteAccess=12, ErrorInvalidLogin=11,ErrorRemoteAccess=12,
ErrorRemoteConnection=13}; ErrorRemoteConnection=13};
RDDownload(const QString &station_name,QObject *parent=0); RDDownload(RDConfig *config,QObject *parent=0);
void setSourceUrl(const QString &url); void setSourceUrl(const QString &url);
void setDestinationFile(const QString &filename); void setDestinationFile(const QString &filename);
int totalSteps() const; int totalSteps() const;
@ -58,6 +60,7 @@ class RDDownload : public QObject
QString conv_dst_filename; QString conv_dst_filename;
bool conv_aborting; bool conv_aborting;
uint conv_dst_size; uint conv_dst_size;
RDConfig *conv_config;
}; };

View File

@ -37,13 +37,14 @@
#include <rdaudioconvert.h> #include <rdaudioconvert.h>
#include <rdupload.h> #include <rdupload.h>
RDFeed::RDFeed(const QString &keyname,QObject *parent) RDFeed::RDFeed(const QString &keyname,RDConfig *config,QObject *parent)
: QObject(parent) : QObject(parent)
{ {
RDSqlQuery *q; RDSqlQuery *q;
QString sql; QString sql;
feed_keyname=keyname; feed_keyname=keyname;
feed_config=config;
sql=QString().sprintf("select ID from FEEDS where KEY_NAME=\"%s\"", sql=QString().sprintf("select ID from FEEDS where KEY_NAME=\"%s\"",
(const char *)RDEscapeString(keyname)); (const char *)RDEscapeString(keyname));
@ -55,13 +56,14 @@ RDFeed::RDFeed(const QString &keyname,QObject *parent)
} }
RDFeed::RDFeed(unsigned id,QObject *parent) RDFeed::RDFeed(unsigned id,RDConfig *config,QObject *parent)
: QObject(parent) : QObject(parent)
{ {
RDSqlQuery *q; RDSqlQuery *q;
QString sql; QString sql;
feed_id=id; feed_id=id;
feed_config=config;
sql=QString().sprintf("select KEY_NAME from FEEDS where ID=%u",id); sql=QString().sprintf("select KEY_NAME from FEEDS where ID=%u",id);
q=new RDSqlQuery(sql); q=new RDSqlQuery(sql);
@ -507,7 +509,7 @@ QString RDFeed::audioUrl(RDFeed::MediaLinkMode mode,
break; break;
case RDFeed::LinkDirect: case RDFeed::LinkDirect:
cast=new RDPodcast(cast_id); cast=new RDPodcast(feed_config,cast_id);
ret=QString().sprintf("%s/%s", ret=QString().sprintf("%s/%s",
(const char *)baseUrl(), (const char *)baseUrl(),
(const char *)cast->audioFilename()); (const char *)cast->audioFilename());
@ -601,8 +603,8 @@ unsigned RDFeed::postCut(RDUser *user,RDStation *station,
int length=file.size(); int length=file.size();
unsigned cast_id=CreateCast(&destfile,length,cut->length()); unsigned cast_id=CreateCast(&destfile,length,cut->length());
delete cut; delete cut;
cast=new RDPodcast(cast_id); cast=new RDPodcast(feed_config,cast_id);
upload=new RDUpload(station->name(),this); upload=new RDUpload(feed_config,this);
upload->setSourceFile(tmpfile); upload->setSourceFile(tmpfile);
upload->setDestinationUrl(purgeUrl()+"/"+cast->audioFilename()); upload->setDestinationUrl(purgeUrl()+"/"+cast->audioFilename());
switch((upload_err=upload->runUpload(purgeUsername(),purgePassword(), switch((upload_err=upload->runUpload(purgeUsername(),purgePassword(),
@ -714,8 +716,8 @@ unsigned RDFeed::postFile(RDStation *station,const QString &srcfile,Error *err,
int length=file.size(); int length=file.size();
unsigned cast_id=CreateCast(&destfile,length,time_length); unsigned cast_id=CreateCast(&destfile,length,time_length);
RDPodcast *cast=new RDPodcast(cast_id); RDPodcast *cast=new RDPodcast(feed_config,cast_id);
upload=new RDUpload(station->name(),this); upload=new RDUpload(feed_config,this);
upload->setSourceFile(tmpfile); upload->setSourceFile(tmpfile);
upload->setDestinationUrl(purgeUrl()+"/"+cast->audioFilename()); upload->setDestinationUrl(purgeUrl()+"/"+cast->audioFilename());
switch((upload_err=upload->runUpload(purgeUsername(),purgePassword(), switch((upload_err=upload->runUpload(purgeUsername(),purgePassword(),

View File

@ -38,8 +38,8 @@ class RDFeed : public QObject
enum Error {ErrorOk=0,ErrorNoFile=1,ErrorCannotOpenFile=2, enum Error {ErrorOk=0,ErrorNoFile=1,ErrorCannotOpenFile=2,
ErrorUnsupportedType=3,ErrorUploadFailed=4,ErrorGeneral=5}; ErrorUnsupportedType=3,ErrorUploadFailed=4,ErrorGeneral=5};
enum MediaLinkMode {LinkNone=0,LinkDirect=1,LinkCounted=2}; enum MediaLinkMode {LinkNone=0,LinkDirect=1,LinkCounted=2};
RDFeed(const QString &keyname,QObject *parent=0); RDFeed(const QString &keyname,RDConfig *config,QObject *parent=0);
RDFeed(unsigned id,QObject *parent=0); RDFeed(unsigned id,RDConfig *config,QObject *parent=0);
QString keyName() const; QString keyName() const;
unsigned id() const; unsigned id() const;
bool exists() const; bool exists() const;
@ -127,7 +127,8 @@ class RDFeed : public QObject
const QString &format) const; const QString &format) const;
QString feed_keyname; QString feed_keyname;
unsigned feed_id; unsigned feed_id;
RDConfig *feed_config;
}; };
#endif #endif // RDFEED_H

View File

@ -123,6 +123,8 @@ RDPeaksExport::ErrorCode RDPeaksExport::runExport(const QString &username,
curl_easy_setopt(curl,CURLOPT_POSTFIELDS,(const char *)post); curl_easy_setopt(curl,CURLOPT_POSTFIELDS,(const char *)post);
curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT);
curl_easy_setopt(curl,CURLOPT_NOPROGRESS,1); curl_easy_setopt(curl,CURLOPT_NOPROGRESS,1);
curl_easy_setopt(curl,CURLOPT_USERAGENT,
(const char *)conv_config->userAgent());
//curl_easy_setopt(curl,CURLOPT_VERBOSE,1); //curl_easy_setopt(curl,CURLOPT_VERBOSE,1);
switch((curl_err=curl_easy_perform(curl))) { switch((curl_err=curl_easy_perform(curl))) {

View File

@ -47,8 +47,10 @@ int PodcastErrorCallback(CURL *curl,curl_infotype type,char *msg,size_t size,
} }
RDPodcast::RDPodcast(unsigned id) RDPodcast::RDPodcast(RDConfig *config,unsigned id)
{ {
podcast_config=config;
RDSqlQuery *q; RDSqlQuery *q;
QString sql; QString sql;
@ -314,6 +316,8 @@ bool RDPodcast::removeAudio(RDFeed *feed,QString *err_text,bool log_debug) const
(const char *)feed->purgePassword()),256); (const char *)feed->purgePassword()),256);
curl_easy_setopt(curl,CURLOPT_USERPWD,userpwd); curl_easy_setopt(curl,CURLOPT_USERPWD,userpwd);
curl_easy_setopt(curl,CURLOPT_HTTPAUTH,CURLAUTH_ANY); curl_easy_setopt(curl,CURLOPT_HTTPAUTH,CURLAUTH_ANY);
curl_easy_setopt(curl,CURLOPT_USERAGENT,
(const char *)podcast_config->userAgent());
if(log_debug) { if(log_debug) {
curl_easy_setopt(curl,CURLOPT_VERBOSE,1); curl_easy_setopt(curl,CURLOPT_VERBOSE,1);
curl_easy_setopt(curl,CURLOPT_DEBUGFUNCTION,PodcastErrorCallback); curl_easy_setopt(curl,CURLOPT_DEBUGFUNCTION,PodcastErrorCallback);

View File

@ -2,7 +2,7 @@
// //
// Abstract a Rivendell Podcast Entry // Abstract a Rivendell Podcast Entry
// //
// (C) Copyright 2002-2007,2016 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2002-2007,2016-2017 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License version 2 as
@ -20,6 +20,7 @@
#include <qsqldatabase.h> #include <qsqldatabase.h>
#include <rdconfig.h>
#include <rdfeed.h> #include <rdfeed.h>
#ifndef RDPODCAST_H #ifndef RDPODCAST_H
@ -29,7 +30,7 @@ class RDPodcast
{ {
public: public:
enum Status {StatusPending=1,StatusActive=2,StatusExpired=3}; enum Status {StatusPending=1,StatusActive=2,StatusExpired=3};
RDPodcast(unsigned id); RDPodcast(RDConfig *config,unsigned id);
unsigned id() const; unsigned id() const;
QString keyName() const; QString keyName() const;
bool exists() const; bool exists() const;
@ -79,6 +80,7 @@ class RDPodcast
void SetRow(const QString &param,const QDateTime &datetime,const QString &value) const; void SetRow(const QString &param,const QDateTime &datetime,const QString &value) const;
QString podcast_keyname; QString podcast_keyname;
unsigned podcast_id; unsigned podcast_id;
RDConfig *podcast_config;
}; };

View File

@ -94,6 +94,8 @@ RDRehash::ErrorCode RDRehash::runRehash(const QString &username,
curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,__RDRehashCallback); curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,__RDRehashCallback);
curl_easy_setopt(curl,CURLOPT_POST,1); curl_easy_setopt(curl,CURLOPT_POST,1);
curl_easy_setopt(curl,CURLOPT_POSTFIELDS,(const char *)post); curl_easy_setopt(curl,CURLOPT_POSTFIELDS,(const char *)post);
curl_easy_setopt(curl,CURLOPT_USERAGENT,
(const char *)conv_config->userAgent());
curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT);
switch(curl_err=curl_easy_perform(curl)) { switch(curl_err=curl_easy_perform(curl)) {

View File

@ -120,6 +120,8 @@ RDTrimAudio::ErrorCode RDTrimAudio::runTrim(const QString &username,
curl_easy_setopt(curl,CURLOPT_WRITEDATA,&conv_xml); curl_easy_setopt(curl,CURLOPT_WRITEDATA,&conv_xml);
curl_easy_setopt(curl,CURLOPT_POST,1); curl_easy_setopt(curl,CURLOPT_POST,1);
curl_easy_setopt(curl,CURLOPT_POSTFIELDS,(const char *)post); curl_easy_setopt(curl,CURLOPT_POSTFIELDS,(const char *)post);
curl_easy_setopt(curl,CURLOPT_USERAGENT,
(const char *)conv_config->userAgent());
curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT); curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT);
switch(curl_err=curl_easy_perform(curl)) { switch(curl_err=curl_easy_perform(curl)) {

View File

@ -2,7 +2,7 @@
// //
// Upload a File // Upload a File
// //
// (C) Copyright 2010,2016 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2010,2016-2017 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License version 2 as
@ -70,9 +70,10 @@ int UploadErrorCallback(CURL *curl,curl_infotype type,char *msg,size_t size,
} }
RDUpload::RDUpload(const QString &station_name,QObject *parent) RDUpload::RDUpload(RDConfig *config,QObject *parent)
: QObject(parent) : QObject(parent)
{ {
conv_config=config;
conv_aborting=false; conv_aborting=false;
} }
@ -145,6 +146,8 @@ RDUpload::ErrorCode RDUpload::runUpload(const QString &username,
curl_easy_setopt(curl,CURLOPT_PROGRESSFUNCTION,UploadProgressCallback); curl_easy_setopt(curl,CURLOPT_PROGRESSFUNCTION,UploadProgressCallback);
curl_easy_setopt(curl,CURLOPT_PROGRESSDATA,this); curl_easy_setopt(curl,CURLOPT_PROGRESSDATA,this);
curl_easy_setopt(curl,CURLOPT_NOPROGRESS,0); curl_easy_setopt(curl,CURLOPT_NOPROGRESS,0);
curl_easy_setopt(curl,CURLOPT_USERAGENT,
(const char *)conv_config->userAgent());
if(log_debug) { if(log_debug) {
curl_easy_setopt(curl,CURLOPT_VERBOSE,1); curl_easy_setopt(curl,CURLOPT_VERBOSE,1);
curl_easy_setopt(curl,CURLOPT_DEBUGFUNCTION,UploadErrorCallback); curl_easy_setopt(curl,CURLOPT_DEBUGFUNCTION,UploadErrorCallback);

View File

@ -2,7 +2,7 @@
// //
// Upload a File // Upload a File
// //
// (C) Copyright 2010,2016 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2010,2016-2017 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License version 2 as
@ -24,6 +24,8 @@
#include <qobject.h> #include <qobject.h>
#include <qurl.h> #include <qurl.h>
#include <rdconfig.h>
class RDUpload : public QObject class RDUpload : public QObject
{ {
Q_OBJECT; Q_OBJECT;
@ -34,7 +36,7 @@ class RDUpload : public QObject
ErrorUnspecified=8,ErrorInvalidUser=9,ErrorAborted=10, ErrorUnspecified=8,ErrorInvalidUser=9,ErrorAborted=10,
ErrorInvalidLogin=11,ErrorRemoteAccess=12, ErrorInvalidLogin=11,ErrorRemoteAccess=12,
ErrorRemoteConnection=13}; ErrorRemoteConnection=13};
RDUpload(const QString &station_name,QObject *parent=0); RDUpload(RDConfig *config,QObject *parent=0);
void setSourceFile(const QString &filename); void setSourceFile(const QString &filename);
void setDestinationUrl(const QString &url); void setDestinationUrl(const QString &url);
int totalSteps() const; int totalSteps() const;
@ -58,6 +60,7 @@ class RDUpload : public QObject
QUrl conv_dst_url; QUrl conv_dst_url;
bool conv_aborting; bool conv_aborting;
uint conv_src_size; uint conv_src_size;
RDConfig *conv_config;
}; };

View File

@ -243,8 +243,9 @@ PAM_EXTERN int pam_sm_authenticate (pam_handle_t *pamh,
} }
/* Load configs */ /* Load configs */
login_config=new RDConfig(); login_config=new RDConfig(RD_CONF_FILE);
login_config->load(); login_config->load();
login_config->setModuleName("pam_rd");
/* kill daemons if requested */ /* kill daemons if requested */
if (ctrl & PAM_RD_KILL_RD_DAEMONS) { if (ctrl & PAM_RD_KILL_RD_DAEMONS) {

View File

@ -45,7 +45,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent)
setMinimumHeight(sizeHint().height()); setMinimumHeight(sizeHint().height());
setMaximumHeight(sizeHint().height()); setMaximumHeight(sizeHint().height());
feed_feed=new RDFeed(feed,this); feed_feed=new RDFeed(feed,admin_config,this);
setCaption(tr("Feed: ")+feed); setCaption(tr("Feed: ")+feed);

View File

@ -232,7 +232,7 @@ void ListFeeds::deleteData()
default: default:
break; break;
} }
feed=new RDFeed(feedname); feed=new RDFeed(feedname,admin_config);
// //
// Delete Casts // Delete Casts
@ -251,7 +251,7 @@ void ListFeeds::deleteData()
while(q->next()) { while(q->next()) {
pd->setProgress(pd->progress()+1); pd->setProgress(pd->progress()+1);
qApp->processEvents(); qApp->processEvents();
cast=new RDPodcast(q->value(0).toUInt()); cast=new RDPodcast(admin_config,q->value(0).toUInt());
cast->removeAudio(feed,&errs,admin_config->logXloadDebugData()); cast->removeAudio(feed,&errs,admin_config->logXloadDebugData());
delete cast; delete cast;
} }

View File

@ -144,8 +144,9 @@ MainWidget::MainWidget(QWidget *parent)
// //
// Load Configs // Load Configs
// //
admin_config=new RDConfig(); admin_config=new RDConfig(RD_CONF_FILE);
admin_config->load(); admin_config->load();
admin_config->setModuleName("RDAdmin");
str=QString(tr("RDAdmin")+" v"+VERSION+" - Host:"); str=QString(tr("RDAdmin")+" v"+VERSION+" - Host:");
setCaption(QString(). setCaption(QString().

View File

@ -224,8 +224,10 @@ MainWidget::MainWidget(QWidget *parent)
// //
// Load Local Configs // Load Local Configs
// //
air_config=new RDConfig(); air_config=new RDConfig(RD_CONF_FILE);
air_config->load(); air_config->load();
air_config->setModuleName("RDAirPlay");
logfile=air_config->airplayLogname(); logfile=air_config->airplayLogname();
str=QString("RDAirPlay")+" v"+VERSION+" - "+tr("Host:"); str=QString("RDAirPlay")+" v"+VERSION+" - "+tr("Host:");

View File

@ -60,8 +60,9 @@ MainWidget::MainWidget(QWidget *parent)
// //
// Load Local Configs // Load Local Configs
// //
panel_config=new RDConfig(); panel_config=new RDConfig(RD_CONF_FILE);
panel_config->load(); panel_config->load();
panel_config->setModuleName("RDCartSlots");
// //
// Load the command-line arguments // Load the command-line arguments

View File

@ -45,8 +45,8 @@ EditCast::EditCast(unsigned cast_id,QWidget *parent)
RDSqlQuery *q1; RDSqlQuery *q1;
int ypos=0; int ypos=0;
cast_cast=new RDPodcast(cast_id); cast_cast=new RDPodcast(config,cast_id);
cast_feed=new RDFeed(cast_cast->feedId()); cast_feed=new RDFeed(cast_cast->feedId(),config);
cast_status=cast_cast->status(); cast_status=cast_cast->status();
setCaption(tr("Editing PodCast")); setCaption(tr("Editing PodCast"));

View File

@ -95,7 +95,7 @@ ListCasts::ListCasts(unsigned feed_id,QWidget *parent)
// //
// The Feed // The Feed
// //
list_feed=new RDFeed(feed_id,this); list_feed=new RDFeed(feed_id,config,this);
// //
// Progress Dialog // Progress Dialog
@ -335,7 +335,7 @@ void ListCasts::deleteData()
qApp->processEvents(); qApp->processEvents();
sleep(1); sleep(1);
qApp->processEvents(); qApp->processEvents();
RDPodcast *cast=new RDPodcast(item->id()); RDPodcast *cast=new RDPodcast(config,item->id());
if(!cast->removeAudio(list_feed,&err_text,config->logXloadDebugData())) { if(!cast->removeAudio(list_feed,&err_text,config->logXloadDebugData())) {
if(QMessageBox::warning(this,tr("Remote Error"), if(QMessageBox::warning(this,tr("Remote Error"),
tr("Unable to delete remote audio!\n")+ tr("Unable to delete remote audio!\n")+
@ -513,7 +513,7 @@ void ListCasts::GetEncoderId()
RDSqlQuery *q; RDSqlQuery *q;
list_encoder_id=-1; list_encoder_id=-1;
RDFeed *feed=new RDFeed(list_feed_id); RDFeed *feed=new RDFeed(list_feed_id,config);
int format=feed->uploadFormat(); int format=feed->uploadFormat();
delete feed; delete feed;
if((format>0)&&(format<100)) { // Built-in format if((format>0)&&(format<100)) { // Built-in format

View File

@ -191,7 +191,7 @@ void PickReportDates::GenerateSubscriptionReport(const QString &keyname,
QString sql; QString sql;
RDSqlQuery *q; RDSqlQuery *q;
RDFeed *feed=new RDFeed(keyname,this); RDFeed *feed=new RDFeed(keyname,config,this);
unsigned total=0; unsigned total=0;
unsigned rss_total=0; unsigned rss_total=0;
unsigned audio_total=0; unsigned audio_total=0;
@ -253,8 +253,8 @@ void PickReportDates::GenerateEpisodeReport(const QString &keyname,
QString sql; QString sql;
RDSqlQuery *q; RDSqlQuery *q;
RDFeed *feed=new RDFeed(keyname,this); RDFeed *feed=new RDFeed(keyname,config,this);
RDPodcast *cast=new RDPodcast(cast_id); RDPodcast *cast=new RDPodcast(config,cast_id);
// //
// Header // Header

View File

@ -96,8 +96,10 @@ MainWidget::MainWidget(QWidget *parent)
// //
// Load Local Configs // Load Local Configs
// //
config=new RDConfig(); config=new RDConfig(RD_CONF_FILE);
config->load(); config->load();
config->setModuleName("RDCastManager");
str1=QString("RDCastManager")+" v"+VERSION+" - "+tr("Host"); str1=QString("RDCastManager")+" v"+VERSION+" - "+tr("Host");
str2=QString(tr("User: [Unknown]")); str2=QString(tr("User: [Unknown]"));
setCaption(QString().sprintf("%s: %s, %s",(const char *)str1, setCaption(QString().sprintf("%s: %s, %s",(const char *)str1,

View File

@ -2,7 +2,7 @@
// //
// The Event Schedule Manager for Rivendell. // The Event Schedule Manager for Rivendell.
// //
// (C) Copyright 2002-2015 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2002-2017 Fred Gleason <fredg@paravelsystems.com>
// //
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License version 2 as
@ -202,6 +202,7 @@ MainWidget::MainWidget(QWidget *parent)
// //
catch_config=new RDConfig(); catch_config=new RDConfig();
catch_config->load(); catch_config->load();
catch_config->setModuleName("RDCatch");
str=QString("RDCatch")+" v"+VERSION+" - "+tr("Host")+":"; str=QString("RDCatch")+" v"+VERSION+" - "+tr("Host")+":";
setCaption(QString().sprintf("%s %s",(const char *)str, setCaption(QString().sprintf("%s %s",(const char *)str,

View File

@ -199,7 +199,7 @@ void MainObject::RunDownload(CatchEvent *evt)
(const char *)evt->resolvedUrl(), (const char *)evt->resolvedUrl(),
(const char *)evt->tempName(), (const char *)evt->tempName(),
evt->id())); evt->id()));
RDDownload *conv=new RDDownload(catch_config->stationName(),this); RDDownload *conv=new RDDownload(catch_config,this);
conv->setSourceUrl(RDUrlEscape(evt->resolvedUrl())); conv->setSourceUrl(RDUrlEscape(evt->resolvedUrl()));
conv->setDestinationFile(evt->tempName()); conv->setDestinationFile(evt->tempName());
@ -321,7 +321,7 @@ void MainObject::RunUpload(CatchEvent *evt)
(const char *)evt-> (const char *)evt->
resolvedUrl(), resolvedUrl(),
evt->id())); evt->id()));
RDUpload *conv=new RDUpload(catch_config->stationName(),this); RDUpload *conv=new RDUpload(catch_config,this);
conv->setSourceFile(evt->tempName()); conv->setSourceFile(evt->tempName());
conv->setDestinationUrl(evt->resolvedUrl()); conv->setDestinationUrl(evt->resolvedUrl());
QString url_username=evt->urlUsername(); QString url_username=evt->urlUsername();

View File

@ -133,6 +133,7 @@ MainObject::MainObject(QObject *parent)
// //
catch_config=new RDConfig(); catch_config=new RDConfig();
catch_config->load(); catch_config->load();
catch_config->setModuleName("rdcatchd");
// //
// Read Command Options // Read Command Options

View File

@ -181,6 +181,7 @@ MainWidget::MainWidget(QWidget *parent)
// //
lib_config=new RDConfig(); lib_config=new RDConfig();
lib_config->load(); lib_config->load();
lib_config->setModuleName("RDLibrary");
SetCaption(""); SetCaption("");
lib_import_path=RDGetHomeDir(); lib_import_path=RDGetHomeDir();

View File

@ -144,6 +144,8 @@ MainWidget::MainWidget(QWidget *parent)
// //
log_config=new RDConfig(); log_config=new RDConfig();
log_config->load(); log_config->load();
log_config->setModuleName("RDLogEdit");
str1=QString("RDLogEdit")+"v"+VERSION+" - "+tr("Host"); str1=QString("RDLogEdit")+"v"+VERSION+" - "+tr("Host");
str2=tr("User")+": ["+tr("Unknown")+"]"; str2=tr("User")+": ["+tr("Unknown")+"]";
setCaption(QString().sprintf("%s: %s, %s",(const char *)str1, setCaption(QString().sprintf("%s: %s, %s",(const char *)str1,

View File

@ -106,6 +106,7 @@ MainWidget::MainWidget(QWidget *parent)
// //
login_config=new RDConfig(); login_config=new RDConfig();
login_config->load(); login_config->load();
login_config->setModuleName("RDLogin");
str=QString(tr("RDLogin - Station:")); str=QString(tr("RDLogin - Station:"));
setCaption(QString().sprintf("%s %s",(const char *)str, setCaption(QString().sprintf("%s %s",(const char *)str,

View File

@ -122,6 +122,8 @@ MainWidget::MainWidget(QWidget *parent)
// //
log_config=new RDConfig(); log_config=new RDConfig();
log_config->load(); log_config->load();
log_config->setModuleName("RDLogManager");
setCaption(tr("RDLogManager")); setCaption(tr("RDLogManager"));
// //

View File

@ -102,6 +102,8 @@ MainWidget::MainWidget(QWidget *parent)
// //
mon_rdconfig=new RDConfig(); mon_rdconfig=new RDConfig();
mon_rdconfig->load(); mon_rdconfig->load();
mon_rdconfig->setModuleName("RDMonitor");
mon_desktop_widget=new QDesktopWidget(); mon_desktop_widget=new QDesktopWidget();
mon_config=new RDMonitorConfig(); mon_config=new RDMonitorConfig();
mon_config->load(); mon_config->load();

View File

@ -122,6 +122,7 @@ MainWidget::MainWidget(QWidget *parent)
// //
panel_config=new RDConfig(); panel_config=new RDConfig();
panel_config->load(); panel_config->load();
panel_config->setModuleName("RDPanel");
// //
// Open Database // Open Database

View File

@ -40,8 +40,8 @@
#define RD_MAX_CART_NUMBER 999999 #define RD_MAX_CART_NUMBER 999999
CitadelXds::CitadelXds(ReplConfig *config) CitadelXds::CitadelXds(ReplConfig *repl_config)
: ReplFactory(config) : ReplFactory(repl_config)
{ {
QString sql; QString sql;
RDSqlQuery *q; RDSqlQuery *q;
@ -379,7 +379,7 @@ bool CitadelXds::PostCut(const QString &cutname,const QString &filename)
// //
// Upload File // Upload File
// //
RDUpload *upload=new RDUpload(rdconfig->stationName()); RDUpload *upload=new RDUpload(rdconfig);
upload->setSourceFile(tempfile); upload->setSourceFile(tempfile);
upload->setDestinationUrl(config()->url()+"/"+filename); upload->setDestinationUrl(config()->url()+"/"+filename);
switch(upload_err=upload->runUpload(config()->urlUsername(), switch(upload_err=upload->runUpload(config()->urlUsername(),
@ -432,7 +432,7 @@ void CitadelXds::PurgeCuts()
path+="/"; path+="/";
} }
QUrl url(path+q->value(1).toString()); QUrl url(path+q->value(1).toString());
conv=new RDDelete(); conv=new RDDelete(rdconfig);
conv->setTargetUrl(url); conv->setTargetUrl(url);
if((conv_err=conv->runDelete(config()->urlUsername(), if((conv_err=conv->runDelete(config()->urlUsername(),
config()->urlPassword(), config()->urlPassword(),

View File

@ -21,12 +21,13 @@
#ifndef CITADELXDS_H #ifndef CITADELXDS_H
#define CITADELXDS_H #define CITADELXDS_H
#include <replfactory.h> #include "globals.h"
#include "replfactory.h"
class CitadelXds : public ReplFactory class CitadelXds : public ReplFactory
{ {
public: public:
CitadelXds(ReplConfig *config); CitadelXds(ReplConfig *repl_config);
void startProcess(); void startProcess();
bool processCart(const unsigned cartnum); bool processCart(const unsigned cartnum);

View File

@ -71,6 +71,7 @@ MainObject::MainObject(QObject *parent)
// //
rdconfig=new RDConfig(); rdconfig=new RDConfig();
rdconfig->load(); rdconfig->load();
rdconfig->setModuleName("rdrepld");
// //
// Read Command Options // Read Command Options

View File

@ -148,6 +148,7 @@ MainWidget::MainWidget(QWidget *parent)
select_configs.push_back(new RDConfig()); select_configs.push_back(new RDConfig());
select_configs.back()->setFilename(select_filenames[i]); select_configs.back()->setFilename(select_filenames[i]);
select_configs.back()->load(); select_configs.back()->load();
select_configs.back()->setModuleName("RDSelect");
} }
// //

View File

@ -103,6 +103,7 @@ MainObject::MainObject(QObject *parent)
// //
ripcd_config=new RDConfig(RD_CONF_FILE); ripcd_config=new RDConfig(RD_CONF_FILE);
ripcd_config->load(); ripcd_config->load();
ripcd_config->setModuleName("ripcd");
// //
// Make sure we're the only instance running // Make sure we're the only instance running

View File

@ -166,6 +166,7 @@ MainObject::MainObject(QObject *parent)
// //
rdconfig=new RDConfig(); rdconfig=new RDConfig();
rdconfig->load(); rdconfig->load();
rdconfig->setModuleName("audio_convert_test");
// //
// Open Database // Open Database

View File

@ -185,6 +185,7 @@ MainObject::MainObject(QObject *parent)
// //
rdconfig=new RDConfig(); rdconfig=new RDConfig();
rdconfig->load(); rdconfig->load();
rdconfig->setModuleName("audio_export_test");
// //
// Open Database // Open Database

View File

@ -125,6 +125,7 @@ MainObject::MainObject(QObject *parent)
// //
rdconfig=new RDConfig(); rdconfig=new RDConfig();
rdconfig->load(); rdconfig->load();
rdconfig->setModuleName("audio_import_test");
// //
// Open Database // Open Database

View File

@ -87,6 +87,7 @@ MainObject::MainObject(QObject *parent)
// //
config=new RDConfig(); config=new RDConfig();
config->load(); config->load();
config->setModuleName("reserve_carts_test");
// //
// Open Database // Open Database

View File

@ -55,6 +55,7 @@ MainWidget::MainWidget(QWidget *parent)
// //
rd_config=new RDConfig(RD_CONF_FILE); rd_config=new RDConfig(RD_CONF_FILE);
rd_config->load(); rd_config->load();
rd_config->setModuleName("sas_switch_torture");
QString err; QString err;
test_db=RDInitDb(&schema,&err); test_db=RDInitDb(&schema,&err);

View File

@ -55,6 +55,8 @@ MainWidget::MainWidget(QWidget *parent)
// //
rd_config=new RDConfig(RD_CONF_FILE); rd_config=new RDConfig(RD_CONF_FILE);
rd_config->load(); rd_config->load();
rd_config->setModuleName("sas_torture");
QString err; QString err;
test_db=RDInitDb(&schema,&err); test_db=RDInitDb(&schema,&err);
if(!test_db) { if(!test_db) {

View File

@ -72,6 +72,7 @@ MainObject::MainObject(QObject *parent)
// //
rdconfig=new RDConfig(); rdconfig=new RDConfig();
rdconfig->load(); rdconfig->load();
rdconfig->setModuleName("upload_test");
// //
// Open Database // Open Database
@ -84,7 +85,7 @@ MainObject::MainObject(QObject *parent)
exit(256); exit(256);
} }
RDUpload *conv=new RDUpload(rdconfig->stationName(),this); RDUpload *conv=new RDUpload(rdconfig,this);
conv->setSourceFile(source_filename); conv->setSourceFile(source_filename);
conv->setDestinationUrl(destination_url); conv->setDestinationUrl(destination_url);
printf("Uploading...\n"); printf("Uploading...\n");

View File

@ -60,6 +60,7 @@ MainObject::MainObject(QObject *parent)
// //
cut_config=new RDConfig(); cut_config=new RDConfig();
cut_config->load(); cut_config->load();
cut_config->setModuleName("rdcheckcuts");
// //
// Open Database // Open Database

View File

@ -62,6 +62,7 @@ MainObject::MainObject(QObject *parent)
// //
edit_config=new RDConfig(); edit_config=new RDConfig();
edit_config->load(); edit_config->load();
edit_config->setModuleName("rdclilogedit");
// //
// Open Database // Open Database

View File

@ -173,6 +173,7 @@ MainObject::MainObject(QObject *parent)
// //
rdconfig=new RDConfig(); rdconfig=new RDConfig();
rdconfig->load(); rdconfig->load();
rdconfig->setModuleName("rdconvert");
// //
// Open Database // Open Database

View File

@ -137,6 +137,7 @@ MainObject::MainObject(QObject *parent)
// //
rdconfig=new RDConfig(); rdconfig=new RDConfig();
rdconfig->load(); rdconfig->load();
rdconfig->setModuleName("rddbcheck");
// //
// Open Database // Open Database

View File

@ -97,6 +97,7 @@ MainObject::MainObject(QObject *parent)
// //
del_config=new RDConfig(); del_config=new RDConfig();
del_config->load(); del_config->load();
del_config->setModuleName("rddelete");
// //
// Open Database // Open Database

View File

@ -71,6 +71,7 @@ MainWidget::MainWidget(QWidget *parent)
// //
dg_config=new RDConfig(); dg_config=new RDConfig();
dg_config->load(); dg_config->load();
dg_config->setModuleName("RDDgiImport");
// //
// Open Database // Open Database

View File

@ -74,6 +74,7 @@ MainWidget::MainWidget(QWidget *parent)
// //
dg_config=new RDConfig(); dg_config=new RDConfig();
dg_config->load(); dg_config->load();
dg_config->setModuleName("RDDiscImport");
// //
// Get Temporary File // Get Temporary File

View File

@ -205,6 +205,7 @@ MainObject::MainObject(QObject *parent)
// //
export_config=new RDConfig(); export_config=new RDConfig();
export_config->load(); export_config->load();
export_config->setModuleName("rdexport");
// //
// Open Database // Open Database

View File

@ -89,6 +89,7 @@ MainWidget::MainWidget(QWidget *parent)
// //
gpi_config=new RDConfig(); gpi_config=new RDConfig();
gpi_config->load(); gpi_config->load();
gpi_config->setModuleName("RDGpiMon");
// //
// Open Database // Open Database

View File

@ -420,6 +420,7 @@ MainObject::MainObject(QObject *parent)
// //
import_config=new RDConfig(); import_config=new RDConfig();
import_config->load(); import_config->load();
import_config->setModuleName("rdimport");
// //
// Open Database // Open Database

View File

@ -82,6 +82,7 @@ MainObject::MainObject(QObject *parent)
// //
maint_config=new RDConfig(); maint_config=new RDConfig();
maint_config->load(); maint_config->load();
maint_config->setModuleName("rdmaint");
// //
// Open Database // Open Database

View File

@ -129,6 +129,7 @@ MainObject::MainObject(QObject *parent)
// //
set_config=new RDConfig(); set_config=new RDConfig();
set_config->load(); set_config->load();
set_config->setModuleName("rdmarkerset");
// //
// Open Database // Open Database

View File

@ -76,6 +76,7 @@ MainObject::MainObject(QObject *parent)
// //
purge_config=new RDConfig(); purge_config=new RDConfig();
purge_config->load(); purge_config->load();
purge_config->setModuleName("rdpurgecasts");
// //
// Open Database // Open Database
@ -128,8 +129,8 @@ void MainObject::PurgeCast(unsigned id)
where PODCASTS.ID=%u",id); where PODCASTS.ID=%u",id);
q=new RDSqlQuery(sql); q=new RDSqlQuery(sql);
while(q->next()) { while(q->next()) {
feed=new RDFeed(q->value(0).toUInt()); feed=new RDFeed(q->value(0).toUInt(),purge_config);
cast=new RDPodcast(id); cast=new RDPodcast(purge_config,id);
cast->removeAudio(feed,&errs,purge_config->logXloadDebugData()); cast->removeAudio(feed,&errs,purge_config->logXloadDebugData());
if(purge_verbose) { if(purge_verbose) {
printf("purging cast: ID=%d,cmd=\"%s\"\n",id,(const char *)cmd); printf("purging cast: ID=%d,cmd=\"%s\"\n",id,(const char *)cmd);

View File

@ -248,6 +248,7 @@ MainObject::MainObject(QObject *parent)
// //
render_config=new RDConfig(); render_config=new RDConfig();
render_config->load(); render_config->load();
render_config->setModuleName("rdrender");
// //
// Open Database // Open Database

View File

@ -85,6 +85,7 @@ MainObject::MainObject(QObject *parent)
// //
rev_config=new RDConfig(); rev_config=new RDConfig();
rev_config->load(); rev_config->load();
rev_config->setModuleName("rdrevert");
// //
// Open Database // Open Database

View File

@ -56,6 +56,7 @@ MainObject::MainObject(QObject *parent)
rd_config=new RDConfig(RD_CONF_FILE); rd_config=new RDConfig(RD_CONF_FILE);
rd_config->load(); rd_config->load();
rd_config->setModuleName("sas_shim");
// //
// Open Database // Open Database

View File

@ -63,6 +63,7 @@ MainObject::MainObject(QObject *parent)
// //
cast_config=new RDConfig(); cast_config=new RDConfig();
cast_config->load(); cast_config->load();
cast_config->setModuleName("rdcastmanager.cgi");
// //
// Open Database // Open Database
@ -803,7 +804,7 @@ void MainObject::ServeEditCast(int cast_id)
QDateTime origin_datetime=RDUtcToLocal(q->value(10).toDateTime()); QDateTime origin_datetime=RDUtcToLocal(q->value(10).toDateTime());
QDateTime effective_datetime=RDUtcToLocal(q->value(12).toDateTime()); QDateTime effective_datetime=RDUtcToLocal(q->value(12).toDateTime());
RDFeed *feed=new RDFeed(cast_feed_id); RDFeed *feed=new RDFeed(cast_feed_id,cast_config);
printf("Content-type: text/html\n\n"); printf("Content-type: text/html\n\n");
printf("<html>\n"); printf("<html>\n");
@ -1450,8 +1451,8 @@ void MainObject::DeleteCast()
Exit(0); Exit(0);
} }
RDFeed *feed=new RDFeed(cast_feed_id); RDFeed *feed=new RDFeed(cast_feed_id,cast_config);
RDPodcast *cast=new RDPodcast(cast_cast_id); RDPodcast *cast=new RDPodcast(cast_config,cast_cast_id);
cast->removeAudio(feed,&errs,cast_config->logXloadDebugData()); cast->removeAudio(feed,&errs,cast_config->logXloadDebugData());
delete cast; delete cast;
delete feed; delete feed;
@ -1482,7 +1483,7 @@ void MainObject::ServeSubscriptionReport()
Exit(0); Exit(0);
} }
cast_cast_id=-1; cast_cast_id=-1;
RDFeed *feed=new RDFeed(cast_key_name,this); RDFeed *feed=new RDFeed(cast_key_name,cast_config,this);
printf("Content-type: text/html\n\n"); printf("Content-type: text/html\n\n");
printf("<html>\n"); printf("<html>\n");
@ -1616,7 +1617,7 @@ void MainObject::PostEpisode()
Exit(0); Exit(0);
} }
RDFeed::Error err; RDFeed::Error err;
RDFeed *feed=new RDFeed(cast_feed_id,this); RDFeed *feed=new RDFeed(cast_feed_id,cast_config,this);
int cast_id=feed->postFile(station,media_file,&err, int cast_id=feed->postFile(station,media_file,&err,
cast_config->logXloadDebugData(),cast_config); cast_config->logXloadDebugData(),cast_config);
delete feed; delete feed;
@ -1650,7 +1651,7 @@ void MainObject::ServeEpisodeReport()
RDCgiError("Missing CAST_ID"); RDCgiError("Missing CAST_ID");
Exit(0); Exit(0);
} }
RDPodcast *cast=new RDPodcast(cast_cast_id); RDPodcast *cast=new RDPodcast(cast_config,cast_cast_id);
printf("Content-type: text/html\n\n"); printf("Content-type: text/html\n\n");
printf("<html>\n"); printf("<html>\n");

View File

@ -85,8 +85,9 @@ MainObject::MainObject(QObject *parent)
// //
// Read Configuration // Read Configuration
// //
RDConfig *config=new RDConfig(); config=new RDConfig();
config->load(); config->load();
config->setModuleName("rdfeed.cgi");
// //
// Determine Range // Determine Range
@ -279,7 +280,7 @@ QString MainObject::ResolveChannelWildcards(RDSqlQuery *chan_q)
QString MainObject::ResolveItemWildcards(const QString &keyname, QString MainObject::ResolveItemWildcards(const QString &keyname,
RDSqlQuery *item_q,RDSqlQuery *chan_q) RDSqlQuery *item_q,RDSqlQuery *chan_q)
{ {
RDFeed *feed=new RDFeed(keyname); RDFeed *feed=new RDFeed(keyname,config);
QString ret=chan_q->value(11).toString(); QString ret=chan_q->value(11).toString();
ret.replace("%ITEM_TITLE%",RDXmlEscape(item_q->value(0).toString())); ret.replace("%ITEM_TITLE%",RDXmlEscape(item_q->value(0).toString()));
ret.replace("%ITEM_DESCRIPTION%", ret.replace("%ITEM_DESCRIPTION%",

View File

@ -24,6 +24,7 @@
#include <qobject.h> #include <qobject.h>
#include <qsqldatabase.h> #include <qsqldatabase.h>
#include <rdconfig.h>
#include <rddb.h> #include <rddb.h>
class MainObject : public QObject class MainObject : public QObject
@ -41,6 +42,7 @@ class MainObject : public QObject
unsigned cast_id); unsigned cast_id);
bool ShouldCount(const QString &hdr); bool ShouldCount(const QString &hdr);
void Redirect(const QString &url); void Redirect(const QString &url);
RDConfig *config;
}; };

View File

@ -52,6 +52,7 @@ Xport::Xport(QObject *parent)
// //
xport_config=new RDConfig(); xport_config=new RDConfig();
xport_config->load(); xport_config->load();
xport_config->setModuleName("rdxport.cgi");
// //
// Drop root permissions // Drop root permissions