mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-04-09 14:33:28 +02:00
2020-02-20 Fred Gleason <fredg@paravelsystems.com>
* Added a 'FEEDS.AUDIENCE_METRICS' field to the database. * Incremented the database version to 316. * Added a 'Collect Audience Metrics' checkbox to the 'Feed' dialog in rdadmin(1). * Added an 'RDTransfer' base class. * Rebased 'RDDelete' to 'RDTransfer'. * Added 'sftp' support to 'RDDelete'. * Added 'file' support to 'RDDelete'. * Refactored RSS generation to occur in 'RDFeed'. * Added a 'delete_test' test harness.
This commit is contained in:
parent
de4c6b0c8c
commit
d7f395f7db
1
.gitignore
vendored
1
.gitignore
vendored
@ -108,6 +108,7 @@ tests/audio_peaks_test
|
||||
tests/datedecode_test
|
||||
tests/dateparse_test
|
||||
tests/db_charset_test
|
||||
tests/delete_test
|
||||
tests/download_test
|
||||
tests/getpids_test
|
||||
tests/log_unlink_test
|
||||
|
11
ChangeLog
11
ChangeLog
@ -19560,3 +19560,14 @@
|
||||
2020-02-11 Fred Gleason <fredg@paravelsys tems.com>
|
||||
* Added a check to the 'Add RSS Feed' dialog in rdadmin(1) to
|
||||
prevent creation of feeds with a blank name.
|
||||
2020-02-20 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added a 'FEEDS.AUDIENCE_METRICS' field to the database.
|
||||
* Incremented the database version to 316.
|
||||
* Added a 'Collect Audience Metrics' checkbox to the 'Feed'
|
||||
dialog in rdadmin(1).
|
||||
* Added an 'RDTransfer' base class.
|
||||
* Rebased 'RDDelete' to 'RDTransfer'.
|
||||
* Added 'sftp' support to 'RDDelete'.
|
||||
* Added 'file' support to 'RDDelete'.
|
||||
* Refactored RSS generation to occur in 'RDFeed'.
|
||||
* Added a 'delete_test' test harness.
|
||||
|
@ -7,6 +7,7 @@ FIELD NAME TYPE REMARKS
|
||||
ID int(10) unsigned Primary key, auto increment
|
||||
KEY_NAME varchar(8) Unique
|
||||
IS_SUPERFEED enum('N','Y')
|
||||
AUDIENCE_METRICS enum('N','Y')
|
||||
CHANNEL_TITLE varchar(191)
|
||||
CHANNEL_DESCRIPTION text
|
||||
CHANNEL_CATEGORY varchar(64)
|
||||
|
@ -226,6 +226,7 @@ dist_librd_la_SOURCES = dbversion.h\
|
||||
rdtimeengine.cpp rdtimeengine.h\
|
||||
rdtimeevent.cpp rdtimeevent.h\
|
||||
rdtransportbutton.cpp rdtransportbutton.h\
|
||||
rdtransfer.cpp rdtransfer.h\
|
||||
rdtrimaudio.cpp rdtrimaudio.h\
|
||||
rdtty.cpp rdtty.h\
|
||||
rdttydevice.cpp rdttydevice.h\
|
||||
@ -331,6 +332,7 @@ nodist_librd_la_SOURCES = moc_rdadd_cart.cpp\
|
||||
moc_rdsvc.cpp\
|
||||
moc_rdtimeedit.cpp\
|
||||
moc_rdtimeengine.cpp\
|
||||
moc_rdtransfer.cpp\
|
||||
moc_rdtransportbutton.cpp\
|
||||
moc_rdtrimaudio.cpp\
|
||||
moc_rdttydevice.cpp\
|
||||
|
@ -24,7 +24,7 @@
|
||||
/*
|
||||
* Current Database Version
|
||||
*/
|
||||
#define RD_VERSION_DATABASE 315
|
||||
#define RD_VERSION_DATABASE 316
|
||||
|
||||
|
||||
#endif // DBVERSION_H
|
||||
|
@ -68,10 +68,21 @@ int DeleteErrorCallback(CURL *curl,curl_infotype type,char *msg,size_t size,
|
||||
}
|
||||
|
||||
|
||||
RDDelete::RDDelete(RDConfig *config,QObject *parent)
|
||||
: QObject(parent)
|
||||
RDDelete::RDDelete(RDConfig *c,QObject *parent)
|
||||
: RDTransfer(c,parent)
|
||||
{
|
||||
conv_config=config;
|
||||
}
|
||||
|
||||
|
||||
QStringList RDDelete::supportedSchemes() const
|
||||
{
|
||||
QStringList schemes;
|
||||
|
||||
schemes.push_back("file");
|
||||
schemes.push_back("ftp");
|
||||
schemes.push_back("sftp");
|
||||
|
||||
return schemes;
|
||||
}
|
||||
|
||||
|
||||
@ -90,44 +101,63 @@ RDDelete::ErrorCode RDDelete::runDelete(const QString &username,
|
||||
CURLcode err;
|
||||
RDDelete::ErrorCode ret=RDDelete::ErrorOk;
|
||||
QString currentdir;
|
||||
char urlstr[1024];
|
||||
char userpwd[256];
|
||||
QString filename;
|
||||
QString xml="";
|
||||
|
||||
if(!urlIsSupported(conv_target_url)) {
|
||||
return RDDelete::ErrorUnsupportedUrlScheme;
|
||||
}
|
||||
|
||||
if(conv_target_url.scheme().toLower()=="file") {
|
||||
unlink(conv_target_url.path().toUtf8().constData());
|
||||
return RDDelete::ErrorOk;
|
||||
}
|
||||
|
||||
if((curl=curl_easy_init())==NULL) {
|
||||
rda->syslog(LOG_ERR,"unable to initialize curl library\n");
|
||||
return RDDelete::ErrorInternal;
|
||||
}
|
||||
strncpy(urlstr,(const char *)(conv_target_url.protocol()+"://"+
|
||||
conv_target_url.host()+"/").utf8(),1024);
|
||||
curl_easy_setopt(curl,CURLOPT_URL,urlstr);
|
||||
strncpy(userpwd,(QString(username)+":"+password).utf8(),256);
|
||||
curl_easy_setopt(curl,CURLOPT_USERPWD,userpwd);
|
||||
curl_easy_setopt(curl,CURLOPT_URL,conv_target_url.toEncoded().constData());
|
||||
curl_easy_setopt(curl,CURLOPT_USERNAME,username.toUtf8().constData());
|
||||
curl_easy_setopt(curl,CURLOPT_PASSWORD,password.toUtf8().constData());
|
||||
curl_easy_setopt(curl,CURLOPT_HTTPAUTH,CURLAUTH_ANY);
|
||||
curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,DeleteWriteCallback);
|
||||
curl_easy_setopt(curl,CURLOPT_WRITEDATA,&xml);
|
||||
curl_easy_setopt(curl,CURLOPT_USERAGENT,
|
||||
(const char *)conv_config->userAgent().utf8());
|
||||
config()->userAgent().toUtf8().constData());
|
||||
if(log_debug) {
|
||||
curl_easy_setopt(curl,CURLOPT_VERBOSE,1);
|
||||
curl_easy_setopt(curl,CURLOPT_DEBUGFUNCTION,DeleteErrorCallback);
|
||||
}
|
||||
currentdir="";
|
||||
if(!conv_target_url.dirPath().right(conv_target_url.dirPath().length()-1).
|
||||
isEmpty()) {
|
||||
currentdir=conv_target_url.dirPath().
|
||||
right(conv_target_url.dirPath().length()-1)+"/";
|
||||
|
||||
if(conv_target_url.scheme().toLower()=="ftp") {
|
||||
QStringList f0=conv_target_url.path().split("/",QString::SkipEmptyParts);
|
||||
filename=f0.last();
|
||||
f0.removeLast();
|
||||
if(f0.size()>0) {
|
||||
currentdir=f0.join("/")+"/";
|
||||
}
|
||||
if(!currentdir.isEmpty()) {
|
||||
cmds=curl_slist_append(cmds,(QString("cwd ")+currentdir).toUtf8());
|
||||
}
|
||||
cmds=curl_slist_append(cmds,(QString("dele ")+filename).toUtf8());
|
||||
}
|
||||
if(!currentdir.isEmpty()) {
|
||||
cmds=curl_slist_append(cmds,QString().sprintf("cwd %s",
|
||||
(const char *)currentdir));
|
||||
|
||||
if(conv_target_url.scheme().toLower()=="sftp") {
|
||||
cmds=
|
||||
curl_slist_append(cmds,(QString("rm ")+conv_target_url.path()).toUtf8());
|
||||
}
|
||||
cmds=curl_slist_append(cmds, QString().sprintf("dele %s",
|
||||
(const char *)conv_target_url.fileName()));
|
||||
|
||||
curl_easy_setopt(curl,CURLOPT_QUOTE,cmds);
|
||||
|
||||
|
||||
|
||||
switch((err=curl_easy_perform(curl))) {
|
||||
case CURLE_OK:
|
||||
case 21: // CURLE_QUOTE_ERROR -- In case the file is already gone
|
||||
case CURLE_REMOTE_ACCESS_DENIED: // Sometimes we get this even when
|
||||
// successful (?!)
|
||||
case CURLE_QUOTE_ERROR: // In case the file is already gone
|
||||
case CURLE_REMOTE_FILE_NOT_FOUND:
|
||||
ret=RDDelete::ErrorOk;
|
||||
break;
|
||||
|
||||
@ -151,10 +181,6 @@ RDDelete::ErrorCode RDDelete::runDelete(const QString &username,
|
||||
ret=RDDelete::ErrorRemoteConnection;
|
||||
break;
|
||||
|
||||
case 9: // CURLE_REMOTE_ACCESS_DENIED:
|
||||
ret=RDDelete::ErrorRemoteAccess;
|
||||
break;
|
||||
|
||||
default:
|
||||
ret=RDDelete::ErrorUnknown;
|
||||
printf("CURL error: %d\n",err);
|
||||
@ -222,6 +248,10 @@ QString RDDelete::errorText(RDDelete::ErrorCode err)
|
||||
case RDDelete::ErrorUnknown:
|
||||
ret=tr("Unknown Error");
|
||||
break;
|
||||
|
||||
case RDDelete::ErrorUnsupportedUrlScheme:
|
||||
ret=tr("Unsupported URL Scheme");
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// Delete a Remote File
|
||||
//
|
||||
// (C) Copyright 2011,2016 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2011-2020 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@ -22,11 +22,12 @@
|
||||
#define RDDELETE_H
|
||||
|
||||
#include <qobject.h>
|
||||
#include <q3url.h>
|
||||
#include <qurl.h>
|
||||
|
||||
#include <rdconfig.h>
|
||||
#include <rdtransfer.h>
|
||||
|
||||
class RDDelete : public QObject
|
||||
class RDDelete : public RDTransfer
|
||||
{
|
||||
Q_OBJECT;
|
||||
public:
|
||||
@ -35,8 +36,10 @@ class RDDelete : public QObject
|
||||
ErrorInternal=5,ErrorRemoteServer=6,ErrorUrlInvalid=7,
|
||||
ErrorUnspecified=8,ErrorInvalidUser=9,
|
||||
ErrorInvalidLogin=11,ErrorRemoteAccess=12,
|
||||
ErrorRemoteConnection=13,ErrorUnknown=14};
|
||||
ErrorRemoteConnection=13,ErrorUnknown=14,
|
||||
ErrorUnsupportedUrlScheme=15};
|
||||
RDDelete(RDConfig *config,QObject *parent=0);
|
||||
QStringList supportedSchemes() const;
|
||||
void setTargetUrl(const QString &url);
|
||||
RDDelete::ErrorCode runDelete(const QString &username,
|
||||
const QString &password,
|
||||
@ -44,8 +47,7 @@ class RDDelete : public QObject
|
||||
static QString errorText(RDDelete::ErrorCode err);
|
||||
|
||||
private:
|
||||
Q3Url conv_target_url;
|
||||
RDConfig *conv_config;
|
||||
QUrl conv_target_url;
|
||||
};
|
||||
|
||||
|
||||
|
426
lib/rdfeed.cpp
426
lib/rdfeed.cpp
@ -20,6 +20,8 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include <curl/curl.h>
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qfile.h>
|
||||
#include <qurl.h>
|
||||
@ -31,6 +33,7 @@
|
||||
#include "rdcut.h"
|
||||
#include "rdconf.h"
|
||||
#include "rddb.h"
|
||||
#include "rddelete.h"
|
||||
#include "rdescape_string.h"
|
||||
#include "rdfeed.h"
|
||||
#include "rdlibrary_conf.h"
|
||||
@ -46,6 +49,22 @@
|
||||
#define DEFAULT_CHANNEL_XML "<title>%TITLE%</title>\n<description>%DESCRIPTION%</description>\n<category>%CATEGORY%</category>\n<link>%LINK%</link>\n<language>%LANGUAGE%</language>\n<copyright>%COPYRIGHT%</copyright>\n<lastBuildDate>%BUILD_DATE%</lastBuildDate>\n<pubDate>%PUBLISH_DATE%</pubDate>\n<webMaster>%WEBMASTER%</webMaster>\n<generator>%GENERATOR%</generator>"
|
||||
#define DEFAULT_ITEM_XML "<title>%ITEM_TITLE%</title>\n<link>%ITEM_LINK%</link>\n<guid isPermaLink=\"false\">%ITEM_GUID%</guid>\n<description>%ITEM_DESCRIPTION%</description>\n<author>%ITEM_AUTHOR%</author>\n<comments>%ITEM_COMMENTS%</comments>\n<source url=\"%ITEM_SOURCE_URL%\">%ITEM_SOURCE_TEXT%</source>\n<enclosure url=\"%ITEM_AUDIO_URL%\" length=\"%ITEM_AUDIO_LENGTH%\" type=\"audio/mpeg\" />\n<category>%ITEM_CATEGORY%</category>\n<pubDate>%ITEM_PUBLISH_DATE%</pubDate>"
|
||||
|
||||
size_t __RDFeed_Readfunction_Callback(char *buffer,size_t size,size_t nitems,
|
||||
void *userdata)
|
||||
{
|
||||
RDFeed *feed=(RDFeed *)userdata;
|
||||
|
||||
int curlsize=size*nitems;
|
||||
int segsize=feed->feed_xml.size()-feed->feed_xml_ptr;
|
||||
if(segsize<curlsize) {
|
||||
curlsize=segsize;
|
||||
}
|
||||
memcpy(buffer,feed->feed_xml.mid(feed->feed_xml_ptr,curlsize).constData(),
|
||||
curlsize);
|
||||
feed->feed_xml_ptr+=curlsize;
|
||||
return curlsize;
|
||||
}
|
||||
|
||||
RDFeed::RDFeed(const QString &keyname,RDConfig *config,QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
@ -62,6 +81,13 @@ RDFeed::RDFeed(const QString &keyname,RDConfig *config,QObject *parent)
|
||||
feed_id=q->value(0).toUInt();
|
||||
}
|
||||
delete q;
|
||||
|
||||
//
|
||||
// Get the CGI Hostname
|
||||
//
|
||||
if(getenv("SERVER_NAME")!=NULL) {
|
||||
feed_cgi_hostname=getenv("SERVER_NAME");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -85,7 +111,7 @@ RDFeed::RDFeed(unsigned id,RDConfig *config,QObject *parent)
|
||||
|
||||
bool RDFeed::exists() const
|
||||
{
|
||||
return RDDoesRowExist("FEEDS","NAME",feed_keyname);
|
||||
return RDDoesRowExist("FEEDS","KEY_NAME",feed_keyname);
|
||||
}
|
||||
|
||||
|
||||
@ -103,6 +129,19 @@ void RDFeed::setIsSuperfeed(bool state) const
|
||||
}
|
||||
|
||||
|
||||
bool RDFeed::audienceMetrics() const
|
||||
{
|
||||
return RDBool(RDGetSqlValue("FEEDS","KEY_NAME",feed_keyname,
|
||||
"AUDIENCE_METRICS").toString());
|
||||
}
|
||||
|
||||
|
||||
void RDFeed::setAudienceMetrics(bool state)
|
||||
{
|
||||
SetRow("AUDIENCE_METRICS",RDYesNo(state));
|
||||
}
|
||||
|
||||
|
||||
QString RDFeed::keyName() const
|
||||
{
|
||||
return feed_keyname;
|
||||
@ -311,6 +350,12 @@ void RDFeed::setItemXml(const QString &str)
|
||||
}
|
||||
|
||||
|
||||
QString RDFeed::feedUrl() const
|
||||
{
|
||||
return purgeUrl()+"/"+keyName()+".rss";
|
||||
}
|
||||
|
||||
|
||||
bool RDFeed::castOrder() const
|
||||
{
|
||||
return RDBool(RDGetSqlValue("FEEDS","KEY_NAME",feed_keyname,
|
||||
@ -527,30 +572,98 @@ QString RDFeed::audioUrl(RDFeed::MediaLinkMode mode,
|
||||
RDPodcast *cast;
|
||||
|
||||
switch(mode) {
|
||||
case RDFeed::LinkNone:
|
||||
ret="";
|
||||
break;
|
||||
case RDFeed::LinkNone:
|
||||
ret="";
|
||||
break;
|
||||
|
||||
case RDFeed::LinkDirect:
|
||||
cast=new RDPodcast(feed_config,cast_id);
|
||||
ret=baseUrl()+"/"+cast->audioFilename();
|
||||
delete cast;
|
||||
break;
|
||||
case RDFeed::LinkDirect:
|
||||
cast=new RDPodcast(feed_config,cast_id);
|
||||
ret=baseUrl()+"/"+cast->audioFilename();
|
||||
delete cast;
|
||||
break;
|
||||
|
||||
case RDFeed::LinkCounted:
|
||||
ret=QString("http://")+basePreamble()+cgi_hostname+
|
||||
"/rd-bin/rdfeed."+uploadExtension()+"?"+keyName()+
|
||||
QString().sprintf("&cast_id=%d",cast_id);
|
||||
break;
|
||||
case RDFeed::LinkCounted:
|
||||
ret=QString("http://")+basePreamble()+cgi_hostname+
|
||||
"/rd-bin/rdfeed."+uploadExtension()+"?"+keyName()+
|
||||
QString().sprintf("&cast_id=%d",cast_id);
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
bool RDFeed::postXml(QString *err_msg)
|
||||
{
|
||||
CURL *curl=NULL;
|
||||
CURLcode curl_err;
|
||||
bool ret=false;
|
||||
char errstr[CURL_ERROR_SIZE];
|
||||
|
||||
if((curl=curl_easy_init())==NULL) {
|
||||
*err_msg=tr("Unable to get CURL handle.");
|
||||
return false;
|
||||
}
|
||||
|
||||
feed_xml=rssXml(err_msg).toUtf8();
|
||||
feed_xml_ptr=0;
|
||||
|
||||
curl_easy_setopt(curl,CURLOPT_URL,feedUrl().toUtf8().constData());
|
||||
curl_easy_setopt(curl,CURLOPT_UPLOAD,1);
|
||||
curl_easy_setopt(curl,CURLOPT_READFUNCTION, __RDFeed_Readfunction_Callback);
|
||||
curl_easy_setopt(curl,CURLOPT_READDATA,this);
|
||||
curl_easy_setopt(curl,CURLOPT_USERNAME,purgeUsername().toUtf8().constData());
|
||||
curl_easy_setopt(curl,CURLOPT_PASSWORD,purgePassword().toUtf8().constData());
|
||||
|
||||
curl_easy_setopt(curl,CURLOPT_TIMEOUT,RD_CURL_TIMEOUT);
|
||||
curl_easy_setopt(curl,CURLOPT_NOPROGRESS,1);
|
||||
curl_easy_setopt(curl,CURLOPT_USERAGENT,
|
||||
(const char *)rda->config()->userAgent().utf8());
|
||||
curl_easy_setopt(curl,CURLOPT_ERRORBUFFER,errstr);
|
||||
/*
|
||||
curl_easy_setopt(curl,CURLOPT_VERBOSE,1);
|
||||
curl_easy_setopt(curl,CURLOPT_DEBUGFUNCTION,UploadErrorCallback);
|
||||
*/
|
||||
switch((curl_err=curl_easy_perform(curl))) {
|
||||
case CURLE_OK:
|
||||
case CURLE_PARTIAL_FILE:
|
||||
ret=true;
|
||||
break;
|
||||
|
||||
default:
|
||||
*err_msg=errstr;
|
||||
ret=false;
|
||||
break;
|
||||
}
|
||||
curl_easy_cleanup(curl);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
bool RDFeed::deleteXml(QString *err_msg)
|
||||
{
|
||||
RDDelete::ErrorCode conv_err;
|
||||
RDDelete *conv=new RDDelete(rda->config());
|
||||
if(!conv->urlIsSupported(feedUrl())) {
|
||||
*err_msg="unsupported url scheme";
|
||||
delete conv;
|
||||
return false;
|
||||
}
|
||||
conv->setTargetUrl(feedUrl());
|
||||
conv_err=conv->runDelete(purgeUsername(),purgePassword(),
|
||||
rda->config()->logXloadDebugData());
|
||||
*err_msg=RDDelete::errorText(conv_err);
|
||||
delete conv;
|
||||
|
||||
return conv_err==RDDelete::ErrorOk;
|
||||
}
|
||||
|
||||
|
||||
unsigned RDFeed::postCut(RDUser *user,RDStation *station,
|
||||
const QString &cutname,Error *err,bool log_debug,
|
||||
RDConfig *config)
|
||||
{
|
||||
QString err_msg;
|
||||
QString tmpfile;
|
||||
QString destfile;
|
||||
QString sql;
|
||||
@ -649,6 +762,11 @@ unsigned RDFeed::postCut(RDUser *user,RDStation *station,
|
||||
delete upload;
|
||||
delete cast;
|
||||
|
||||
if(!audienceMetrics()) {
|
||||
emit postProgressChanged(4);
|
||||
postXml(&err_msg);
|
||||
}
|
||||
|
||||
emit postProgressChanged(totalPostSteps());
|
||||
|
||||
return cast_id;
|
||||
@ -658,6 +776,7 @@ unsigned RDFeed::postCut(RDUser *user,RDStation *station,
|
||||
unsigned RDFeed::postFile(RDStation *station,const QString &srcfile,Error *err,
|
||||
bool log_debug,RDConfig *config)
|
||||
{
|
||||
QString err_msg;
|
||||
QString sql;
|
||||
RDSqlQuery *q;
|
||||
QString cmd;
|
||||
@ -764,6 +883,12 @@ unsigned RDFeed::postFile(RDStation *station,const QString &srcfile,Error *err,
|
||||
delete cast;
|
||||
unlink(QString(tmpfile)+".wav");
|
||||
unlink(tmpfile);
|
||||
|
||||
if(!audienceMetrics()) {
|
||||
emit postProgressChanged(4);
|
||||
postXml(&err_msg);
|
||||
}
|
||||
|
||||
emit postProgressChanged(totalPostSteps());
|
||||
|
||||
*err=RDFeed::ErrorOk;
|
||||
@ -773,7 +898,104 @@ unsigned RDFeed::postFile(RDStation *station,const QString &srcfile,Error *err,
|
||||
|
||||
int RDFeed::totalPostSteps() const
|
||||
{
|
||||
return RDFEED_TOTAL_POST_STEPS;
|
||||
if(audienceMetrics()) {
|
||||
return RDFEED_TOTAL_POST_STEPS;
|
||||
}
|
||||
return RDFEED_TOTAL_POST_STEPS+1;
|
||||
}
|
||||
|
||||
|
||||
QString RDFeed::rssXml(QString *err_msg,bool *ok)
|
||||
{
|
||||
QString ret;
|
||||
|
||||
QString sql;
|
||||
RDSqlQuery *q;
|
||||
RDSqlQuery *q1;
|
||||
|
||||
if(ok!=NULL) {
|
||||
*ok=false;
|
||||
}
|
||||
sql=QString("select ")+
|
||||
"CHANNEL_TITLE,"+ // 00
|
||||
"CHANNEL_DESCRIPTION,"+ // 01
|
||||
"CHANNEL_CATEGORY,"+ // 02
|
||||
"CHANNEL_LINK,"+ // 03
|
||||
"CHANNEL_COPYRIGHT,"+ // 04
|
||||
"CHANNEL_WEBMASTER,"+ // 05
|
||||
"CHANNEL_LANGUAGE,"+ // 06
|
||||
"LAST_BUILD_DATETIME,"+ // 07
|
||||
"ORIGIN_DATETIME,"+ // 08
|
||||
"HEADER_XML,"+ // 09
|
||||
"CHANNEL_XML,"+ // 10
|
||||
"ITEM_XML,"+ // 11
|
||||
"BASE_URL,"+ // 12
|
||||
"ID,"+ // 13
|
||||
"UPLOAD_EXTENSION,"+ // 14
|
||||
"CAST_ORDER,"+ // 15
|
||||
"REDIRECT_PATH,"+ // 16
|
||||
"BASE_PREAMBLE,"+ // 17
|
||||
"AUDIENCE_METRICS "+ // 18
|
||||
"from FEEDS where "+
|
||||
"KEY_NAME=\""+RDEscapeString(keyName())+"\"";
|
||||
q=new RDSqlQuery(sql);
|
||||
if(!q->first()) {
|
||||
*err_msg="no feed matches the supplied key name";
|
||||
return QString();
|
||||
}
|
||||
|
||||
//
|
||||
// Render Header XML
|
||||
//
|
||||
ret+=q->value(9).toString()+"\r\n";
|
||||
|
||||
//
|
||||
// Render Channel XML
|
||||
//
|
||||
ret+="<channel>\n";
|
||||
ret+=ResolveChannelWildcards(q)+"\r\n";
|
||||
|
||||
//
|
||||
// Render Item XML
|
||||
//
|
||||
sql=QString("select ")+
|
||||
"ITEM_TITLE,"+ // 00
|
||||
"ITEM_DESCRIPTION,"+ // 01
|
||||
"ITEM_CATEGORY,"+ // 02
|
||||
"ITEM_LINK,"+ // 03
|
||||
"ITEM_AUTHOR,"+ // 04
|
||||
"ITEM_SOURCE_TEXT,"+ // 05
|
||||
"ITEM_SOURCE_URL,"+ // 06
|
||||
"ITEM_COMMENTS,"+ // 07
|
||||
"AUDIO_FILENAME,"+ // 08
|
||||
"AUDIO_LENGTH,"+ // 09
|
||||
"AUDIO_TIME,"+ // 10
|
||||
"EFFECTIVE_DATETIME,"+ // 11
|
||||
"ID "+ // 12
|
||||
"from PODCASTS where "+
|
||||
QString().sprintf("(FEED_ID=%d)&&",q->value(13).toUInt())+
|
||||
QString().sprintf("(STATUS=%d) ",RDPodcast::StatusActive)+
|
||||
"order by ORIGIN_DATETIME";
|
||||
if(q->value(15).toString()=="N") {
|
||||
sql+=" desc";
|
||||
}
|
||||
q1=new RDSqlQuery(sql);
|
||||
while(q1->next()) {
|
||||
ret+="<item>\r\n";
|
||||
ret+=ResolveItemWildcards(q1,q);
|
||||
ret+="</item>\r\n";
|
||||
}
|
||||
delete q1;
|
||||
|
||||
ret+="</channel>\r\n";
|
||||
ret+="</rss>\r\n";
|
||||
delete q;
|
||||
|
||||
if(ok!=NULL) {
|
||||
*ok=true;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@ -816,34 +1038,35 @@ unsigned RDFeed::create(const QString &keyname,bool enable_users,
|
||||
else {
|
||||
sql=QString("select ")+
|
||||
"IS_SUPERFEED,"+ // 00
|
||||
"CHANNEL_TITLE,"+ // 01
|
||||
"CHANNEL_DESCRIPTION,"+ // 02
|
||||
"CHANNEL_CATEGORY,"+ // 03
|
||||
"CHANNEL_LINK,"+ // 04
|
||||
"CHANNEL_COPYRIGHT,"+ // 05
|
||||
"CHANNEL_WEBMASTER,"+ // 06
|
||||
"CHANNEL_LANGUAGE,"+ // 07
|
||||
"BASE_URL,"+ // 08
|
||||
"BASE_PREAMBLE,"+ // 09
|
||||
"PURGE_URL,"+ // 10
|
||||
"PURGE_USERNAME,"+ // 11
|
||||
"PURGE_PASSWORD,"+ // 12
|
||||
"HEADER_XML,"+ // 13
|
||||
"CHANNEL_XML,"+ // 14
|
||||
"ITEM_XML,"+ // 15
|
||||
"CAST_ORDER,"+ // 16
|
||||
"MAX_SHELF_LIFE,"+ // 17
|
||||
"ENABLE_AUTOPOST,"+ // 18
|
||||
"KEEP_METADATA,"+ // 19
|
||||
"UPLOAD_FORMAT,"+ // 20
|
||||
"UPLOAD_CHANNELS,"+ // 21
|
||||
"UPLOAD_SAMPRATE,"+ // 22
|
||||
"UPLOAD_BITRATE,"+ // 23
|
||||
"UPLOAD_QUALITY,"+ // 24
|
||||
"UPLOAD_EXTENSION,"+ // 25
|
||||
"NORMALIZE_LEVEL,"+ // 26
|
||||
"REDIRECT_PATH,"+ // 27
|
||||
"MEDIA_LINK_MODE "+ // 28
|
||||
"AUDIENCE_METRICS,"+ // 01
|
||||
"CHANNEL_TITLE,"+ // 02
|
||||
"CHANNEL_DESCRIPTION,"+ // 03
|
||||
"CHANNEL_CATEGORY,"+ // 04
|
||||
"CHANNEL_LINK,"+ // 05
|
||||
"CHANNEL_COPYRIGHT,"+ // 06
|
||||
"CHANNEL_WEBMASTER,"+ // 07
|
||||
"CHANNEL_LANGUAGE,"+ // 08
|
||||
"BASE_URL,"+ // 09
|
||||
"BASE_PREAMBLE,"+ // 10
|
||||
"PURGE_URL,"+ // 11
|
||||
"PURGE_USERNAME,"+ // 12
|
||||
"PURGE_PASSWORD,"+ // 13
|
||||
"HEADER_XML,"+ // 14
|
||||
"CHANNEL_XML,"+ // 15
|
||||
"ITEM_XML,"+ // 16
|
||||
"CAST_ORDER,"+ // 17
|
||||
"MAX_SHELF_LIFE,"+ // 18
|
||||
"ENABLE_AUTOPOST,"+ // 19
|
||||
"KEEP_METADATA,"+ // 20
|
||||
"UPLOAD_FORMAT,"+ // 21
|
||||
"UPLOAD_CHANNELS,"+ // 22
|
||||
"UPLOAD_SAMPRATE,"+ // 23
|
||||
"UPLOAD_BITRATE,"+ // 24
|
||||
"UPLOAD_QUALITY,"+ // 25
|
||||
"UPLOAD_EXTENSION,"+ // 26
|
||||
"NORMALIZE_LEVEL,"+ // 27
|
||||
"REDIRECT_PATH,"+ // 28
|
||||
"MEDIA_LINK_MODE "+ // 29
|
||||
"from FEEDS where "+
|
||||
"KEY_NAME=\""+RDEscapeString(exemplar)+"\"";
|
||||
q=new RDSqlQuery(sql);
|
||||
@ -851,36 +1074,37 @@ unsigned RDFeed::create(const QString &keyname,bool enable_users,
|
||||
sql=QString("insert into FEEDS set ")+
|
||||
"KEY_NAME=\""+RDEscapeString(keyname)+"\","+
|
||||
"IS_SUPERFEED=\""+q->value(0).toString()+"\","+
|
||||
"CHANNEL_TITLE=\""+RDEscapeString(q->value(1).toString())+"\","+
|
||||
"CHANNEL_DESCRIPTION=\""+RDEscapeString(q->value(2).toString())+"\","+
|
||||
"CHANNEL_CATEGORY=\""+RDEscapeString(q->value(3).toString())+"\","+
|
||||
"CHANNEL_LINK=\""+RDEscapeString(q->value(4).toString())+"\","+
|
||||
"CHANNEL_COPYRIGHT=\""+RDEscapeString(q->value(5).toString())+"\","+
|
||||
"CHANNEL_WEBMASTER=\""+RDEscapeString(q->value(6).toString())+"\","+
|
||||
"CHANNEL_LANGUAGE=\""+RDEscapeString(q->value(7).toString())+"\","+
|
||||
"BASE_URL=\""+RDEscapeString(q->value(8).toString())+"\","+
|
||||
"BASE_PREAMBLE=\""+RDEscapeString(q->value(9).toString())+"\","+
|
||||
"PURGE_URL=\""+RDEscapeString(q->value(10).toString())+"\","+
|
||||
"PURGE_USERNAME=\""+RDEscapeString(q->value(11).toString())+"\","+
|
||||
"PURGE_PASSWORD=\""+RDEscapeString(q->value(12).toString())+"\","+
|
||||
"HEADER_XML=\""+RDEscapeString(q->value(13).toString())+"\","+
|
||||
"CHANNEL_XML=\""+RDEscapeString(q->value(14).toString())+"\","+
|
||||
"ITEM_XML=\""+RDEscapeString(q->value(15).toString())+"\","+
|
||||
"CAST_ORDER=\""+RDEscapeString(q->value(16).toString())+"\","+
|
||||
QString().sprintf("MAX_SHELF_LIFE=%d,",q->value(17).toInt())+
|
||||
"AUDIENCE_METRICS=\""+q->value(1).toString()+"\","+
|
||||
"CHANNEL_TITLE=\""+RDEscapeString(q->value(2).toString())+"\","+
|
||||
"CHANNEL_DESCRIPTION=\""+RDEscapeString(q->value(3).toString())+"\","+
|
||||
"CHANNEL_CATEGORY=\""+RDEscapeString(q->value(4).toString())+"\","+
|
||||
"CHANNEL_LINK=\""+RDEscapeString(q->value(5).toString())+"\","+
|
||||
"CHANNEL_COPYRIGHT=\""+RDEscapeString(q->value(6).toString())+"\","+
|
||||
"CHANNEL_WEBMASTER=\""+RDEscapeString(q->value(7).toString())+"\","+
|
||||
"CHANNEL_LANGUAGE=\""+RDEscapeString(q->value(8).toString())+"\","+
|
||||
"BASE_URL=\""+RDEscapeString(q->value(9).toString())+"\","+
|
||||
"BASE_PREAMBLE=\""+RDEscapeString(q->value(10).toString())+"\","+
|
||||
"PURGE_URL=\""+RDEscapeString(q->value(11).toString())+"\","+
|
||||
"PURGE_USERNAME=\""+RDEscapeString(q->value(12).toString())+"\","+
|
||||
"PURGE_PASSWORD=\""+RDEscapeString(q->value(13).toString())+"\","+
|
||||
"HEADER_XML=\""+RDEscapeString(q->value(14).toString())+"\","+
|
||||
"CHANNEL_XML=\""+RDEscapeString(q->value(15).toString())+"\","+
|
||||
"ITEM_XML=\""+RDEscapeString(q->value(16).toString())+"\","+
|
||||
"CAST_ORDER=\""+RDEscapeString(q->value(17).toString())+"\","+
|
||||
QString().sprintf("MAX_SHELF_LIFE=%d,",q->value(18).toInt())+
|
||||
"LAST_BUILD_DATETIME=now(),"+
|
||||
"ORIGIN_DATETIME=now(),"+
|
||||
"ENABLE_AUTOPOST=\""+RDEscapeString(q->value(18).toString())+"\","+
|
||||
"KEEP_METADATA=\""+RDEscapeString(q->value(19).toString())+"\","+
|
||||
QString().sprintf("UPLOAD_FORMAT=%d,",q->value(20).toInt())+
|
||||
QString().sprintf("UPLOAD_CHANNELS=%d,",q->value(21).toInt())+
|
||||
QString().sprintf("UPLOAD_SAMPRATE=%d,",q->value(22).toInt())+
|
||||
QString().sprintf("UPLOAD_BITRATE=%d,",q->value(23).toInt())+
|
||||
QString().sprintf("UPLOAD_QUALITY=%d,",q->value(24).toInt())+
|
||||
"UPLOAD_EXTENSION=\""+RDEscapeString(q->value(25).toString())+"\","+
|
||||
QString().sprintf("NORMALIZE_LEVEL=%d,",q->value(26).toInt())+
|
||||
"REDIRECT_PATH=\""+RDEscapeString(q->value(27).toString())+"\","+
|
||||
QString().sprintf("MEDIA_LINK_MODE=%d",q->value(28).toInt());
|
||||
"ENABLE_AUTOPOST=\""+RDEscapeString(q->value(19).toString())+"\","+
|
||||
"KEEP_METADATA=\""+RDEscapeString(q->value(20).toString())+"\","+
|
||||
QString().sprintf("UPLOAD_FORMAT=%d,",q->value(21).toInt())+
|
||||
QString().sprintf("UPLOAD_CHANNELS=%d,",q->value(22).toInt())+
|
||||
QString().sprintf("UPLOAD_SAMPRATE=%d,",q->value(23).toInt())+
|
||||
QString().sprintf("UPLOAD_BITRATE=%d,",q->value(24).toInt())+
|
||||
QString().sprintf("UPLOAD_QUALITY=%d,",q->value(25).toInt())+
|
||||
"UPLOAD_EXTENSION=\""+RDEscapeString(q->value(26).toString())+"\","+
|
||||
QString().sprintf("NORMALIZE_LEVEL=%d,",q->value(27).toInt())+
|
||||
"REDIRECT_PATH=\""+RDEscapeString(q->value(28).toString())+"\","+
|
||||
QString().sprintf("MEDIA_LINK_MODE=%d",q->value(29).toInt());
|
||||
feed_id=RDSqlQuery::run(sql,&ok).toUInt();
|
||||
if(!ok) {
|
||||
*err_msg=tr("Unable to insert new feed record!");
|
||||
@ -1026,6 +1250,66 @@ unsigned RDFeed::CreateCast(QString *filename,int bytes,int msecs) const
|
||||
}
|
||||
|
||||
|
||||
QString RDFeed::ResolveChannelWildcards(RDSqlQuery *chan_q)
|
||||
{
|
||||
QString ret=chan_q->value(10).toString();
|
||||
// ret.replace("%TITLE%",chan_q->value(0).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("Rivendell ")+VERSION);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
QString RDFeed::ResolveItemWildcards(RDSqlQuery *item_q,RDSqlQuery *chan_q)
|
||||
{
|
||||
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()));
|
||||
if(chan_q->value(18).toString()=="Y") {
|
||||
ret.replace("%ITEM_AUDIO_URL%",
|
||||
RDXmlEscape(audioUrl(RDFeed::LinkCounted,feed_cgi_hostname,
|
||||
item_q->value(12).toUInt())));
|
||||
}
|
||||
else {
|
||||
ret.replace("%ITEM_AUDIO_URL%",
|
||||
RDXmlEscape(audioUrl(RDFeed::LinkDirect,feed_cgi_hostname,
|
||||
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()));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
QString RDFeed::GetTempFilename() const
|
||||
{
|
||||
char tempname[PATH_MAX];
|
||||
|
19
lib/rdfeed.h
19
lib/rdfeed.h
@ -23,10 +23,12 @@
|
||||
|
||||
#include <qobject.h>
|
||||
|
||||
#include <rdapplication.h>
|
||||
#include <rdconfig.h>
|
||||
#include <rduser.h>
|
||||
#include <rdstation.h>
|
||||
#include <rdsettings.h>
|
||||
#include <rdstation.h>
|
||||
#include <rduser.h>
|
||||
#include <rdweb.h>
|
||||
|
||||
#define RDFEED_TOTAL_POST_STEPS 4
|
||||
|
||||
@ -44,6 +46,8 @@ class RDFeed : public QObject
|
||||
bool exists() const;
|
||||
bool isSuperfeed() const;
|
||||
void setIsSuperfeed(bool state) const;
|
||||
bool audienceMetrics() const;
|
||||
void setAudienceMetrics(bool state);
|
||||
QString channelTitle() const;
|
||||
void setChannelTitle(const QString &str) const;
|
||||
QString channelDescription() const;
|
||||
@ -74,6 +78,7 @@ class RDFeed : public QObject
|
||||
void setChannelXml(const QString &str);
|
||||
QString itemXml() const;
|
||||
void setItemXml(const QString &str);
|
||||
QString feedUrl() const;
|
||||
bool castOrder() const;
|
||||
void setCastOrder(bool state) const;
|
||||
int maxShelfLife() const;
|
||||
@ -108,12 +113,15 @@ class RDFeed : public QObject
|
||||
void setMediaLinkMode(RDFeed::MediaLinkMode mode) const;
|
||||
QString audioUrl(RDFeed::MediaLinkMode mode,const QString &cgi_hostname,
|
||||
unsigned cast_id);
|
||||
bool postXml(QString *err_msg);
|
||||
bool deleteXml(QString *err_msg);
|
||||
unsigned postCut(RDUser *user,RDStation *station,
|
||||
const QString &cutname,Error *err,bool log_debug,
|
||||
RDConfig *config);
|
||||
unsigned postFile(RDStation *station,const QString &srcfile,Error *err,
|
||||
bool log_debug,RDConfig *config);
|
||||
int totalPostSteps() const;
|
||||
QString rssXml(QString *err_msg,bool *ok=NULL);
|
||||
static unsigned create(const QString &keyname,bool enable_users,
|
||||
QString *err_msg,const QString &exemplar="");
|
||||
static QString errorString(RDFeed::Error err);
|
||||
@ -123,6 +131,8 @@ class RDFeed : public QObject
|
||||
|
||||
private:
|
||||
unsigned CreateCast(QString *filename,int bytes,int msecs) const;
|
||||
QString ResolveChannelWildcards(RDSqlQuery *chan_q);
|
||||
QString ResolveItemWildcards(RDSqlQuery *item_q,RDSqlQuery *chan_q);
|
||||
QString GetTempFilename() const;
|
||||
void SetRow(const QString ¶m,int value) const;
|
||||
void SetRow(const QString ¶m,const QString &value) const;
|
||||
@ -130,7 +140,12 @@ class RDFeed : public QObject
|
||||
const QString &format) const;
|
||||
QString feed_keyname;
|
||||
unsigned feed_id;
|
||||
QString feed_cgi_hostname;
|
||||
RDConfig *feed_config;
|
||||
QByteArray feed_xml;
|
||||
int feed_xml_ptr;
|
||||
friend size_t __RDFeed_Readfunction_Callback(char *buffer,size_t size,
|
||||
size_t nitems,void *userdata);
|
||||
};
|
||||
|
||||
|
||||
|
@ -25,10 +25,11 @@
|
||||
#include <qurl.h>
|
||||
|
||||
#include "rdapplication.h"
|
||||
#include "rddb.h"
|
||||
#include "rdpodcast.h"
|
||||
#include "rdconf.h"
|
||||
#include "rddb.h"
|
||||
#include "rddelete.h"
|
||||
#include "rdescape_string.h"
|
||||
#include "rdpodcast.h"
|
||||
#include "rdurl.h"
|
||||
|
||||
//
|
||||
@ -300,79 +301,21 @@ void RDPodcast::setStatus(RDPodcast::Status status)
|
||||
|
||||
bool RDPodcast::removeAudio(RDFeed *feed,QString *err_text,bool log_debug) const
|
||||
{
|
||||
CURL *curl=NULL;
|
||||
struct curl_slist *cmds=NULL;
|
||||
CURLcode err;
|
||||
QUrl *url;
|
||||
bool ret=true;
|
||||
QString currentdir;
|
||||
char urlstr[1024];
|
||||
char userpwd[256];
|
||||
|
||||
if((curl=curl_easy_init())==NULL) {
|
||||
rda->syslog(LOG_ERR,"unable to initialize curl library\n");
|
||||
RDDelete::ErrorCode conv_err;
|
||||
QUrl url(feed->purgeUrl()+"/"+audioFilename());
|
||||
RDDelete *conv=new RDDelete(rda->config());
|
||||
if(!conv->urlIsSupported(url)) {
|
||||
*err_text="unsupported url scheme";
|
||||
delete conv;
|
||||
return false;
|
||||
}
|
||||
url=new QUrl(feed->purgeUrl());
|
||||
strncpy(urlstr,(const char *)(url->protocol()+"://"+url->host()+"/").utf8(),
|
||||
1024);
|
||||
curl_easy_setopt(curl,CURLOPT_URL,urlstr);
|
||||
strncpy(userpwd,(feed->purgeUsername()+":"+feed->purgePassword()).utf8(),256);
|
||||
curl_easy_setopt(curl,CURLOPT_USERPWD,userpwd);
|
||||
curl_easy_setopt(curl,CURLOPT_HTTPAUTH,CURLAUTH_ANY);
|
||||
curl_easy_setopt(curl,CURLOPT_USERAGENT,
|
||||
(const char *)podcast_config->userAgent().utf8());
|
||||
if(log_debug) {
|
||||
curl_easy_setopt(curl,CURLOPT_VERBOSE,1);
|
||||
curl_easy_setopt(curl,CURLOPT_DEBUGFUNCTION,PodcastErrorCallback);
|
||||
}
|
||||
if(url->scheme()=="ftp") {
|
||||
currentdir="";
|
||||
if(!url->dirPath().right(url->dirPath().length()-1).isEmpty()) {
|
||||
currentdir=url->dirPath().right(url->dirPath().length()-1)+"/";
|
||||
}
|
||||
if(!url->fileName().isEmpty()) {
|
||||
currentdir+=url->fileName()+"/";
|
||||
}
|
||||
if(!currentdir.isEmpty()) {
|
||||
cmds=curl_slist_append(cmds,QString().sprintf("cwd %s",
|
||||
(const char *)currentdir));
|
||||
}
|
||||
cmds=curl_slist_append(cmds, QString().sprintf("dele %s",
|
||||
(const char *)audioFilename()));
|
||||
}
|
||||
if(url->scheme()=="sftp") {
|
||||
cmds=curl_slist_append(cmds,("rm "+url->path()+"/"+audioFilename()).toUtf8());
|
||||
}
|
||||
if(cmds==NULL) {
|
||||
if(err_text!=NULL) {
|
||||
*err_text="\""+url->scheme()+"\" scheme does not support remote deletion";
|
||||
delete url;
|
||||
curl_easy_cleanup(curl);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
curl_easy_setopt(curl,CURLOPT_QUOTE,cmds);
|
||||
switch((err=curl_easy_perform(curl))) {
|
||||
case CURLE_OK:
|
||||
#ifdef CURLE_QUOTE_ERROR
|
||||
case CURLE_QUOTE_ERROR: // In case the file is already gone
|
||||
#endif // CURLE_QUOTE_ERROR
|
||||
ret=true;
|
||||
break;
|
||||
conv->setTargetUrl(url);
|
||||
conv_err=conv->runDelete(feed->purgeUsername(),feed->purgePassword(),
|
||||
rda->config()->logXloadDebugData());
|
||||
*err_text=RDDelete::errorText(conv_err);
|
||||
delete conv;
|
||||
|
||||
default:
|
||||
ret=false;
|
||||
break;
|
||||
}
|
||||
if(err_text!=NULL) {
|
||||
*err_text=curl_easy_strerror(err);
|
||||
}
|
||||
curl_slist_free_all(cmds);
|
||||
curl_easy_cleanup(curl);
|
||||
delete url;
|
||||
|
||||
return ret;
|
||||
return conv_err==RDDelete::ErrorOk;
|
||||
}
|
||||
|
||||
|
||||
|
48
lib/rdtransfer.cpp
Normal file
48
lib/rdtransfer.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
// rdtransfer.cpp
|
||||
//
|
||||
// Abstract base class for Rivendell remote data tranfer methods
|
||||
//
|
||||
// (C) Copyright 2020 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
// published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public
|
||||
// License along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#include "rdtransfer.h"
|
||||
|
||||
RDTransfer::RDTransfer(RDConfig *c,QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
xfer_config=c;
|
||||
}
|
||||
|
||||
|
||||
bool RDTransfer::urlIsSupported(const QString &url)
|
||||
{
|
||||
return urlIsSupported(QUrl(url));
|
||||
}
|
||||
|
||||
|
||||
bool RDTransfer::urlIsSupported(const QUrl &url)
|
||||
{
|
||||
if(url.isRelative()||(!url.isValid())) {
|
||||
return false;
|
||||
}
|
||||
return supportedSchemes().contains(url.scheme());
|
||||
}
|
||||
|
||||
|
||||
RDConfig *RDTransfer::config() const
|
||||
{
|
||||
return xfer_config;
|
||||
}
|
47
lib/rdtransfer.h
Normal file
47
lib/rdtransfer.h
Normal file
@ -0,0 +1,47 @@
|
||||
// rdtransfer.h
|
||||
//
|
||||
// Abstract base class for Rivendell remote data tranfer methods
|
||||
//
|
||||
// (C) Copyright 2020 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
// published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public
|
||||
// License along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#ifndef RDTRANSFER_H
|
||||
#define RDTRANSFER_H
|
||||
|
||||
#include <qobject.h>
|
||||
#include <qstringlist.h>
|
||||
#include <qurl.h>
|
||||
|
||||
#include <rdconfig.h>
|
||||
|
||||
class RDTransfer : public QObject
|
||||
{
|
||||
Q_OBJECT;
|
||||
public:
|
||||
RDTransfer(RDConfig *c,QObject *parent=0);
|
||||
virtual QStringList supportedSchemes() const=0;
|
||||
bool urlIsSupported(const QString &url);
|
||||
bool urlIsSupported(const QUrl &url);
|
||||
|
||||
protected:
|
||||
RDConfig *config() const;
|
||||
|
||||
private:
|
||||
RDConfig *xfer_config;
|
||||
};
|
||||
|
||||
|
||||
#endif // RDTRANSFER_H
|
@ -70,6 +70,10 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent)
|
||||
connect(feed_is_superfeed_button,SIGNAL(clicked()),
|
||||
this,SLOT(selectSubfeedsData()));
|
||||
|
||||
feed_audience_metrics_check=new QCheckBox(this);
|
||||
feed_audience_metrics_label=new QLabel(tr("Collect Audience Metrics"),this);
|
||||
feed_audience_metrics_label->setFont(labelFont());
|
||||
feed_audience_metrics_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
|
||||
|
||||
//
|
||||
// Channel Section
|
||||
@ -374,6 +378,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent)
|
||||
//
|
||||
feed_keyname_edit->setText(feed_feed->keyName());
|
||||
feed_is_superfeed_box->setCurrentIndex(feed_feed->isSuperfeed());
|
||||
feed_audience_metrics_check->setChecked(feed_feed->audienceMetrics());
|
||||
feed_channel_title_edit->setText(feed_feed->channelTitle());
|
||||
feed_channel_category_edit->setText(feed_feed->channelCategory());
|
||||
feed_channel_link_edit->setText(feed_feed->channelLink());
|
||||
@ -420,7 +425,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent)
|
||||
|
||||
QSize EditFeed::sizeHint() const
|
||||
{
|
||||
return QSize(1000,621);
|
||||
return QSize(1000,643);
|
||||
}
|
||||
|
||||
|
||||
@ -439,6 +444,9 @@ void EditFeed::isSuperfeedChangedData(int n)
|
||||
feed_is_superfeed_box->setDisabled(redirected);
|
||||
feed_is_superfeed_button->setDisabled(redirected||(!superfeed));
|
||||
|
||||
feed_audience_metrics_check->setDisabled(redirected);
|
||||
feed_audience_metrics_label->setDisabled(redirected);
|
||||
|
||||
feed_channel_title_edit->setDisabled(redirected);
|
||||
feed_channel_description_edit->setDisabled(redirected);
|
||||
feed_channel_category_edit->setDisabled(redirected);
|
||||
@ -593,6 +601,7 @@ void EditFeed::okData()
|
||||
feed_feed->setRedirectPath("");
|
||||
}
|
||||
feed_feed->setIsSuperfeed(feed_is_superfeed_box->currentItem());
|
||||
feed_feed->setAudienceMetrics(feed_audience_metrics_check->isChecked());
|
||||
feed_feed->setChannelTitle(feed_channel_title_edit->text());
|
||||
feed_feed->setChannelCategory(feed_channel_category_edit->text());
|
||||
feed_feed->setChannelLink(feed_channel_link_edit->text());
|
||||
@ -648,75 +657,77 @@ void EditFeed::resizeEvent(QResizeEvent *e)
|
||||
feed_is_superfeed_label->setGeometry(10,33,100,19);
|
||||
feed_is_superfeed_button->setGeometry(185,33,160,38);
|
||||
|
||||
feed_channel_section_groupbox->setGeometry(10,75,sizeHint().width()/2-10,227);
|
||||
feed_channel_title_edit->setGeometry(115,90,375,19);
|
||||
feed_channel_title_label->setGeometry(20,90,90,19);
|
||||
feed_channel_category_edit->setGeometry(115,112,375,19);
|
||||
feed_channel_category_label->setGeometry(20,112,90,19);
|
||||
feed_channel_link_edit->setGeometry(115,134,375,19);
|
||||
feed_channel_link_label->setGeometry(20,134,90,19);
|
||||
feed_channel_copyright_edit->setGeometry(115,156,375,19);
|
||||
feed_channel_copyright_label->setGeometry(20,156,90,19);
|
||||
feed_channel_webmaster_edit->setGeometry(115,178,375,19);
|
||||
feed_channel_webmaster_label->setGeometry(20,178,90,19);
|
||||
feed_channel_language_edit->
|
||||
setGeometry(115,200,60,19);
|
||||
feed_channel_language_label->setGeometry(20,200,90,19);
|
||||
feed_channel_description_edit->setGeometry(115,222,375,76);
|
||||
feed_channel_description_label->setGeometry(20,222,90,19);
|
||||
feed_audience_metrics_check->setGeometry(20,74,15,15);
|
||||
feed_audience_metrics_label->setGeometry(40,72,375,19);
|
||||
|
||||
feed_purge_url_edit->setGeometry(155,310,335,19);
|
||||
feed_purge_url_label->setGeometry(20,310,130,19);
|
||||
feed_purge_username_edit->setGeometry(225,332,95,19);
|
||||
feed_purge_username_label->setGeometry(40,332,180,19);
|
||||
feed_purge_password_edit->setGeometry(395,332,95,19);
|
||||
feed_purge_password_label->setGeometry(320,332,70,19);
|
||||
feed_channel_section_groupbox->setGeometry(10,97,sizeHint().width()/2-10,227);
|
||||
feed_channel_title_edit->setGeometry(115,112,375,19);
|
||||
feed_channel_title_label->setGeometry(20,112,90,19);
|
||||
feed_channel_category_edit->setGeometry(115,134,375,19);
|
||||
feed_channel_category_label->setGeometry(20,134,90,19);
|
||||
feed_channel_link_edit->setGeometry(115,156,375,19);
|
||||
feed_channel_link_label->setGeometry(20,156,90,19);
|
||||
feed_channel_copyright_edit->setGeometry(115,178,375,19);
|
||||
feed_channel_copyright_label->setGeometry(20,178,90,19);
|
||||
feed_channel_webmaster_edit->setGeometry(115,200,375,19);
|
||||
feed_channel_webmaster_label->setGeometry(20,200,90,19);
|
||||
feed_channel_language_edit->setGeometry(115,222,60,19);
|
||||
feed_channel_language_label->setGeometry(20,222,90,19);
|
||||
feed_channel_description_edit->setGeometry(115,244,375,76);
|
||||
feed_channel_description_label->setGeometry(20,244,90,19);
|
||||
|
||||
feed_format_edit->setGeometry(155,354,285,20);
|
||||
feed_format_label->setGeometry(5,354,145,20);
|
||||
feed_format_button->setGeometry(450,354,40,24);
|
||||
feed_normalize_box->setGeometry(155,378,15,15);
|
||||
feed_normalize_check_label->setGeometry(175,376,83,20);
|
||||
feed_normalize_spin->setGeometry(295,376,40,20);
|
||||
feed_normalize_label->setGeometry(245,376,45,20);
|
||||
feed_normalize_unit_label->setGeometry(340,376,40,20);
|
||||
feed_purge_url_edit->setGeometry(155,332,335,19);
|
||||
feed_purge_url_label->setGeometry(20,332,130,19);
|
||||
feed_purge_username_edit->setGeometry(225,354,95,19);
|
||||
feed_purge_username_label->setGeometry(40,354,180,19);
|
||||
feed_purge_password_edit->setGeometry(395,354,95,19);
|
||||
feed_purge_password_label->setGeometry(320,354,70,19);
|
||||
|
||||
feed_base_url_edit->setGeometry(155,398,335,19);
|
||||
feed_base_url_label->setGeometry(5,398,145,19);
|
||||
feed_keep_metadata_box->setGeometry(155,420,15,15);
|
||||
feed_keep_metadata_label->setGeometry(175,420,180,19);
|
||||
feed_autopost_box->setGeometry(365,420,15,15);
|
||||
feed_autopost_label->setGeometry(385,420,200,19);
|
||||
feed_format_edit->setGeometry(155,376,285,20);
|
||||
feed_format_label->setGeometry(5,376,145,20);
|
||||
feed_format_button->setGeometry(450,376,40,24);
|
||||
feed_normalize_box->setGeometry(155,400,15,15);
|
||||
feed_normalize_check_label->setGeometry(175,398,83,20);
|
||||
feed_normalize_spin->setGeometry(295,398,40,20);
|
||||
feed_normalize_label->setGeometry(245,398,45,20);
|
||||
feed_normalize_unit_label->setGeometry(340,398,40,20);
|
||||
|
||||
feed_base_preamble_edit->setGeometry(155,442,335,19);
|
||||
feed_base_preamble_label->setGeometry(20,442,130,19);
|
||||
feed_base_url_edit->setGeometry(155,420,335,19);
|
||||
feed_base_url_label->setGeometry(5,420,145,19);
|
||||
feed_keep_metadata_box->setGeometry(155,442,15,15);
|
||||
feed_keep_metadata_label->setGeometry(175,442,180,19);
|
||||
feed_autopost_box->setGeometry(365,442,15,15);
|
||||
feed_autopost_label->setGeometry(385,442,200,19);
|
||||
|
||||
feed_extension_edit->setGeometry(155,464,70,19);
|
||||
feed_extension_label->setGeometry(20,464,130,19);
|
||||
feed_base_preamble_edit->setGeometry(155,464,335,19);
|
||||
feed_base_preamble_label->setGeometry(20,464,130,19);
|
||||
|
||||
feed_max_shelf_life_spin->setGeometry(155,486,60,19);
|
||||
feed_max_shelf_life_label->setGeometry(20,486,130,19);
|
||||
feed_max_shelf_life_unit_label->setGeometry(220,486,50,19);
|
||||
feed_extension_edit->setGeometry(155,486,70,19);
|
||||
feed_extension_label->setGeometry(20,486,130,19);
|
||||
|
||||
feed_castorder_box->setGeometry(155,508,100,19);
|
||||
feed_castorder_label->setGeometry(20,508,130,19);
|
||||
feed_max_shelf_life_spin->setGeometry(155,508,60,19);
|
||||
feed_max_shelf_life_label->setGeometry(20,508,130,19);
|
||||
feed_max_shelf_life_unit_label->setGeometry(220,508,50,19);
|
||||
|
||||
feed_media_link_mode_box->setGeometry(155,530,100,19);
|
||||
feed_media_link_mode_label->setGeometry(20,530,130,19);
|
||||
feed_castorder_box->setGeometry(155,530,100,19);
|
||||
feed_castorder_label->setGeometry(20,530,130,19);
|
||||
|
||||
feed_redirect_check->setGeometry(20,562,15,15);
|
||||
feed_redirect_label->setGeometry(40,562,200,19);
|
||||
feed_redirect_url_edit->setGeometry(85,582,405,20);
|
||||
feed_redirect_url_label->setGeometry(40,582,40,19);
|
||||
feed_media_link_mode_box->setGeometry(155,552,100,19);
|
||||
feed_media_link_mode_label->setGeometry(20,552,130,19);
|
||||
|
||||
feed_header_xml_edit->setGeometry(615,10,365,76);
|
||||
feed_redirect_check->setGeometry(20,584,15,15);
|
||||
feed_redirect_label->setGeometry(40,584,200,19);
|
||||
feed_redirect_url_edit->setGeometry(85,604,405,20);
|
||||
feed_redirect_url_label->setGeometry(40,604,40,19);
|
||||
|
||||
feed_header_xml_edit->setGeometry(615,10,size().width()-625,76);
|
||||
feed_header_xml_label->setGeometry(520,10,90,19);
|
||||
|
||||
feed_channel_xml_edit->setGeometry(615,88,365,176);
|
||||
feed_channel_xml_edit->setGeometry(615,88,size().width()-625,216);
|
||||
feed_channel_xml_label->setGeometry(520,88,90,19);
|
||||
|
||||
feed_item_xml_edit->setGeometry(615,270,365,250);
|
||||
feed_item_xml_label->setGeometry(520,270,90,19);
|
||||
feed_item_xml_edit->setGeometry(615,310,size().width()-625,240);
|
||||
feed_item_xml_label->setGeometry(520,310,90,19);
|
||||
|
||||
feed_ok_button->setGeometry(size().width()-180,size().height()-60,80,50);
|
||||
feed_cancel_button->setGeometry(size().width()-90,size().height()-60,80,50);
|
||||
|
@ -63,6 +63,8 @@ class EditFeed : public RDDialog
|
||||
QLineEdit *feed_keyname_edit;
|
||||
QLabel *feed_is_superfeed_label;
|
||||
QPushButton *feed_is_superfeed_button;
|
||||
QCheckBox *feed_audience_metrics_check;
|
||||
QLabel *feed_audience_metrics_label;
|
||||
QComboBox *feed_is_superfeed_box;
|
||||
QLineEdit *feed_channel_title_edit;
|
||||
QTextEdit *feed_channel_description_edit;
|
||||
|
@ -237,6 +237,17 @@ void ListFeeds::deleteData()
|
||||
}
|
||||
delete q;
|
||||
|
||||
//
|
||||
// Delete Remote XML
|
||||
//
|
||||
if(!feed->audienceMetrics()) {
|
||||
if(!feed->deleteXml(&errs)) {
|
||||
QMessageBox::warning(this,"RDAdmin - "+tr("Error"),
|
||||
tr("Failed to delete remote feed XML.")+
|
||||
"["+errs+"].");
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Delete Cast Entries
|
||||
//
|
||||
|
@ -1637,6 +1637,10 @@ Pořád ještě chcete povolit přesměrování?</translation>
|
||||
Feeds</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Collect Audience Metrics</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>EditFeedPerms</name>
|
||||
@ -5035,6 +5039,14 @@ Stále ještě jej chcete smazat?</translation>
|
||||
<source>Superfeed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Failed to delete remote feed XML.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ListGpis</name>
|
||||
|
@ -1532,6 +1532,10 @@ Do you still want to enable redireciton?</source>
|
||||
Feeds</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Collect Audience Metrics</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>EditFeedPerms</name>
|
||||
@ -4877,6 +4881,14 @@ Wollen Sie ihn immernoch löschen?</translation>
|
||||
<source>Superfeed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Failed to delete remote feed XML.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ListGpis</name>
|
||||
|
@ -1640,6 +1640,10 @@ al URL especificado.
|
||||
Feeds</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Collect Audience Metrics</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>EditFeedPerms</name>
|
||||
@ -5002,6 +5006,14 @@ Do you still want to delete it?</source>
|
||||
<source>Superfeed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Failed to delete remote feed XML.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ListGpis</name>
|
||||
|
@ -1204,6 +1204,10 @@ Do you still want to enable redireciton?</source>
|
||||
Feeds</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Collect Audience Metrics</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>EditFeedPerms</name>
|
||||
@ -4027,6 +4031,14 @@ Permissions</source>
|
||||
<source>Superfeed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Failed to delete remote feed XML.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ListGpis</name>
|
||||
|
@ -1494,6 +1494,10 @@ Do you still want to enable redireciton?</source>
|
||||
Feeds</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Collect Audience Metrics</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>EditFeedPerms</name>
|
||||
@ -4734,6 +4738,14 @@ Klikk på "Lisens"-knappen for fleire opplysningar.</translation>
|
||||
<source>Superfeed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Failed to delete remote feed XML.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ListGpis</name>
|
||||
|
@ -1494,6 +1494,10 @@ Do you still want to enable redireciton?</source>
|
||||
Feeds</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Collect Audience Metrics</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>EditFeedPerms</name>
|
||||
@ -4734,6 +4738,14 @@ Klikk på "Lisens"-knappen for fleire opplysningar.</translation>
|
||||
<source>Superfeed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Failed to delete remote feed XML.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ListGpis</name>
|
||||
|
@ -1504,6 +1504,10 @@ Do you still want to enable redireciton?</source>
|
||||
Feeds</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Collect Audience Metrics</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>EditFeedPerms</name>
|
||||
@ -4857,6 +4861,14 @@ Você ainda quer Deletar?</translation>
|
||||
<source>Superfeed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Failed to delete remote feed XML.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ListGpis</name>
|
||||
|
@ -409,6 +409,8 @@ void EditCast::reportData()
|
||||
|
||||
void EditCast::okData()
|
||||
{
|
||||
QString err_msg;
|
||||
|
||||
cast_cast->setItemTitle(cast_item_title_edit->text());
|
||||
cast_cast->setItemAuthor(cast_item_author_edit->text());
|
||||
cast_cast->setItemCategory(cast_item_category_edit->text());
|
||||
@ -445,6 +447,9 @@ void EditCast::okData()
|
||||
cast_feed->
|
||||
setLastBuildDateTime(RDLocalToUtc(QDateTime(QDate::currentDate(),
|
||||
QTime::currentTime())));
|
||||
|
||||
if(!cast_feed->postXml(&err_msg)) {
|
||||
}
|
||||
done(0);
|
||||
}
|
||||
|
||||
|
@ -224,7 +224,8 @@ void ListCasts::addCartData()
|
||||
unsigned cast_id=list_feed->postCut(rda->user(),rda->station(),cutname,&err,
|
||||
rda->config()->logXloadDebugData(),rda->config());
|
||||
if(err!=RDFeed::ErrorOk) {
|
||||
QMessageBox::warning(this,tr("Posting Error"),RDFeed::errorString(err));
|
||||
QMessageBox::warning(this,"RDCastManager - "+tr("Posting Error"),
|
||||
RDFeed::errorString(err));
|
||||
return;
|
||||
}
|
||||
EditCast *edit_cast=new EditCast(cast_id,this);
|
||||
@ -249,7 +250,8 @@ void ListCasts::addFileData()
|
||||
unsigned cast_id=list_feed->postFile(rda->station(),srcfile,&err,
|
||||
rda->config()->logXloadDebugData(),rda->config());
|
||||
if(err!=RDFeed::ErrorOk) {
|
||||
QMessageBox::warning(this,tr("Posting Error"),RDFeed::errorString(err));
|
||||
QMessageBox::warning(this,"RDCastManager - "+tr("Posting Error"),
|
||||
RDFeed::errorString(err));
|
||||
return;
|
||||
}
|
||||
EditCast *edit_cast=new EditCast(cast_id,this);
|
||||
@ -287,7 +289,7 @@ void ListCasts::deleteData()
|
||||
if(item==NULL) {
|
||||
return;
|
||||
}
|
||||
if(QMessageBox::question(this,tr("Delete Podcast"),
|
||||
if(QMessageBox::question(this,"RDCastManager - "+tr("Delete Podcast"),
|
||||
tr("Are you sure you want to delete this podcast?"),
|
||||
QMessageBox::Yes,QMessageBox::No)==
|
||||
QMessageBox::No) {
|
||||
@ -304,7 +306,7 @@ void ListCasts::deleteData()
|
||||
qApp->processEvents();
|
||||
RDPodcast *cast=new RDPodcast(rda->config(),item->id());
|
||||
if(!cast->removeAudio(list_feed,&err_text,rda->config()->logXloadDebugData())) {
|
||||
if(QMessageBox::warning(this,tr("Remote Error"),
|
||||
if(QMessageBox::warning(this,"RDCastManager - "+tr("Remote Error"),
|
||||
tr("Unable to delete remote audio!\n")+
|
||||
tr("The server said: \"")+err_text+"\".\n\n"+
|
||||
tr("Continue deleting cast?"),
|
||||
@ -324,6 +326,13 @@ void ListCasts::deleteData()
|
||||
q=new RDSqlQuery(sql);
|
||||
delete q;
|
||||
|
||||
if(!list_feed->audienceMetrics()) {
|
||||
if(!list_feed->postXml(&err_text)) {
|
||||
QMessageBox::warning(this,"RDCastManager - "+tr("Remote Error"),
|
||||
tr("Unable to update remote XML data!\n")+
|
||||
tr("The server said: \"")+err_text+"\".");
|
||||
}
|
||||
}
|
||||
RDDeleteCastCount(list_feed_id,item->id());
|
||||
|
||||
pd->reset();
|
||||
|
@ -292,6 +292,11 @@ Podcast trotzdem löschen?</translation>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to update remote XML data!
|
||||
</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MainWidget</name>
|
||||
|
@ -281,6 +281,11 @@ Podcast trotzdem löschen?</translation>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to update remote XML data!
|
||||
</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MainWidget</name>
|
||||
|
@ -232,6 +232,11 @@ Suscripción</translation>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to update remote XML data!
|
||||
</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MainWidget</name>
|
||||
|
@ -227,6 +227,11 @@ Car&t/Cut</source>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to update remote XML data!
|
||||
</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MainWidget</name>
|
||||
|
@ -280,6 +280,11 @@ Vil du halda fram med å sletta podkasten?</translation>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to update remote XML data!
|
||||
</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MainWidget</name>
|
||||
|
@ -280,6 +280,11 @@ Vil du halda fram med å sletta podkasten?</translation>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to update remote XML data!
|
||||
</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MainWidget</name>
|
||||
|
@ -246,6 +246,11 @@ Continuar deletando cast?</translation>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unable to update remote XML data!
|
||||
</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MainWidget</name>
|
||||
|
@ -24,6 +24,8 @@
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <q3url.h>
|
||||
|
||||
#include <qfileinfo.h>
|
||||
#include <qdatetime.h>
|
||||
|
||||
|
@ -34,6 +34,7 @@ noinst_PROGRAMS = audio_convert_test\
|
||||
datedecode_test\
|
||||
dateparse_test\
|
||||
db_charset_test\
|
||||
delete_test\
|
||||
download_test\
|
||||
getpids_test\
|
||||
log_unlink_test\
|
||||
@ -73,6 +74,9 @@ dateparse_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -l
|
||||
dist_db_charset_test_SOURCES = db_charset_test.cpp db_charset_test.h
|
||||
db_charset_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support
|
||||
|
||||
dist_delete_test_SOURCES = delete_test.cpp delete_test.h
|
||||
delete_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support
|
||||
|
||||
dist_download_test_SOURCES = download_test.cpp download_test.h
|
||||
download_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ @MUSICBRAINZ_LIBS@ -lQt3Support
|
||||
|
||||
|
112
tests/delete_test.cpp
Normal file
112
tests/delete_test.cpp
Normal file
@ -0,0 +1,112 @@
|
||||
// delete_test.cpp
|
||||
//
|
||||
// Test Rivendell file deletion routines.
|
||||
//
|
||||
// (C) Copyright 2010-2020 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
// published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public
|
||||
// License along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <qapplication.h>
|
||||
|
||||
#include <rdapplication.h>
|
||||
#include <rddb.h>
|
||||
#include <rddelete.h>
|
||||
|
||||
#include "delete_test.h"
|
||||
|
||||
MainObject::MainObject(QObject *parent)
|
||||
:QObject(parent)
|
||||
{
|
||||
QString err_msg;
|
||||
|
||||
username="";
|
||||
password="";
|
||||
RDDelete::ErrorCode conv_err;
|
||||
|
||||
//
|
||||
// Open the Database
|
||||
//
|
||||
rda=new RDApplication("delete_test","delete_test",DELETE_TEST_USAGE,this);
|
||||
if(!rda->open(&err_msg)) {
|
||||
fprintf(stderr,"delete_test: %s\n",(const char *)err_msg);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
//
|
||||
// Read Command Options
|
||||
//
|
||||
for(unsigned i=0;i<rda->cmdSwitch()->keys();i++) {
|
||||
if(rda->cmdSwitch()->key(i)=="--username") {
|
||||
username=rda->cmdSwitch()->value(i);
|
||||
rda->cmdSwitch()->setProcessed(i,true);
|
||||
}
|
||||
if(rda->cmdSwitch()->key(i)=="--password") {
|
||||
password=rda->cmdSwitch()->value(i);
|
||||
rda->cmdSwitch()->setProcessed(i,true);
|
||||
}
|
||||
if(rda->cmdSwitch()->key(i)=="--target-url") {
|
||||
target_url=QUrl(rda->cmdSwitch()->value(i));
|
||||
if(target_url.isRelative()) {
|
||||
fprintf(stderr,"delete_test: URL's must be fully qualified\n");
|
||||
exit(1);
|
||||
}
|
||||
if(!target_url.isValid()) {
|
||||
fprintf(stderr,"delete_test: invalid URL\n");
|
||||
exit(1);
|
||||
}
|
||||
rda->cmdSwitch()->setProcessed(i,true);
|
||||
}
|
||||
if(!rda->cmdSwitch()->processed(i)) {
|
||||
fprintf(stderr,"delete_test: unknown command option \"%s\"\n",
|
||||
(const char *)rda->cmdSwitch()->key(i));
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Sanity Checks
|
||||
//
|
||||
if(target_url.isEmpty()) {
|
||||
fprintf(stderr,"delete_test: missing --target-url\n");
|
||||
exit(256);
|
||||
}
|
||||
|
||||
//
|
||||
// Run the Test
|
||||
//
|
||||
RDDelete *conv=new RDDelete(rda->config(),this);
|
||||
if(!conv->urlIsSupported(target_url)) {
|
||||
fprintf(stderr,"delete_test: unsupported URL scheme\n");
|
||||
exit(1);
|
||||
}
|
||||
conv->setTargetUrl(target_url);
|
||||
printf("Deleting...\n");
|
||||
conv_err=conv->
|
||||
runDelete(username,password,rda->config()->logXloadDebugData());
|
||||
printf("Result: %s\n",(const char *)RDDelete::errorText(conv_err));
|
||||
delete conv;
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
QApplication a(argc,argv,false);
|
||||
new MainObject();
|
||||
return a.exec();
|
||||
}
|
43
tests/delete_test.h
Normal file
43
tests/delete_test.h
Normal file
@ -0,0 +1,43 @@
|
||||
// delete_test.h
|
||||
//
|
||||
// Test Rivendell remote file deletion routines.
|
||||
//
|
||||
// (C) Copyright 2010-2020 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
// published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public
|
||||
// License along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#ifndef DELETE_TEST_H
|
||||
#define DELETE_TEST_H
|
||||
|
||||
#include <list>
|
||||
|
||||
#include <qobject.h>
|
||||
#include <qurl.h>
|
||||
|
||||
#define DELETE_TEST_USAGE "[options]\n\nTest the Rivendell deletion routines\n\nOptions are:\n--username=<username>\n\n--password=<password>\n\n--target-url=<url>\n\n"
|
||||
|
||||
class MainObject : public QObject
|
||||
{
|
||||
public:
|
||||
MainObject(QObject *parent=0);
|
||||
|
||||
private:
|
||||
QString username;
|
||||
QString password;
|
||||
QUrl target_url;
|
||||
};
|
||||
|
||||
|
||||
#endif // DELETE_TEST_H
|
@ -40,6 +40,16 @@ bool MainObject::RevertSchema(int cur_schema,int set_schema,QString *err_msg)
|
||||
|
||||
// NEW SCHEMA REVERSIONS GO HERE...
|
||||
|
||||
|
||||
//
|
||||
// Revert 316
|
||||
//
|
||||
if((cur_schema==316)&&(set_schema<cur_schema)) {
|
||||
DropColumn("FEEDS","AUDIENCE_METRICS");
|
||||
|
||||
WriteSchemaVersion(--cur_schema);
|
||||
}
|
||||
|
||||
//
|
||||
// Revert 315
|
||||
//
|
||||
|
@ -159,7 +159,7 @@ void MainObject::InitializeSchemaMap() {
|
||||
global_version_map["3.0"]=308;
|
||||
global_version_map["3.1"]=310;
|
||||
global_version_map["3.2"]=311;
|
||||
global_version_map["3.3"]=315;
|
||||
global_version_map["3.3"]=316;
|
||||
}
|
||||
|
||||
|
||||
|
@ -9926,6 +9926,20 @@ bool MainObject::UpdateSchema(int cur_schema,int set_schema,QString *err_msg)
|
||||
WriteSchemaVersion(++cur_schema);
|
||||
}
|
||||
|
||||
if((cur_schema<316)&&(set_schema>cur_schema)) {
|
||||
sql=QString("alter table FEEDS add column ")+
|
||||
"AUDIENCE_METRICS enum('N','Y') default 'N' after IS_SUPERFEED";
|
||||
if(!RDSqlQuery::apply(sql,err_msg)) {
|
||||
return false;
|
||||
}
|
||||
sql=QString("update FEEDS set AUDIENCE_METRICS='Y'");
|
||||
if(!RDSqlQuery::apply(sql,err_msg)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
WriteSchemaVersion(++cur_schema);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// NEW SCHEMA UPDATES GO HERE...
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// An RSS Feed Generator for Rivendell.
|
||||
//
|
||||
// (C) Copyright 2002-2007,2016-2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2002-2020 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@ -48,7 +48,6 @@ MainObject::MainObject(QObject *parent)
|
||||
:QObject(parent)
|
||||
{
|
||||
QString err_msg;
|
||||
|
||||
char keyname[10];
|
||||
int cast_id=-1;
|
||||
bool count;
|
||||
@ -143,35 +142,13 @@ MainObject::MainObject(QObject *parent)
|
||||
|
||||
void MainObject::ServeRss(const char *keyname,bool count)
|
||||
{
|
||||
QString sql;
|
||||
RDSqlQuery *q;
|
||||
RDSqlQuery *q1;
|
||||
QString err_msg;
|
||||
bool ok=false;
|
||||
|
||||
sql=QString("select ")+
|
||||
"CHANNEL_TITLE,"+ // 00
|
||||
"CHANNEL_DESCRIPTION,"+ // 01
|
||||
"CHANNEL_CATEGORY,"+ // 02
|
||||
"CHANNEL_LINK,"+ // 03
|
||||
"CHANNEL_COPYRIGHT,"+ // 04
|
||||
"CHANNEL_WEBMASTER,"+ // 05
|
||||
"CHANNEL_LANGUAGE,"+ // 06
|
||||
"LAST_BUILD_DATETIME,"+ // 07
|
||||
"ORIGIN_DATETIME,"+ // 08
|
||||
"HEADER_XML,"+ // 09
|
||||
"CHANNEL_XML,"+ // 10
|
||||
"ITEM_XML,"+ // 11
|
||||
"BASE_URL,"+ // 12
|
||||
"ID,"+ // 13
|
||||
"UPLOAD_EXTENSION,"+ // 14
|
||||
"CAST_ORDER,"+ // 15
|
||||
"REDIRECT_PATH,"+ // 16
|
||||
"BASE_PREAMBLE "+ // 17
|
||||
"from FEEDS where "+
|
||||
"KEY_NAME=\""+RDEscapeString(keyname)+"\"";
|
||||
q=new RDSqlQuery(sql);
|
||||
if(!q->first()) {
|
||||
RDFeed *feed=new RDFeed(keyname,rda->config(),this);
|
||||
if(!feed->exists()) {
|
||||
printf("Content-type: text/html\n\n");
|
||||
printf("rdfeed: no feed matches the supplied key name\n");
|
||||
printf("no feed matches the supplied key name\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@ -185,9 +162,8 @@ void MainObject::ServeRss(const char *keyname,bool count)
|
||||
//
|
||||
// Redirect if necessary
|
||||
//
|
||||
if(!q->value(16).toString().isEmpty()) {
|
||||
Redirect(q->value(16).toString());
|
||||
delete q;
|
||||
if(!feed->redirectPath().isEmpty()) {
|
||||
Redirect(feed->redirectPath());
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@ -195,53 +171,17 @@ void MainObject::ServeRss(const char *keyname,bool count)
|
||||
// Generate CGI Header
|
||||
//
|
||||
printf("Content-type: application/rss+xml; charset=UTF-8\n\n");
|
||||
|
||||
//
|
||||
// Render Header XML
|
||||
//
|
||||
printf("%s\n",(const char *)q->value(9).toString().utf8());
|
||||
|
||||
//
|
||||
// Render Channel XML
|
||||
// Generate the XML
|
||||
//
|
||||
printf("<channel>\n");
|
||||
printf("%s\n",(const char *)ResolveChannelWildcards(q).utf8());
|
||||
|
||||
//
|
||||
// Render Item XML
|
||||
//
|
||||
sql=QString("select ")+
|
||||
"ITEM_TITLE,"+ // 00
|
||||
"ITEM_DESCRIPTION,"+ // 01
|
||||
"ITEM_CATEGORY,"+ // 02
|
||||
"ITEM_LINK,"+ // 03
|
||||
"ITEM_AUTHOR,"+ // 04
|
||||
"ITEM_SOURCE_TEXT,"+ // 05
|
||||
"ITEM_SOURCE_URL,"+ // 06
|
||||
"ITEM_COMMENTS,"+ // 07
|
||||
"AUDIO_FILENAME,"+ // 08
|
||||
"AUDIO_LENGTH,"+ // 09
|
||||
"AUDIO_TIME,"+ // 10
|
||||
"EFFECTIVE_DATETIME,"+ // 11
|
||||
"ID "+ // 12
|
||||
"from PODCASTS where "+
|
||||
QString().sprintf("(FEED_ID=%d)&&",q->value(13).toUInt())+
|
||||
QString().sprintf("(STATUS=%d) ",RDPodcast::StatusActive)+
|
||||
"order by ORIGIN_DATETIME";
|
||||
if(q->value(15).toString()=="N") {
|
||||
sql+=" desc";
|
||||
QString xml=feed->rssXml(&err_msg,&ok);
|
||||
if(!ok) {
|
||||
printf("Content-type: text/html\n\n");
|
||||
printf("%s\n",(const char *)err_msg.toUtf8());
|
||||
exit(0);
|
||||
}
|
||||
q1=new RDSqlQuery(sql);
|
||||
while(q1->next()) {
|
||||
printf("<item>\n");
|
||||
printf("%s\n",(const char *)ResolveItemWildcards(keyname,q1,q).utf8());
|
||||
printf("</item>\n");
|
||||
}
|
||||
delete q1;
|
||||
|
||||
printf("</channel>\n");
|
||||
printf("</rss>\n");
|
||||
delete q;
|
||||
printf("%s\r\n",(const char *)xml.toUtf8());
|
||||
|
||||
exit(0);
|
||||
}
|
||||
@ -276,63 +216,6 @@ void MainObject::ServeLink(const char *keyname,int cast_id,bool count)
|
||||
}
|
||||
|
||||
|
||||
QString MainObject::ResolveChannelWildcards(RDSqlQuery *chan_q)
|
||||
{
|
||||
QString ret=chan_q->value(10).toString();
|
||||
// ret.replace("%TITLE%",chan_q->value(0).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("Rivendell ")+VERSION);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
QString MainObject::ResolveItemWildcards(const QString &keyname,
|
||||
RDSqlQuery *item_q,RDSqlQuery *chan_q)
|
||||
{
|
||||
RDFeed *feed=new RDFeed(keyname,rda->config());
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
bool MainObject::ShouldCount(const QString &hdr)
|
||||
{
|
||||
bool ret=false;
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// An RSS Feed Generator for Rivendell.
|
||||
//
|
||||
// (C) Copyright 2002-2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2002-2020 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@ -35,9 +35,6 @@ class MainObject : public QObject
|
||||
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);
|
||||
bool ShouldCount(const QString &hdr);
|
||||
void Redirect(const QString &url);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user