mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-06-06 23:22:40 +02:00
2020-02-11 Fred Gleason <fredg@paravelsys tems.com>
* Added an 'RDFeed::create()' method. * Added a 'Base Feed On' dropdown to the 'Add RSS Feed' dialog in rdadmin(1).
This commit is contained in:
parent
b5c6e2e7a6
commit
be839cc414
@ -19553,3 +19553,7 @@
|
|||||||
* Added a 'Select Member Feeds' button to the 'Feed' dialog in
|
* Added a 'Select Member Feeds' button to the 'Feed' dialog in
|
||||||
rdadmin(1).
|
rdadmin(1).
|
||||||
* Added an 'RSS Superfeed' selection dialog to rdadmin(1).
|
* Added an 'RSS Superfeed' selection dialog to rdadmin(1).
|
||||||
|
2020-02-11 Fred Gleason <fredg@paravelsys tems.com>
|
||||||
|
* Added an 'RDFeed::create()' method.
|
||||||
|
* Added a 'Base Feed On' dropdown to the 'Add RSS Feed' dialog
|
||||||
|
in rdadmin(1).
|
||||||
|
199
lib/rdfeed.cpp
199
lib/rdfeed.cpp
@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// Abstract a Rivendell RSS Feed
|
// Abstract a Rivendell RSS Feed
|
||||||
//
|
//
|
||||||
// (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
|
// 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,23 +20,31 @@
|
|||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include <qfile.h>
|
|
||||||
#include <q3url.h>
|
|
||||||
#include <qapplication.h>
|
#include <qapplication.h>
|
||||||
|
#include <qfile.h>
|
||||||
|
#include <qurl.h>
|
||||||
|
|
||||||
#include <rddb.h>
|
#include "rdapplication.h"
|
||||||
#include <rdfeed.h>
|
#include "rdaudioconvert.h"
|
||||||
#include <rdconf.h>
|
#include "rdaudioexport.h"
|
||||||
#include <rdlibrary_conf.h>
|
#include "rdcart.h"
|
||||||
#include <rdescape_string.h>
|
#include "rdcut.h"
|
||||||
#include <rdwavefile.h>
|
#include "rdconf.h"
|
||||||
#include <rdpodcast.h>
|
#include "rddb.h"
|
||||||
#include <rdcart.h>
|
#include "rdescape_string.h"
|
||||||
#include <rdcut.h>
|
#include "rdfeed.h"
|
||||||
#include <rdaudioexport.h>
|
#include "rdlibrary_conf.h"
|
||||||
#include <rdaudioconvert.h>
|
#include "rdpodcast.h"
|
||||||
#include <rdtempdirectory.h>
|
#include "rdtempdirectory.h"
|
||||||
#include <rdupload.h>
|
#include "rdupload.h"
|
||||||
|
#include "rdwavefile.h"
|
||||||
|
|
||||||
|
//
|
||||||
|
// Default XML Templates
|
||||||
|
//
|
||||||
|
#define DEFAULT_HEADER_XML "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rss version=\"2.0\">"
|
||||||
|
#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>"
|
||||||
|
|
||||||
RDFeed::RDFeed(const QString &keyname,RDConfig *config,QObject *parent)
|
RDFeed::RDFeed(const QString &keyname,RDConfig *config,QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
@ -514,7 +522,7 @@ void RDFeed::setMediaLinkMode(RDFeed::MediaLinkMode mode) const
|
|||||||
QString RDFeed::audioUrl(RDFeed::MediaLinkMode mode,
|
QString RDFeed::audioUrl(RDFeed::MediaLinkMode mode,
|
||||||
const QString &cgi_hostname,unsigned cast_id)
|
const QString &cgi_hostname,unsigned cast_id)
|
||||||
{
|
{
|
||||||
Q3Url url(baseUrl());
|
QUrl url(baseUrl());
|
||||||
QString ret;
|
QString ret;
|
||||||
RDPodcast *cast;
|
RDPodcast *cast;
|
||||||
|
|
||||||
@ -769,6 +777,163 @@ int RDFeed::totalPostSteps() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unsigned RDFeed::create(const QString &keyname,bool enable_users,
|
||||||
|
QString *err_msg,const QString &exemplar)
|
||||||
|
{
|
||||||
|
QString sql;
|
||||||
|
RDSqlQuery *q;
|
||||||
|
RDSqlQuery *q1;
|
||||||
|
unsigned feed_id=0;
|
||||||
|
bool ok=false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Sanity Checks
|
||||||
|
//
|
||||||
|
sql=QString("select KEY_NAME from FEEDS where ")+
|
||||||
|
"KEY_NAME=\""+RDEscapeString(keyname)+"\"";
|
||||||
|
q=new RDSqlQuery(sql);
|
||||||
|
if(q->first()) {
|
||||||
|
*err_msg=tr("A feed with that key name already exists!");
|
||||||
|
delete q;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
delete q;
|
||||||
|
|
||||||
|
if(exemplar.isEmpty()) {
|
||||||
|
//
|
||||||
|
// Create Feed
|
||||||
|
//
|
||||||
|
sql=QString("insert into FEEDS set ")+
|
||||||
|
"KEY_NAME=\""+RDEscapeString(keyname)+"\","+
|
||||||
|
"ORIGIN_DATETIME=now(),"+
|
||||||
|
"HEADER_XML=\""+RDEscapeString(DEFAULT_HEADER_XML)+"\","+
|
||||||
|
"CHANNEL_XML=\""+RDEscapeString(DEFAULT_CHANNEL_XML)+"\","+
|
||||||
|
"ITEM_XML=\""+RDEscapeString(DEFAULT_ITEM_XML)+"\"";
|
||||||
|
q=new RDSqlQuery(sql);
|
||||||
|
feed_id=q->lastInsertId().toUInt();
|
||||||
|
delete q;
|
||||||
|
}
|
||||||
|
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
|
||||||
|
"from FEEDS where "+
|
||||||
|
"KEY_NAME=\""+RDEscapeString(exemplar)+"\"";
|
||||||
|
q=new RDSqlQuery(sql);
|
||||||
|
if(q->first()) {
|
||||||
|
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())+
|
||||||
|
"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());
|
||||||
|
feed_id=RDSqlQuery::run(sql,&ok).toUInt();
|
||||||
|
if(!ok) {
|
||||||
|
*err_msg=tr("Unable to insert new feed record!");
|
||||||
|
delete q;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Duplicate member feed references
|
||||||
|
//
|
||||||
|
if(q->value(0).toString()=="Y") {
|
||||||
|
sql=QString("select MEMBER_KEY_NAME ")+
|
||||||
|
"from FEED_KEY_NAMES where "+
|
||||||
|
"KEY_NAME=\""+RDEscapeString(exemplar)+"\"";
|
||||||
|
q1=new RDSqlQuery(sql);
|
||||||
|
while(q1->next()) {
|
||||||
|
sql=QString("insert into FEED_KEY_NAMES set ")+
|
||||||
|
"KEY_NAME=\""+RDEscapeString(keyname)+"\","+
|
||||||
|
"MEMBER_KEY_NAME=\""+RDEscapeString(q1->value(0).toString())+"\"";
|
||||||
|
RDSqlQuery::apply(sql);
|
||||||
|
}
|
||||||
|
delete q1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
*err_msg=tr("Exemplar feed")+" \""+exemplar+"\" "+tr("does not exist!");
|
||||||
|
delete q;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
delete q;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create Default Feed Perms
|
||||||
|
//
|
||||||
|
if(enable_users) {
|
||||||
|
sql=QString("select LOGIN_NAME from USERS where ")+
|
||||||
|
"(ADMIN_USERS_PRIV='N')&&(ADMIN_CONFIG_PRIV='N')";
|
||||||
|
q=new RDSqlQuery(sql);
|
||||||
|
while(q->next()) {
|
||||||
|
sql=QString("insert into FEED_PERMS set ")+
|
||||||
|
"USER_NAME=\""+RDEscapeString(q->value(0).toString())+"\","+
|
||||||
|
"KEY_NAME=\""+RDEscapeString(keyname)+"\"";
|
||||||
|
q1=new RDSqlQuery(sql);
|
||||||
|
delete q1;
|
||||||
|
}
|
||||||
|
delete q;
|
||||||
|
}
|
||||||
|
|
||||||
|
return feed_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QString RDFeed::errorString(RDFeed::Error err)
|
QString RDFeed::errorString(RDFeed::Error err)
|
||||||
{
|
{
|
||||||
QString ret="Unknown Error";
|
QString ret="Unknown Error";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// Abstract a Rivendell RSS Feed
|
// Abstract a Rivendell RSS Feed
|
||||||
//
|
//
|
||||||
// (C) Copyright 2002-2007,2016 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
|
// 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
|
||||||
@ -21,7 +21,6 @@
|
|||||||
#ifndef RDFEED_H
|
#ifndef RDFEED_H
|
||||||
#define RDFEED_H
|
#define RDFEED_H
|
||||||
|
|
||||||
#include <qsqldatabase.h>
|
|
||||||
#include <qobject.h>
|
#include <qobject.h>
|
||||||
|
|
||||||
#include <rdconfig.h>
|
#include <rdconfig.h>
|
||||||
@ -115,6 +114,8 @@ class RDFeed : public QObject
|
|||||||
unsigned postFile(RDStation *station,const QString &srcfile,Error *err,
|
unsigned postFile(RDStation *station,const QString &srcfile,Error *err,
|
||||||
bool log_debug,RDConfig *config);
|
bool log_debug,RDConfig *config);
|
||||||
int totalPostSteps() const;
|
int totalPostSteps() const;
|
||||||
|
static unsigned create(const QString &keyname,bool enable_users,
|
||||||
|
QString *err_msg,const QString &exemplar="");
|
||||||
static QString errorString(RDFeed::Error err);
|
static QString errorString(RDFeed::Error err);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
|
|
||||||
#include <qdialog.h>
|
#include <qdialog.h>
|
||||||
#include <qstring.h>
|
#include <qstring.h>
|
||||||
#include <qpushbutton.h>
|
|
||||||
#include <qlabel.h>
|
|
||||||
#include <qmessagebox.h>
|
#include <qmessagebox.h>
|
||||||
#include <qdatetime.h>
|
#include <qdatetime.h>
|
||||||
|
|
||||||
@ -44,23 +42,11 @@ AddFeed::AddFeed(unsigned *id,QString *keyname,QWidget *parent)
|
|||||||
//
|
//
|
||||||
// Fix the Window Size
|
// Fix the Window Size
|
||||||
//
|
//
|
||||||
setMinimumWidth(sizeHint().width());
|
setMinimumSize(sizeHint());
|
||||||
setMaximumWidth(sizeHint().width());
|
setMaximumSize(sizeHint());
|
||||||
setMinimumHeight(sizeHint().height());
|
|
||||||
setMaximumHeight(sizeHint().height());
|
|
||||||
|
|
||||||
setWindowTitle("RDADmin - "+tr("Add RSS Feed"));
|
setWindowTitle("RDADmin - "+tr("Add RSS Feed"));
|
||||||
|
|
||||||
//
|
|
||||||
// Enable Users Checkbox
|
|
||||||
//
|
|
||||||
feed_users_box=new QCheckBox(this);
|
|
||||||
feed_users_box->setGeometry(40,40,15,15);
|
|
||||||
feed_users_box->setChecked(true);
|
|
||||||
QLabel *label=new QLabel(feed_users_box,tr("Enable Feed for All Users"),this);
|
|
||||||
label->setGeometry(60,38,sizeHint().width()-60,19);
|
|
||||||
label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Text Validator
|
// Text Validator
|
||||||
//
|
//
|
||||||
@ -70,33 +56,54 @@ AddFeed::AddFeed(unsigned *id,QString *keyname,QWidget *parent)
|
|||||||
// Feed Name
|
// Feed Name
|
||||||
//
|
//
|
||||||
feed_keyname_edit=new QLineEdit(this);
|
feed_keyname_edit=new QLineEdit(this);
|
||||||
feed_keyname_edit->setGeometry(145,11,sizeHint().width()-150,19);
|
|
||||||
feed_keyname_edit->setMaxLength(8);
|
feed_keyname_edit->setMaxLength(8);
|
||||||
feed_keyname_edit->setValidator(validator);
|
feed_keyname_edit->setValidator(validator);
|
||||||
label=new QLabel(feed_keyname_edit,tr("&New Feed Name:"),this);
|
feed_keyname_label=new QLabel(feed_keyname_edit,tr("&New Feed Name:"),this);
|
||||||
label->setGeometry(10,11,130,19);
|
feed_keyname_label->setFont(labelFont());
|
||||||
label->setFont(labelFont());
|
feed_keyname_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||||
label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
|
||||||
|
//
|
||||||
|
// Exemplar
|
||||||
|
//
|
||||||
|
feed_exemplar_box=new QComboBox(this);
|
||||||
|
feed_exemplar_box->insertItem(0,tr("Empty Feed Config"));
|
||||||
|
QString sql=QString("select KEY_NAME from FEEDS order by KEY_NAME");
|
||||||
|
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||||
|
while(q->next()) {
|
||||||
|
feed_exemplar_box->
|
||||||
|
insertItem(feed_exemplar_box->count(),q->value(0).toString());
|
||||||
|
}
|
||||||
|
delete q;
|
||||||
|
feed_exemplar_label=
|
||||||
|
new QLabel(feed_exemplar_box,tr("Base Feed On")+": ",this);
|
||||||
|
feed_exemplar_label->setFont(labelFont());
|
||||||
|
feed_exemplar_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Enable Users Checkbox
|
||||||
|
//
|
||||||
|
feed_users_box=new QCheckBox(this);
|
||||||
|
feed_users_box->setChecked(true);
|
||||||
|
feed_users_label=
|
||||||
|
new QLabel(feed_users_box,tr("Enable Feed for All Users"),this);
|
||||||
|
feed_users_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Ok Button
|
// Ok Button
|
||||||
//
|
//
|
||||||
QPushButton *ok_button=new QPushButton(this);
|
feed_ok_button=new QPushButton(this);
|
||||||
ok_button->setGeometry(sizeHint().width()-180,sizeHint().height()-60,80,50);
|
feed_ok_button->setDefault(true);
|
||||||
ok_button->setDefault(true);
|
feed_ok_button->setFont(buttonFont());
|
||||||
ok_button->setFont(buttonFont());
|
feed_ok_button->setText(tr("&OK"));
|
||||||
ok_button->setText(tr("&OK"));
|
connect(feed_ok_button,SIGNAL(clicked()),this,SLOT(okData()));
|
||||||
connect(ok_button,SIGNAL(clicked()),this,SLOT(okData()));
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cancel Button
|
// Cancel Button
|
||||||
//
|
//
|
||||||
QPushButton *cancel_button=new QPushButton(this);
|
feed_cancel_button=new QPushButton(this);
|
||||||
cancel_button->setGeometry(sizeHint().width()-90,sizeHint().height()-60,
|
feed_cancel_button->setFont(buttonFont());
|
||||||
80,50);
|
feed_cancel_button->setText(tr("&Cancel"));
|
||||||
cancel_button->setFont(buttonFont());
|
connect(feed_cancel_button,SIGNAL(clicked()),this,SLOT(cancelData()));
|
||||||
cancel_button->setText(tr("&Cancel"));
|
|
||||||
connect(cancel_button,SIGNAL(clicked()),this,SLOT(cancelData()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -108,7 +115,7 @@ AddFeed::~AddFeed()
|
|||||||
|
|
||||||
QSize AddFeed::sizeHint() const
|
QSize AddFeed::sizeHint() const
|
||||||
{
|
{
|
||||||
return QSize(250,124);
|
return QSize(290,153);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -120,58 +127,21 @@ QSizePolicy AddFeed::sizePolicy() const
|
|||||||
|
|
||||||
void AddFeed::okData()
|
void AddFeed::okData()
|
||||||
{
|
{
|
||||||
QString sql;
|
QString err_msg;
|
||||||
RDSqlQuery *q;
|
QString exemplar="";
|
||||||
RDSqlQuery *q1;
|
|
||||||
|
|
||||||
sql=QString("select KEY_NAME from FEEDS where ")+
|
if(feed_exemplar_box->currentIndex()!=0) {
|
||||||
"KEY_NAME=\""+RDEscapeString(feed_keyname_edit->text())+"\"";
|
exemplar=feed_exemplar_box->currentText();
|
||||||
q=new RDSqlQuery(sql);
|
|
||||||
if(q->first()) {
|
|
||||||
QMessageBox::warning(this,tr("Add Feed Error"),
|
|
||||||
tr("A feed with that key name already exists!"));
|
|
||||||
delete q;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
delete q;
|
*feed_id=RDFeed::create(feed_keyname_edit->text(),feed_users_box->isChecked(),
|
||||||
|
&err_msg,exemplar);
|
||||||
//
|
if(*feed_id!=0) {
|
||||||
// Create Default Feed Perms
|
*feed_keyname=feed_keyname_edit->text();
|
||||||
//
|
done(0);
|
||||||
if(feed_users_box->isChecked()) {
|
|
||||||
sql=QString("select LOGIN_NAME from USERS where ")+
|
|
||||||
"(ADMIN_USERS_PRIV='N')&&(ADMIN_CONFIG_PRIV='N')";
|
|
||||||
q=new RDSqlQuery(sql);
|
|
||||||
while(q->next()) {
|
|
||||||
sql=QString("insert into FEED_PERMS set ")+
|
|
||||||
"USER_NAME=\""+RDEscapeString(q->value(0).toString())+"\","+
|
|
||||||
"KEY_NAME=\""+RDEscapeString(feed_keyname_edit->text())+"\"";
|
|
||||||
q1=new RDSqlQuery(sql);
|
|
||||||
delete q1;
|
|
||||||
}
|
|
||||||
delete q;
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
//
|
QMessageBox::warning(this,"RDAdmin - "+tr("Add Feed Error"),err_msg);
|
||||||
// Create Feed
|
|
||||||
//
|
|
||||||
sql=QString("insert into FEEDS set ")+
|
|
||||||
"KEY_NAME=\""+RDEscapeString(feed_keyname_edit->text())+"\","+
|
|
||||||
"ORIGIN_DATETIME=now(),"+
|
|
||||||
"HEADER_XML=\""+RDEscapeString(DEFAULT_HEADER_XML)+"\","+
|
|
||||||
"CHANNEL_XML=\""+RDEscapeString(DEFAULT_CHANNEL_XML)+"\","+
|
|
||||||
"ITEM_XML=\""+RDEscapeString(DEFAULT_ITEM_XML)+"\"";
|
|
||||||
q=new RDSqlQuery(sql);
|
|
||||||
delete q;
|
|
||||||
sql=QString("select ID from FEEDS where ")+
|
|
||||||
"KEY_NAME=\""+RDEscapeString(feed_keyname_edit->text())+"\"";
|
|
||||||
q=new RDSqlQuery(sql);
|
|
||||||
if(q->first()) {
|
|
||||||
*feed_id=q->value(0).toUInt();
|
|
||||||
}
|
}
|
||||||
delete q;
|
|
||||||
*feed_keyname=feed_keyname_edit->text();
|
|
||||||
done(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -179,3 +149,19 @@ void AddFeed::cancelData()
|
|||||||
{
|
{
|
||||||
done(-1);
|
done(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AddFeed::resizeEvent(QResizeEvent *e)
|
||||||
|
{
|
||||||
|
feed_keyname_label->setGeometry(10,11,120,19);
|
||||||
|
feed_keyname_edit->setGeometry(135,11,sizeHint().width()-140,19);
|
||||||
|
|
||||||
|
feed_exemplar_label->setGeometry(10,35,120,19);
|
||||||
|
feed_exemplar_box->setGeometry(135,35,sizeHint().width()-140,19);
|
||||||
|
|
||||||
|
feed_users_box->setGeometry(40,65,15,15);
|
||||||
|
feed_users_label->setGeometry(60,63,sizeHint().width()-60,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);
|
||||||
|
}
|
||||||
|
@ -22,33 +22,38 @@
|
|||||||
#define ADD_FEED_H
|
#define ADD_FEED_H
|
||||||
|
|
||||||
#include <qcheckbox.h>
|
#include <qcheckbox.h>
|
||||||
|
#include <qcombobox.h>
|
||||||
#include <qlineedit.h>
|
#include <qlineedit.h>
|
||||||
|
#include <qlabel.h>
|
||||||
|
#include <qpushbutton.h>
|
||||||
|
|
||||||
#include <rddialog.h>
|
#include <rddialog.h>
|
||||||
|
|
||||||
//
|
|
||||||
// Default XML Templates
|
|
||||||
//
|
|
||||||
#define DEFAULT_HEADER_XML "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rss version=\"2.0\">"
|
|
||||||
#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>"
|
|
||||||
|
|
||||||
class AddFeed : public RDDialog
|
class AddFeed : public RDDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
AddFeed(unsigned *id,QString *keyname,QWidget *parent=0);
|
AddFeed(unsigned *id,QString *keyname,QWidget *parent=0);
|
||||||
~AddFeed();
|
~AddFeed();
|
||||||
QSize sizeHint() const;
|
QSize sizeHint() const;
|
||||||
QSizePolicy sizePolicy() const;
|
QSizePolicy sizePolicy() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void okData();
|
void okData();
|
||||||
void cancelData();
|
void cancelData();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void resizeEvent(QResizeEvent *e);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QCheckBox *feed_users_box;
|
QLabel *feed_keyname_label;
|
||||||
QLineEdit *feed_keyname_edit;
|
QLineEdit *feed_keyname_edit;
|
||||||
|
QLabel *feed_exemplar_label;
|
||||||
|
QComboBox *feed_exemplar_box;
|
||||||
|
QCheckBox *feed_users_box;
|
||||||
|
QLabel *feed_users_label;
|
||||||
|
QPushButton *feed_ok_button;
|
||||||
|
QPushButton *feed_cancel_button;
|
||||||
QString *feed_keyname;
|
QString *feed_keyname;
|
||||||
unsigned *feed_id;
|
unsigned *feed_id;
|
||||||
};
|
};
|
||||||
|
@ -22,9 +22,10 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <qapplication.h>
|
||||||
#include <qlabel.h>
|
#include <qlabel.h>
|
||||||
#include <qmessagebox.h>
|
#include <qmessagebox.h>
|
||||||
#include <qapplication.h>
|
#include <qprogressdialog.h>
|
||||||
|
|
||||||
#include <rdapplication.h>
|
#include <rdapplication.h>
|
||||||
#include <rddb.h>
|
#include <rddb.h>
|
||||||
@ -220,15 +221,15 @@ void ListFeeds::deleteData()
|
|||||||
RDPodcast *cast;
|
RDPodcast *cast;
|
||||||
sql=QString().sprintf("select ID from PODCASTS where FEED_ID=%d",item->id());
|
sql=QString().sprintf("select ID from PODCASTS where FEED_ID=%d",item->id());
|
||||||
q=new RDSqlQuery(sql);
|
q=new RDSqlQuery(sql);
|
||||||
Q3ProgressDialog *pd=
|
QProgressDialog *pd=new QProgressDialog(tr("Deleting Audio..."),
|
||||||
new Q3ProgressDialog(tr("Deleting Audio..."),tr("Cancel"),q->size()+1,this,
|
tr("Cancel"),0,q->size()+1,this);
|
||||||
NULL);
|
|
||||||
pd->setCaption(tr("Deleting"));
|
pd->setCaption(tr("Deleting"));
|
||||||
pd->setProgress(0);
|
pd->setValue(0);
|
||||||
|
pd->show();
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
sleep(1);
|
sleep(1);
|
||||||
while(q->next()) {
|
while(q->next()) {
|
||||||
pd->setProgress(pd->progress()+1);
|
pd->setValue(pd->value()+1);
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
cast=new RDPodcast(rda->config(),q->value(0).toUInt());
|
cast=new RDPodcast(rda->config(),q->value(0).toUInt());
|
||||||
cast->removeAudio(feed,&errs,rda->config()->logXloadDebugData());
|
cast->removeAudio(feed,&errs,rda->config()->logXloadDebugData());
|
||||||
|
@ -236,16 +236,24 @@ a záloha původní databáze uložena v </translation>
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Add Feed Error</source>
|
<source>Add Feed Error</source>
|
||||||
<translation>Chyba při přidávání přívodu</translation>
|
<translation type="unfinished">Chyba při přidávání přívodu</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>A feed with that key name already exists!</source>
|
<source>A feed with that key name already exists!</source>
|
||||||
<translation>Přívod s tímto názvem klíče již existuje!</translation>
|
<translation type="obsolete">Přívod s tímto názvem klíče již existuje!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Add RSS Feed</source>
|
<source>Add RSS Feed</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Empty Feed Config</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Base Feed On</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>AddGroup</name>
|
<name>AddGroup</name>
|
||||||
|
@ -168,18 +168,22 @@ worden. Aktuelle Version</translation>
|
|||||||
<source>&Cancel</source>
|
<source>&Cancel</source>
|
||||||
<translation type="unfinished">Abbre&chen</translation>
|
<translation type="unfinished">Abbre&chen</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Add Feed Error</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>A feed with that key name already exists!</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Add RSS Feed</source>
|
<source>Add RSS Feed</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Empty Feed Config</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Base Feed On</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Add Feed Error</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>AddGroup</name>
|
<name>AddGroup</name>
|
||||||
|
@ -245,16 +245,24 @@ y un respaldo de la base de datos se guardó en </translation>
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Add Feed Error</source>
|
<source>Add Feed Error</source>
|
||||||
<translation>Error añadiendo feed</translation>
|
<translation type="unfinished">Error añadiendo feed</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>A feed with that key name already exists!</source>
|
<source>A feed with that key name already exists!</source>
|
||||||
<translation>¡Un feed con ese nombre ya existe!</translation>
|
<translation type="obsolete">¡Un feed con ese nombre ya existe!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Add RSS Feed</source>
|
<source>Add RSS Feed</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Empty Feed Config</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Base Feed On</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>AddGroup</name>
|
<name>AddGroup</name>
|
||||||
|
@ -19,18 +19,22 @@
|
|||||||
<source>&Cancel</source>
|
<source>&Cancel</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Add Feed Error</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>A feed with that key name already exists!</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Add RSS Feed</source>
|
<source>Add RSS Feed</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Empty Feed Config</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Base Feed On</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Add Feed Error</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>AddGroup</name>
|
<name>AddGroup</name>
|
||||||
|
@ -158,18 +158,22 @@ oppdatert til versjon </translation>
|
|||||||
<source>&Cancel</source>
|
<source>&Cancel</source>
|
||||||
<translation type="unfinished">&Avbryt</translation>
|
<translation type="unfinished">&Avbryt</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Add Feed Error</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>A feed with that key name already exists!</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Add RSS Feed</source>
|
<source>Add RSS Feed</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Empty Feed Config</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Base Feed On</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Add Feed Error</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>AddGroup</name>
|
<name>AddGroup</name>
|
||||||
|
@ -158,18 +158,22 @@ oppdatert til versjon </translation>
|
|||||||
<source>&Cancel</source>
|
<source>&Cancel</source>
|
||||||
<translation type="unfinished">&Avbryt</translation>
|
<translation type="unfinished">&Avbryt</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Add Feed Error</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>A feed with that key name already exists!</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Add RSS Feed</source>
|
<source>Add RSS Feed</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Empty Feed Config</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Base Feed On</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Add Feed Error</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>AddGroup</name>
|
<name>AddGroup</name>
|
||||||
|
@ -151,18 +151,22 @@ atualizada para a Versão</translation>
|
|||||||
<source>&Cancel</source>
|
<source>&Cancel</source>
|
||||||
<translation type="unfinished">&Cancelar</translation>
|
<translation type="unfinished">&Cancelar</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Add Feed Error</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>A feed with that key name already exists!</source>
|
|
||||||
<translation type="unfinished"></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Add RSS Feed</source>
|
<source>Add RSS Feed</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Empty Feed Config</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Base Feed On</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Add Feed Error</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>AddGroup</name>
|
<name>AddGroup</name>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user