changeset 484:35d7be5db18b

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
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 29 Oct 2019 15:29:15 +0200
parents 57443894bd8e
children b866ab8bd382
files config.feeds.example fetch_feeds.tcl
diffstat 2 files changed, 19 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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.
--- 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