added direct support for local files as sources of feeds

This commit is contained in:
Martin Rotter 2023-10-16 15:21:02 +02:00
parent 6100e56985
commit a4bf57f971
3 changed files with 8 additions and 0 deletions

View File

@ -40,6 +40,8 @@ StandardFeedDetails::StandardFeedDetails(QWidget* parent) : QWidget(parent) {
QVariant::fromValue(StandardFeed::SourceType::Url));
m_ui.m_cmbSourceType->addItem(StandardFeed::sourceTypeToString(StandardFeed::SourceType::Script),
QVariant::fromValue(StandardFeed::SourceType::Script));
m_ui.m_cmbSourceType->addItem(StandardFeed::sourceTypeToString(StandardFeed::SourceType::LocalFile),
QVariant::fromValue(StandardFeed::SourceType::LocalFile));
// Add standard feed types.
m_ui.m_cmbType->addItem(StandardFeed::typeToString(StandardFeed::Type::Atom10),

View File

@ -264,6 +264,9 @@ StandardFeed* StandardFeed::guessFeed(StandardFeed::SourceType source_type,
throw NetworkException(network_result.m_networkError);
}
}
else if (source_type == StandardFeed::SourceType::LocalFile) {
feed_contents = IOFactory::readFile(source);
}
else {
qDebugNN << LOGSEC_CORE << "Running custom script for guessing" << QUOTE_W_SPACE(source) << "to obtain feed data.";

View File

@ -199,6 +199,9 @@ QList<Message> StandardServiceRoot::obtainNewMessages(Feed* feed,
#endif
}
}
else if (f->sourceType() == StandardFeed::SourceType::LocalFile) {
feed_contents = IOFactory::readFile(feed->source());
}
else {
qDebugNN << LOGSEC_CORE << "Running custom script" << QUOTE_W_SPACE(feed->source()) << "to obtain feed data.";