Script to generate an RSS feed containing a few `fortune -s` items. Use it as a cron job to generate something you can see in a ticker (e.g. on Kodi)
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

fortune.rss.py 712B

123456789101112131415161718192021222324
  1. import sys
  2. from subprocess import Popen, PIPE
  3. from min_rss_gen.generator import start_rss, gen_item
  4. import xml.etree.ElementTree
  5. FEED_LINK = 'https://linux.die.net/man/6/fortune'
  6. FEED_TITLE = 'Fortune'
  7. FEED_DESCRIPTION = 'Random, hopefully interesting, adages'
  8. NUM_ITEMS = 10
  9. rss_items = []
  10. for i in range(NUM_ITEMS):
  11. with Popen(['fortune', '-s'], encoding='utf-8', stdout=PIPE) as fortune:
  12. rss_items.append(gen_item(title=fortune.stdout.read()))
  13. rss_xml_element = start_rss(
  14. title=FEED_TITLE, link=FEED_LINK,
  15. description=FEED_DESCRIPTION, items=rss_items)
  16. sys.stdout.write(str(
  17. xml.etree.ElementTree.tostring(
  18. rss_xml_element, encoding='utf-8', method='xml'),
  19. 'utf-8'))