From d9e7fde1a7373a8ec2e991e8b16f7aaec1dd15da Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Wed, 15 Feb 2023 12:33:46 -0500 Subject: [PATCH] 2023-02-15 Fred Gleason * 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 --- ChangeLog | 4 ++++ lib/rdfeed.cpp | 14 +++++++++----- lib/rdfeed.h | 6 +++--- rdadmin/edit_feed.cpp | 6 +++--- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index baf3c963..af424bd6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23978,3 +23978,7 @@ rdcastmanager(1). 2023-02-06 Fred Gleason * Incremented the package version to 4.0.0rc1int1. +2023-02-15 Fred Gleason + * 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. diff --git a/lib/rdfeed.cpp b/lib/rdfeed.cpp index 68c0e3e2..2ff69a69 100644 --- a/lib/rdfeed.cpp +++ b/lib/rdfeed.cpp @@ -2,7 +2,7 @@ // // Abstract a Rivendell RSS Feed // -// (C) Copyright 2002-2022 Fred Gleason +// (C) Copyright 2002-2023 Fred Gleason // // 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 @@ -541,14 +541,14 @@ QString RDFeed::feedUrl() const } -bool RDFeed::castOrder() const +bool RDFeed::castOrderIsAscending() const { return RDBool(RDGetSqlValue("FEEDS","KEY_NAME",feed_keyname, "CAST_ORDER").toString()); } -void RDFeed::setCastOrder(bool state) const +void RDFeed::setCastOrderIsAscending(bool state) const { SetRow("CAST_ORDER",RDYesNo(state)); } @@ -1637,10 +1637,15 @@ QString RDFeed::rssXml(QString *err_msg,const QDateTime &now,bool *ok) RDSqlQuery *chan_q; RDSqlQuery *item_q; RDSqlQuery *q; + QString item_order_sql="order by `PODCASTS`.`EFFECTIVE_DATETIME` desc "; if(ok!=NULL) { *ok=false; } + + // + // Channel Attributes + // sql=QString("select ")+ "`FEEDS`.`CHANNEL_TITLE`,"+ // 00 "`FEEDS`.`CHANNEL_DESCRIPTION`,"+ // 01 @@ -1756,11 +1761,10 @@ QString RDFeed::rssXml(QString *err_msg,const QDateTime &now,bool *ok) "(`PODCASTS`.`EFFECTIVE_DATETIME`<=now()) && "+ "((`PODCASTS`.`EXPIRATION_DATETIME` is null)||"+ "(`PODCASTS`.`EXPIRATION_DATETIME`>now())) "+ - "order by `PODCASTS`.`ORIGIN_DATETIME`"; + "order by `PODCASTS`.`EFFECTIVE_DATETIME`"; if(chan_q->value(20).toString()=="N") { sql+=" desc"; } - // printf("item_sql: %s\n",sql.toUtf8().constData()); item_q=new RDSqlQuery(sql); while(item_q->next()) { ret+=" \r\n"; diff --git a/lib/rdfeed.h b/lib/rdfeed.h index 04769a7b..534f7ad2 100644 --- a/lib/rdfeed.h +++ b/lib/rdfeed.h @@ -2,7 +2,7 @@ // // Abstract a Rivendell RSS Feed // -// (C) Copyright 2002-2022 Fred Gleason +// (C) Copyright 2002-2023 Fred Gleason // // 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 @@ -102,8 +102,8 @@ class RDFeed : public QObject QString itemXml() const; void setItemXml(const QString &str); QString feedUrl() const; - bool castOrder() const; - void setCastOrder(bool state) const; + bool castOrderIsAscending() const; + void setCastOrderIsAscending(bool state) const; int maxShelfLife() const; void setMaxShelfLife(int days); QDateTime lastBuildDateTime() const; diff --git a/rdadmin/edit_feed.cpp b/rdadmin/edit_feed.cpp index 6f593c2f..d8a4b309 100644 --- a/rdadmin/edit_feed.cpp +++ b/rdadmin/edit_feed.cpp @@ -2,7 +2,7 @@ // // Edit a Rivendell Feed // -// (C) Copyright 2002-2022 Fred Gleason +// (C) Copyright 2002-2023 Fred Gleason // // 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 @@ -487,7 +487,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent) feed_normalize_check->setChecked(true); 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()); UpdateControlState(); @@ -707,7 +707,7 @@ void EditFeed::okData() else { feed_feed->setNormalizeLevel(1); } - feed_feed->setCastOrder(feed_castorder_box->currentIndex()); + feed_feed->setCastOrderIsAscending(feed_castorder_box->currentIndex()); if(!feed_feed->postXmlConditional("RDAdmin",this)) { return;