Implement "new" episodes feature and autoQueue

This commit is contained in:
Bart De Vries 2021-04-09 21:43:29 +02:00
parent 26986616c7
commit a8e174739f
5 changed files with 22 additions and 3 deletions

View File

@ -9,6 +9,10 @@
<label>How many recent episodes should be labeled 'new' when adding a new subscription</label>
<default>1</default>
</entry>
<entry name="autoQueue" type="Bool">
<label>Automatically add new episodes to queue</label>
<default>true</default>
</entry>
<entry name="autoDownload" type="Bool">
<label>Automatically download new episodes</label>
<default>false</default>

View File

@ -15,6 +15,7 @@
#include "datamanager.h"
#include "fetcher.h"
#include "database.h"
#include "alligatorsettings.h"
DataManager::DataManager()
{
@ -53,6 +54,18 @@ DataManager::DataManager()
m_entrymap[feedurl] += query.value(QStringLiteral("id")).toString();
//qDebug() << m_entrymap[feedurl];
}
// Check for "new" entries
if (AlligatorSettings::self()->autoQueue()) {
query.prepare(QStringLiteral("SELECT id FROM Entries WHERE feed=:feed AND new=:new;"));
query.bindValue(QStringLiteral(":feed"), feedurl);
query.bindValue(QStringLiteral(":new"), true);
Database::instance().execute(query);
while (query.next()) {
addtoQueue(feedurl, query.value(QStringLiteral("id")).toString());
}
}
Q_EMIT feedEntriesUpdated(feedurl);
});

View File

@ -140,7 +140,7 @@ void Fetcher::processFeed(Syndication::FeedPtr feed, const QString &url)
processEntry(entry, url, isNewFeed);
}
// Now mark the appropriate number of recent entries "new" and "read" for new feeds only
// Now mark the appropriate number of recent entries "new" and "read" only for new feeds
if (isNewFeed) {
query.prepare(QStringLiteral("SELECT * FROM Entries WHERE feed=:feed ORDER BY updated DESC LIMIT :recentNew;"));
query.bindValue(QStringLiteral(":feed"), url);

View File

@ -93,7 +93,8 @@ Kirigami.SwipeListItem {
}
onClicked: {
entry.read = true
// only mark pure rss feeds as read; podcasts should only be marked read once they have been listened to
if (!entry.enclosure) { entry.read = true; entry.new = false;}
pageStack.push("qrc:/EntryPage.qml", {"entry": entry})
}

View File

@ -80,7 +80,8 @@ Kirigami.SwipeListItem {
}
onClicked: {
entry.read = true
// only mark pure rss feeds as read; podcasts should only be marked read once they have been listened to
if (!entry.enclosure) { entry.read = true; entry.new = false;}
pageStack.push("qrc:/EntryPage.qml", {"entry": entry})
}