2020-05-21 Fred Gleason <fredg@paravelsystems.com>

* Fixed bugs in the podcasting system that caused corrupt URLs
	to be generated for GUID and image tags for items contained in
	a superfeed.
	* Commented out file posting code in the web version of
	RDCastManager.
	* Disabled the 'Post from Cart/Cut', 'Post from File', 'Edit' and
	'Delete' buttons when showing a superfeed in the 'Podcast List'
	dialog of rdcastmanager(1).
This commit is contained in:
Fred Gleason 2020-05-21 16:29:59 -04:00
parent 491a08dfed
commit 69e253649e
5 changed files with 87 additions and 65 deletions

View File

@ -19984,3 +19984,12 @@
2020-05-21 Fred Gleason <fredg@paravelsystems.com> 2020-05-21 Fred Gleason <fredg@paravelsystems.com>
* Added a check to verify correct size of imported images in * Added a check to verify correct size of imported images in
'RDFeed::importImageFile()'. 'RDFeed::importImageFile()'.
2020-05-21 Fred Gleason <fredg@paravelsystems.com>
* Fixed bugs in the podcasting system that caused corrupt URLs
to be generated for GUID and image tags for items contained in
a superfeed.
* Commented out file posting code in the web version of
RDCastManager.
* Disabled the 'Post from Cart/Cut', 'Post from File', 'Edit' and
'Delete' buttons when showing a superfeed in the 'Podcast List'
dialog of rdcastmanager(1).

View File

