2023-02-15 Fred Gleason <fredg@paravelsystems.com>

* Modified the podcasting system to sort items in the XML feed
	on the basis of the 'Air Date/Time' rather than the 'Posted By'
	datetime.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2023-02-15 12:33:46 -05:00
parent d03c054b4c
commit d9e7fde1a7
4 changed files with 19 additions and 11 deletions

View File

@ -23978,3 +23978,7 @@
rdcastmanager(1). rdcastmanager(1).
2023-02-06 Fred Gleason <fredg@paravelsystems.com> 2023-02-06 Fred Gleason <fredg@paravelsystems.com>
* Incremented the package version to 4.0.0rc1int1. * Incremented the package version to 4.0.0rc1int1.
2023-02-15 Fred Gleason <fredg@paravelsystems.com>
* Modified the podcasting system to sort items in the XML feed
on the basis of the 'Air Date/Time' rather than the 'Posted By'
datetime.

View File

@ -2,7 +2,7 @@
// //
// Abstract a Rivendell RSS Feed // Abstract a Rivendell RSS Feed
// //
// (C) Copyright 2002-2022 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2002-2023 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
@ -541,14 +541,14 @@ QString RDFeed::feedUrl() const
} }
bool RDFeed::castOrder() const bool RDFeed::castOrderIsAscending() const
{ {
return RDBool(RDGetSqlValue("FEEDS","KEY_NAME",feed_keyname, return RDBool(RDGetSqlValue("FEEDS","KEY_NAME",feed_keyname,
"CAST_ORDER").toString()); "CAST_ORDER").toString());
} }
void RDFeed::setCastOrder(bool state) const void RDFeed::setCastOrderIsAscending(bool state) const
{ {
SetRow("CAST_ORDER",RDYesNo(state)); SetRow("CAST_ORDER",RDYesNo(state));
} }
@ -1637,10 +1637,15 @@ QString RDFeed::rssXml(QString *err_msg,const QDateTime &now,bool *ok)
RDSqlQuery *chan_q; RDSqlQuery *chan_q;
RDSqlQuery *item_q; RDSqlQuery *item_q;
RDSqlQuery *q; RDSqlQuery *q;
QString item_order_sql="order by `PODCASTS`.`EFFECTIVE_DATETIME` desc ";
if(ok!=NULL) { if(ok!=NULL) {
*ok=false; *ok=false;
} }
//
// Channel Attributes
//
sql=QString("select ")+ sql=QString("select ")+
"`FEEDS`.`CHANNEL_TITLE`,"+ // 00 "`FEEDS`.`CHANNEL_TITLE`,"+ // 00
"`FEEDS`.`CHANNEL_DESCRIPTION`,"+ // 01 "`FEEDS`.`CHANNEL_DESCRIPTION`,"+ // 01
@ -1756,11 +1761,10 @@ QString RDFeed::rssXml(QString *err_msg,const QDateTime &now,bool *ok)
"(`PODCASTS`.`EFFECTIVE_DATETIME`<=now()) && "+ "(`PODCASTS`.`EFFECTIVE_DATETIME`<=now()) && "+
"((`PODCASTS`.`EXPIRATION_DATETIME` is null)||"+ "((`PODCASTS`.`EXPIRATION_DATETIME` is null)||"+
"(`PODCASTS`.`EXPIRATION_DATETIME`>now())) "+ "(`PODCASTS`.`EXPIRATION_DATETIME`>now())) "+
"order by `PODCASTS`.`ORIGIN_DATETIME`"; "order by `PODCASTS`.`EFFECTIVE_DATETIME`";
if(chan_q->value(20).toString()=="N") { if(chan_q->value(20).toString()=="N") {
sql+=" desc"; sql+=" desc";
} }
// printf("item_sql: %s\n",sql.toUtf8().constData());
item_q=new RDSqlQuery(sql); item_q=new RDSqlQuery(sql);
while(item_q->next()) { while(item_q->next()) {
ret+=" <item>\r\n"; ret+=" <item>\r\n";

View File

@ -2,7 +2,7 @@
// //
// Abstract a Rivendell RSS Feed // Abstract a Rivendell RSS Feed
// //
// (C) Copyright 2002-2022 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2002-2023 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
@ -102,8 +102,8 @@ class RDFeed : public QObject
QString itemXml() const; QString itemXml() const;
void setItemXml(const QString &str); void setItemXml(const QString &str);
QString feedUrl() const; QString feedUrl() const;
bool castOrder() const; bool castOrderIsAscending() const;
void setCastOrder(bool state) const; void setCastOrderIsAscending(bool state) const;
int maxShelfLife() const; int maxShelfLife() const;
void setMaxShelfLife(int days); void setMaxShelfLife(int days);
QDateTime lastBuildDateTime() const; QDateTime lastBuildDateTime() const;

View File

@ -2,7 +2,7 @@
// //
// Edit a Rivendell Feed // Edit a Rivendell Feed
// //
// (C) Copyright 2002-2022 Fred Gleason <fredg@paravelsystems.com> // (C) Copyright 2002-2023 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
@ -487,7 +487,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent)
feed_normalize_check->setChecked(true); feed_normalize_check->setChecked(true);
feed_normalize_spin->setValue(feed_feed->normalizeLevel()/1000); feed_normalize_spin->setValue(feed_feed->normalizeLevel()/1000);
} }
feed_castorder_box->setCurrentIndex(feed_feed->castOrder()); feed_castorder_box->setCurrentIndex(feed_feed->castOrderIsAscending());
feed_item_image_box->setCurrentImageId(feed_feed->defaultItemImageId()); feed_item_image_box->setCurrentImageId(feed_feed->defaultItemImageId());
UpdateControlState(); UpdateControlState();
@ -707,7 +707,7 @@ void EditFeed::okData()
else { else {
feed_feed->setNormalizeLevel(1); feed_feed->setNormalizeLevel(1);
} }
feed_feed->setCastOrder(feed_castorder_box->currentIndex()); feed_feed->setCastOrderIsAscending(feed_castorder_box->currentIndex());
if(!feed_feed->postXmlConditional("RDAdmin",this)) { if(!feed_feed->postXmlConditional("RDAdmin",this)) {
return; return;