Skip to content

SW_RSS feed

Rolf Obrecht edited this page Feb 27, 2023 · 8 revisions

News Ticker

In order to use your setup as a news ticker, you have to configure three software parts:

  1. Check that your teletypewriter is connected correctly and functional.
  2. Configure the RSS reader to collect messages from RSS feeds
  3. Configure piTelex for printing the messages collected by the RSS reader

As a prerequisite, install the additionally needed python modules:

sudo apt install python3-feedparser python3-html2text python3-watchdog

RSS reader

The RSS reader reads messages from RSS-feed URL's, formats them to a TTY-compliant format and stores the result to a file.
...piTelex/RSS-feed/newsfeeds.cfg is the default configuration file. Change to this directory and specify the feeds to monitor:

$ cd RSS-feed
$ edit newsfeeds.cfg

Each line of this file contains a definition of a RSS feed and is divided into three fields:

<identifier> <whitespace> <url> [<whitespace> <interval in seconds>]
  • <identifier> must not contain whitespace.
  • # as first non-whitespace-char in a line marks it as comment. Empty lines are permitted.
  • <interval in seconds> specifies the polling interval; if omitted, it defaults to 10s (which is probably too fast in most cases...)

Example:

# FAZ 		https://www.faz.net/rss/aktuell/

# SZ 		https://rss.sueddeutsche.de/rss/Topthemen/
ARD-Tagesschau	https://www.tagesschau.de/xml/rss2 60
Warnmeldungen	https://warnung.bund.de/api31/mowas/rss/053340000000.rss 60

Now you can start and control the RSS reading subsystem using the script rss-feed. If necessary, make it executable first (chmod +x rss-feed).

./rss-feed start should start the reader for all configured feeds, and

./rss-feed status should list the services as running.

./rss-feed help gives you more detailed usage information.

RSS printing

Now it's time to setup the last part of the task, i.e. the printing of the collected messages to the teleprinter. This is managed by piTelex' module News. It must be enabled in telex.json and it must be given the path to the files written by the RSS reader:

    "news": {
      "type": "news",
      "enable": true,
      "newspath": "/home/pi/piTelex/RSS-feed/news/"
    },

The top lines of the script rss-feed define some paths for the news subsystem. Change them only if you know what you're doing. In most cases, they can be left at their default values. Be sure to give the News module the identical path as specified in rss-feed script, otherwise News will not be able to find the messages to be printed.

Don't forget to restart piTelex to activate the configuration changes.

News HOWTO in short

Setting up a couple of newsfeeds requires the following steps:

  • identify the URLs of the newsfeed you want to monitor
  • in subdirectory RS-feed, edit newsfeeds.cfg to reflect your newsfeeds (details see rssFileWriter.py)
  • in telex.json
    • enable device News
    • specify pathname corresponding to the configuration of rssFileWriter.py
  • restart piTelex to reflect the changes to telex.json
  • start the newsfeed reader with RSS-feed/rss-feed start
  • wait for your first news to be printed :-)

Example Printout

ard-tagesschau  22.08.2022 10:25:29

== erneute zinssenkung soll chinas wirtschaft ankurbeln ==
die people's bank of china hat ein weiteres mal zwei ihrer
leitzinssaetze gesenkt. mit den zinssenkungen versucht die
chinesische notenbank, die schwaechelnde wirtschaft im land
anzukurbeln.  
++++

Note: The newsfeed reader and the device News run independently fom each other. rssFileWriter.py just monitors the feed(s) and writes the messages to the configured directory. Device News monitors this directory for new entries and prints them to the teleprinter. To stop the printing of RSS feeds, it is sufficient to stop rssFileWriter.py e.g. with RSS-feed/rss-feed stop. Device News may remain enabled, piTelex' restart is not required.

Clone this wiki locally