@ -44,16 +44,6 @@
#include "rdupload.h" #include "rdupload.h"
#include "rdwavefile.h" #include "rdwavefile.h"
//
// Default XML Templates
//
/*
#define DEFAULT_HEADER_XML "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">"
#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<managingEditor>%EDITOR%</managingEditor>\n<webMaster>%WEBMASTER%</webMaster>\n<generator>%GENERATOR%</generator>\n<atom:link href=\"%FEED_URL%\" rel=\"self\" type=\"application/rss+xml\" />"
#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, size_t __RDFeed_Readfunction_Callback(char *buffer,size_t size,size_t nitems,
void *userdata) void *userdata)
{ {
@ -1116,6 +1106,12 @@ unsigned RDFeed::postCut(RDUser *user,RDStation *station,
emit postProgressChanged(3); emit postProgressChanged(3);
unlink(tmpfile); unlink(tmpfile);
delete upload; delete upload;
//
// Set default cast parameters
//
cast->setItemAuthor(user->emailContact());
cast->setItemImageId(defaultItemImageId());
delete cast; delete cast;
if(!audienceMetrics()) { if(!audienceMetrics()) {
@ -1129,8 +1125,9 @@ unsigned RDFeed::postCut(RDUser *user,RDStation *station,
} }
unsigned RDFeed::postFile(RDStation *station,const QString &srcfile,Error *err, unsigned RDFeed::postFile(RDUser *user,RDStation *station,
bool log_debug,RDConfig *config) const QString &srcfile,Error *err,bool log_debug,
RDConfig *config)
{ {
QString err_msg; QString err_msg;
QString sql; QString sql;
@ -1236,10 +1233,17 @@ unsigned RDFeed::postFile(RDStation *station,const QString &srcfile,Error *err,
return 0; return 0;
} }
delete upload; delete upload;
delete cast;
unlink(QString(tmpfile)+".wav"); unlink(QString(tmpfile)+".wav");
unlink(tmpfile); unlink(tmpfile);
//
// Set default cast parameters
//
cast->setItemAuthor(user->emailContact());
cast->setItemImageId(defaultItemImageId());
delete cast;
if(!audienceMetrics()) { if(!audienceMetrics()) {
emit postProgressChanged(4); emit postProgressChanged(4);
postXml(&err_msg); postXml(&err_msg);
@ -1357,26 +1361,27 @@ QString RDFeed::rssXml(QString *err_msg,bool *ok)
where =QString().sprintf("(PODCASTS.FEED_ID=%u)&&",q->value(18).toUInt()); where =QString().sprintf("(PODCASTS.FEED_ID=%u)&&",q->value(18).toUInt());
} }
sql=QString("select ")+ sql=QString("select ")+
"PODCASTS.ITEM_TITLE,"+ // 00 "PODCASTS.FEED_ID,"+ // 00
"PODCASTS.ITEM_DESCRIPTION,"+ // 01 "PODCASTS.ITEM_TITLE,"+ // 01
"PODCASTS.ITEM_CATEGORY,"+ // 02 "PODCASTS.ITEM_DESCRIPTION,"+ // 02
"PODCASTS.ITEM_LINK,"+ // 03 "PODCASTS.ITEM_CATEGORY,"+ // 03
"PODCASTS.ITEM_AUTHOR,"+ // 04 "PODCASTS.ITEM_LINK,"+ // 04
"PODCASTS.ITEM_SOURCE_TEXT,"+ // 05 "PODCASTS.ITEM_AUTHOR,"+ // 05
"PODCASTS.ITEM_SOURCE_URL,"+ // 06 "PODCASTS.ITEM_SOURCE_TEXT,"+ // 06
"PODCASTS.ITEM_COMMENTS,"+ // 07 "PODCASTS.ITEM_SOURCE_URL,"+ // 07
"PODCASTS.ITEM_EXPLICIT,"+ // 08 "PODCASTS.ITEM_COMMENTS,"+ // 08
"PODCASTS.AUDIO_FILENAME,"+ // 09 "PODCASTS.ITEM_EXPLICIT,"+ // 09
"PODCASTS.AUDIO_LENGTH,"+ // 10 "PODCASTS.AUDIO_FILENAME,"+ // 10
"PODCASTS.AUDIO_TIME,"+ // 11 "PODCASTS.AUDIO_LENGTH,"+ // 11
"PODCASTS.EFFECTIVE_DATETIME,"+ // 12 "PODCASTS.AUDIO_TIME,"+ // 12
"PODCASTS.ID,"+ // 13 "PODCASTS.EFFECTIVE_DATETIME,"+ // 13
"FEEDS.BASE_URL,"+ // 14 "PODCASTS.ID,"+ // 14
"FEED_IMAGES.ID,"+ // 15 "FEEDS.BASE_URL,"+ // 15
"FEED_IMAGES.WIDTH,"+ // 16 "FEED_IMAGES.ID,"+ // 16
"FEED_IMAGES.HEIGHT,"+ // 17 "FEED_IMAGES.WIDTH,"+ // 17
"FEED_IMAGES.DESCRIPTION,"+ // 18 "FEED_IMAGES.HEIGHT,"+ // 18
"FEED_IMAGES.FILE_EXTENSION "+ // 19 "FEED_IMAGES.DESCRIPTION,"+ // 19
"FEED_IMAGES.FILE_EXTENSION "+ // 20
"from PODCASTS left join FEEDS "+ "from PODCASTS left join FEEDS "+
"on PODCASTS.FEED_ID=FEEDS.ID "+ "on PODCASTS.FEED_ID=FEEDS.ID "+
"left join FEED_IMAGES "+ "left join FEED_IMAGES "+
@ -1770,57 +1775,57 @@ QString RDFeed::ResolveItemWildcards(const QString &tmplt,RDSqlQuery *item_q,
QString ret=" "+tmplt; QString ret=" "+tmplt;
ret.replace("\n","\r\n "); ret.replace("\n","\r\n ");
ret.replace("%ITEM_TITLE%",RDXmlEscape(item_q->value(0).toString())); ret.replace("%ITEM_TITLE%",RDXmlEscape(item_q->value(1).toString()));
ret.replace("%ITEM_DESCRIPTION%", ret.replace("%ITEM_DESCRIPTION%",
RDXmlEscape(item_q->value(1).toString()));
ret.replace("%ITEM_CATEGORY%",
RDXmlEscape(item_q->value(2).toString())); RDXmlEscape(item_q->value(2).toString()));
ret.replace("%ITEM_LINK%",RDXmlEscape(item_q->value(3).toString())); ret.replace("%ITEM_CATEGORY%",
ret.replace("%ITEM_AUTHOR%",RDXmlEscape(item_q->value(4).toString())); RDXmlEscape(item_q->value(3).toString()));
ret.replace("%ITEM_LINK%",RDXmlEscape(item_q->value(4).toString()));
ret.replace("%ITEM_AUTHOR%",RDXmlEscape(item_q->value(5).toString()));
if(chan_q->value(1).toString()=="Y") { // Audience Metrics if(chan_q->value(1).toString()=="Y") { // Audience Metrics
ret.replace("%ITEM_SOURCE_TEXT%", ret.replace("%ITEM_SOURCE_TEXT%",
RDXmlEscape(item_q->value(5).toString()));
ret.replace("%ITEM_SOURCE_URL%",
RDXmlEscape(item_q->value(6).toString())); RDXmlEscape(item_q->value(6).toString()));
ret.replace("%ITEM_SOURCE_URL%",
RDXmlEscape(item_q->value(7).toString()));
} }
else { else {
ret.replace("%ITEM_SOURCE_TEXT%", ret.replace("%ITEM_SOURCE_TEXT%",
RDXmlEscape(chan_q->value(0).toString())); RDXmlEscape(chan_q->value(0).toString()));
ret.replace("%ITEM_SOURCE_URL%", ret.replace("%ITEM_SOURCE_URL%",
RDXmlEscape(item_q->value(14).toString()+"/"+keyName())); RDXmlEscape(item_q->value(15).toString()+"/"+keyName()));
} }
ret.replace("%ITEM_COMMENTS%", ret.replace("%ITEM_COMMENTS%",
RDXmlEscape(item_q->value(7).toString())); RDXmlEscape(item_q->value(8).toString()));
QString explicit_str="false"; QString explicit_str="false";
if(item_q->value(8).toString()=="Y") { if(item_q->value(9).toString()=="Y") {
explicit_str="true"; explicit_str="true";
} }
ret.replace("%ITEM_EXPLICIT%",explicit_str); ret.replace("%ITEM_EXPLICIT%",explicit_str);
if(chan_q->value(23).toString()=="Y") { if(chan_q->value(23).toString()=="Y") {
ret.replace("%ITEM_AUDIO_URL%", ret.replace("%ITEM_AUDIO_URL%",
RDXmlEscape(audioUrl(RDFeed::LinkCounted,feed_cgi_hostname, RDXmlEscape(audioUrl(RDFeed::LinkCounted,feed_cgi_hostname,
item_q->value(13).toUInt()))); item_q->value(14).toUInt())));
} }
else { else {
ret.replace("%ITEM_AUDIO_URL%", ret.replace("%ITEM_AUDIO_URL%",
RDXmlEscape(audioUrl(RDFeed::LinkDirect,feed_cgi_hostname, RDXmlEscape(audioUrl(RDFeed::LinkDirect,feed_cgi_hostname,
item_q->value(13).toUInt()))); item_q->value(14).toUInt())));
} }
ret.replace("%ITEM_AUDIO_LENGTH%",item_q->value(10).toString()); ret.replace("%ITEM_AUDIO_LENGTH%",item_q->value(11).toString());
ret.replace("%ITEM_AUDIO_TIME%", ret.replace("%ITEM_AUDIO_TIME%",
RDGetTimeLength(item_q->value(11).toInt(),false,false)); RDGetTimeLength(item_q->value(12).toInt(),false,false));
ret.replace("%ITEM_AUDIO_SECONDS%", ret.replace("%ITEM_AUDIO_SECONDS%",
QString().sprintf("%d",item_q->value(11).toInt()/1000)); QString().sprintf("%d",item_q->value(12).toInt()/1000));
ret.replace("%ITEM_PUBLISH_DATE%",item_q->value(12).toDateTime(). ret.replace("%ITEM_PUBLISH_DATE%",item_q->value(13).toDateTime().
toString("ddd, d MMM yyyy hh:mm:ss ")+"GMT"); toString("ddd, d MMM yyyy hh:mm:ss ")+"GMT");
ret.replace("%ITEM_GUID%",RDPodcast::guid(chan_q->value(17).toString(), ret.replace("%ITEM_GUID%",RDPodcast::guid(item_q->value(15).toString(),
item_q->value(9).toString(), item_q->value(10).toString(),
chan_q->value(16).toUInt(), item_q->value(0).toUInt(),
item_q->value(13).toUInt())); item_q->value(14).toUInt()));
ret.replace("%ITEM_IMAGE_URL%",chan_q->value(17).toString()+"/"+ ret.replace("%ITEM_IMAGE_URL%",item_q->value(15).toString()+"/"+
RDFeed::imageFilename(chan_q->value(18).toInt(), RDFeed::imageFilename(item_q->value(0).toInt(),
item_q->value(15).toInt(), item_q->value(16).toInt(),
item_q->value(19).toString())); item_q->value(20).toString()));
return ret; return ret;
} }

View File

@ -145,8 +145,8 @@ class RDFeed : public QObject
unsigned postCut(RDUser *user,RDStation *station, unsigned postCut(RDUser *user,RDStation *station,
const QString &cutname,Error *err,bool log_debug, const QString &cutname,Error *err,bool log_debug,
RDConfig *config); RDConfig *config);
unsigned postFile(RDStation *station,const QString &srcfile,Error *err, unsigned postFile(RDUser *user,RDStation *station,const QString &srcfile,
bool log_debug,RDConfig *config); Error *err,bool log_debug,RDConfig *config);
int totalPostSteps() const; int totalPostSteps() const;
QString rssXml(QString *err_msg,bool *ok=NULL); QString rssXml(QString *err_msg,bool *ok=NULL);
RDRssSchemas *rssSchemas() const; RDRssSchemas *rssSchemas() const;

View File

@ -145,6 +145,7 @@ ListCasts::ListCasts(unsigned feed_id,bool is_super,QWidget *parent)
list_cart_button=new QPushButton(this); list_cart_button=new QPushButton(this);
list_cart_button->setFont(buttonFont()); list_cart_button->setFont(buttonFont());
list_cart_button->setText(tr("Post From\nCar&t/Cut")); list_cart_button->setText(tr("Post From\nCar&t/Cut"));
list_cart_button->setDisabled(list_feed->isSuperfeed());
connect(list_cart_button,SIGNAL(clicked()),this,SLOT(addCartData())); connect(list_cart_button,SIGNAL(clicked()),this,SLOT(addCartData()));
// //
@ -153,6 +154,7 @@ ListCasts::ListCasts(unsigned feed_id,bool is_super,QWidget *parent)
list_file_button=new QPushButton(this); list_file_button=new QPushButton(this);
list_file_button->setFont(buttonFont()); list_file_button->setFont(buttonFont());
list_file_button->setText(tr("Post From\n&File")); list_file_button->setText(tr("Post From\n&File"));
list_file_button->setDisabled(list_feed->isSuperfeed());
connect(list_file_button,SIGNAL(clicked()),this,SLOT(addFileData())); connect(list_file_button,SIGNAL(clicked()),this,SLOT(addFileData()));
// //
@ -253,7 +255,7 @@ void ListCasts::addFileData()
return; return;
} }
RDFeed::Error err; RDFeed::Error err;
unsigned cast_id=list_feed->postFile(rda->station(),srcfile,&err, unsigned cast_id=list_feed->postFile(rda->user(),rda->station(),srcfile,&err,
rda->config()->logXloadDebugData(),rda->config()); rda->config()->logXloadDebugData(),rda->config());
if(err!=RDFeed::ErrorOk) { if(err!=RDFeed::ErrorOk) {
QMessageBox::warning(this,"RDCastManager - "+tr("Posting Error"), QMessageBox::warning(this,"RDCastManager - "+tr("Posting Error"),
@ -366,10 +368,15 @@ void ListCasts::doubleClickedData(Q3ListViewItem *item,const QPoint &pt,
void ListCasts::userChangedData() void ListCasts::userChangedData()
{ {
list_cart_button->setEnabled(rda->user()->addPodcast()&&(list_encoder_id>=0)); bool is_superfeed=list_feed->isSuperfeed();
list_file_button->setEnabled(rda->user()->addPodcast()&&(list_encoder_id>=0));
list_edit_button->setEnabled(rda->user()->editPodcast()); list_cart_button->setEnabled(rda->user()->addPodcast()&&
list_delete_button->setEnabled(rda->user()->deletePodcast()); (list_encoder_id>=0)&&(!is_superfeed));
list_file_button->setEnabled(rda->user()->addPodcast()&&
(list_encoder_id>=0)&&(!is_superfeed));
list_edit_button->setEnabled(rda->user()->editPodcast()&&(!is_superfeed));
list_delete_button->
setEnabled(rda->user()->deletePodcast()&&(!is_superfeed));
} }

View File

@ -1569,6 +1569,7 @@ void MainObject::ServeSubscriptionReport()
void MainObject::PostEpisode() void MainObject::PostEpisode()
{ {
/*
QString media_file; QString media_file;
GetContext(); GetContext();
@ -1609,7 +1610,7 @@ void MainObject::PostEpisode()
Exit(0); Exit(0);
} }
ServeEditCast(cast_id); ServeEditCast(cast_id);
*/
Exit(0); Exit(0);
} }