# HG changeset patch # User Matti Hamalainen # Date 1572355755 -7200 # Node ID 35d7be5db18b77b47330a76ef8d9bf060a29efc6 # Parent 57443894bd8eba03aa26f6d713c177bb7c3168ab fetch_feeds: Move the actual calling of fetching functions to the configuration file config.feeds as a callback function, which is run by fetch_feeds.tcl diff -r 57443894bd8e -r 35d7be5db18b config.feeds.example --- a/config.feeds.example Tue Oct 29 15:18:47 2019 +0200 +++ b/config.feeds.example Tue Oct 29 15:29:15 2019 +0200 @@ -8,6 +8,20 @@ set feeds_dbfile "/home/niinuska/bot/feeds.sqlite" +# Callback for fetching the feeds data +proc feeds_fetch { } { + #fetch_poliisi "http://www.poliisi.fi/oulu/tiedotteet/1/0?all1/0" "Poliisi/Oulu" "http://www.poliisi.fi" + + fetch_halla_aho + + fetch_adventurers + + fetch_oots + + add_rss_feed "https://effi.org/feed/" "EFFI" "" +} + + # How often to check for newly added feed items from the database? # (in minutes) This has nothing to do how often the backend script # is run and actually scans / pulls the feeds, that is done in CRON. diff -r 57443894bd8e -r 35d7be5db18b fetch_feeds.tcl --- a/fetch_feeds.tcl Tue Oct 29 15:18:47 2019 +0200 +++ b/fetch_feeds.tcl Tue Oct 29 15:29:15 2019 +0200 @@ -223,15 +223,11 @@ ### Fetch the feeds -#fetch_poliisi "http://www.poliisi.fi/oulu/tiedotteet/1/0?all1/0" "Poliisi/Oulu" "http://www.poliisi.fi" - -fetch_halla_aho - -fetch_adventurers - -fetch_oots - -add_rss_feed "https://effi.org/feed/" "EFFI" "" +if {[catch {feeds_fetch} uerrmsg]} { + puts "Error fetching feeds: $uerrmsg" + feeds_db close + exit 3 +} ### Close database