-
Notifications
You must be signed in to change notification settings - Fork 12
SW_RSS FileWriter
The RSS file writer tool resides in piTelex' subdirectory RSS and is part of the newsfeed functionality of piTelex. It collects messages from a configurable newsfeed, re-formats them according to the limits of an ITA2 teleprinter and stores the output ready for further processing by the module News, which is responsible for printing incoming messages from rssFileWriter.py
at the teleprinter.
Python module |
Install |
---|---|
html2text | pip3 install html2text |
feedparser | pip3 instal feedparser |
rssFileWriter.py
takes several command line parameters:
Arg. short |
Arg. long |
Default | Description |
---|---|---|---|
-u | --feedurl | https://www.faz.net/rss/aktuell | RSS feed URL |
-t | --timeout | 10 | timeout(seconds) between fetching feed updates |
-f | --forget-past | false | Don't look back" |
-p | --ouput-path | ./ | Output files path (where News looks for messages) |
-n | --visible-name | empty | Prepend this string to each heading |
-s | --split-lines | 69 | max. # of characters per line |
./rssFileWriter.py -f -s 65 -n ARD-Tagesschau -p ./news/ -u https://www.tagesschau.de/xml/rss2
will collect messages from German TV (ARD) news magazine (Tagesschau), reformat it and store the output under ./news/.
Hint: Remember to create the output path before calling rssFileWriter.py
The RSS subdirectory contains also a small bash helper script rss-feed
for Linux that allows you to start/stop several RSS feeds simultaneously.
It is configured by a few variables you will find in the first lines of code:
Var | default | Description |
---|---|---|
RSSROOT | /home/pi/piTelex/RSS-feed | base directory for the RSS news system |
NEWS | $RSSROOT/news | Output files path (where News looks for messages) |
LOG | $NEWS/log | Directory for logfiles |
LINELENGTH | 65 | see -s above |
CFG | $RSSROOT/newsfeeds.cfg | file which holds the information about the RSS feeds to monitor. |
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...)
# Name of service and URL of service
FAZ https://www.faz.net/rss/aktuell/
ARD-Tagesschau https://www.tagesschau.de/xml/rss2 240
Finally, the script can be called as follows:
Cmd | Description |
---|---|
rss-feed list |
list all enabled newsfeeds from config file |
rss-feed start [feedname] |
fire up all or one specified newsfeed(s) in config file |
rss-feed status |
list all running newsfeeds |
rss-feed stop [feedname] |
stop all or one selected running newsfeed(s) |
rss-feed help |
display help |
Hint: if necessary, make
rss-feed
executable (chmod +x rss-feed
)
Consider using release packages for software installation: https://github.com/fablab-wue/piTelex/releases
-
Local use
-
i-Telex
-
Advanced Topics
-
Tools & Gadgets
-
TW39 (current loop)
-
ED1000 (FSK modulation)
-
V.10 (TeKaDe FS200, FS220)
-
SEU-M-board based
- with Austrian AGT (Ö-AGT, current loop)
- as replacement for SEU-B card inside LO2000, LO2001, LO3000