@ -181,12 +181,13 @@ function NewsDownloader:loadConfigAndProcessFeeds()
local url = feed [ 1 ]
local limit = feed.limit
local download_full_article = feed.download_full_article == nil or feed.download_full_article
local include_images = feed.include_images
if url and limit then
info = InfoMessage : new { text = T ( _ ( " Processing %1/%2: \n %3 " ) , idx , total_feed_entries , url ) }
UIManager : show ( info )
-- processFeedSource is a blocking call, so manually force a UI refresh beforehand
UIManager : forceRePaint ( )
NewsDownloader : processFeedSource ( url , tonumber ( limit ) , unsupported_feeds_urls , download_full_article )
NewsDownloader : processFeedSource ( url , tonumber ( limit ) , unsupported_feeds_urls , download_full_article , include_images )
UIManager : close ( info )
else
logger.warn ( ' NewsDownloader: invalid feed config entry ' , feed )
@ -213,7 +214,7 @@ function NewsDownloader:loadConfigAndProcessFeeds()
NewsDownloader : afterWifiAction ( )
end
function NewsDownloader : processFeedSource ( url , limit , unsupported_feeds_urls , download_full_article )
function NewsDownloader : processFeedSource ( url , limit , unsupported_feeds_urls , download_full_article , include_images )
local ok , response = pcall ( function ( )
return DownloadBackend : getResponseAsString ( url )
@ -233,11 +234,11 @@ function NewsDownloader:processFeedSource(url, limit, unsupported_feeds_urls, do
if is_atom then
ok = pcall ( function ( )
return self : processAtom ( feeds , limit , download_full_article )
return self : processAtom ( feeds , limit , download_full_article , include_images )
end )
elseif is_rss then
ok = pcall ( function ( )
return self : processRSS ( feeds , limit , download_full_article )
return self : processRSS ( feeds , limit , download_full_article , include_images )
end )
end
if not ok or ( not is_rss and not is_atom ) then
@ -263,7 +264,7 @@ function NewsDownloader:deserializeXMLString(xml_str)
return xmlhandler.root
end
function NewsDownloader : processAtom ( feeds , limit , download_full_article )
function NewsDownloader : processAtom ( feeds , limit , download_full_article , include_images )
local feed_output_dir = string.format ( " %s%s/ " ,
news_download_dir_path ,
util.replaceInvalidChars ( getFeedTitle ( feeds.feed . title ) ) )
@ -276,14 +277,14 @@ function NewsDownloader:processAtom(feeds, limit, download_full_article)
break
end
if download_full_article then
self : downloadFeed ( feed , feed_output_dir )
self : downloadFeed ( feed , feed_output_dir , include_images )
else
self : createFromDescription ( feed , feed.context , feed_output_dir )
end
end
end
function NewsDownloader : processRSS ( feeds , limit , download_full_article )
function NewsDownloader : processRSS ( feeds , limit , download_full_article , include_images )
local feed_output_dir = ( " %s%s/ " ) : format (
news_download_dir_path , util.replaceInvalidChars ( util.htmlEntitiesToUtf8 ( feeds.rss . channel.title ) ) )
if not lfs.attributes ( feed_output_dir , " mode " ) then
@ -295,7 +296,7 @@ function NewsDownloader:processRSS(feeds, limit, download_full_article)
break
end
if download_full_article then
self : downloadFeed ( feed , feed_output_dir )
self : downloadFeed ( feed , feed_output_dir , include_images )
else
self : createFromDescription ( feed , feed.description , feed_output_dir )
end
@ -322,14 +323,14 @@ local function getTitleWithDate(feed)
return title
end
function NewsDownloader : downloadFeed ( feed , feed_output_dir )
function NewsDownloader : downloadFeed ( feed , feed_output_dir , include_images )
local link = getFeedLink ( feed.link )
local news_dl_path = ( " %s%s%s " ) : format ( feed_output_dir ,
getTitleWithDate ( feed ) ,
file_extension )
logger.dbg ( " NewsDownloader: News file will be stored to : " , news_dl_path )
DownloadBackend : download ( link , news_dl_path )
DownloadBackend : download ( link , news_dl_path , include_images )
end
function NewsDownloader : createFromDescription ( feed , context , feed_output_dir )