|
|
|
|
4
|
from min_rss_gen.generator import start_rss, gen_item
|
4
|
from min_rss_gen.generator import start_rss, gen_item
|
5
|
import xml.etree.ElementTree
|
5
|
import xml.etree.ElementTree
|
6
|
|
6
|
|
|
|
7
|
+FORTUNE_CMD = '/usr/games/fortune'
|
7
|
FEED_LINK = 'https://linux.die.net/man/6/fortune'
|
8
|
FEED_LINK = 'https://linux.die.net/man/6/fortune'
|
8
|
FEED_TITLE = 'Fortune'
|
9
|
FEED_TITLE = 'Fortune'
|
9
|
FEED_DESCRIPTION = 'Random, hopefully interesting, adages'
|
10
|
FEED_DESCRIPTION = 'Random, hopefully interesting, adages'
|
|
|
|
|
13
|
rss_items = []
|
14
|
rss_items = []
|
14
|
|
15
|
|
15
|
for i in range(NUM_ITEMS):
|
16
|
for i in range(NUM_ITEMS):
|
16
|
- with Popen(['fortune', '-s', '-n', str(MAX_LENGTH)], encoding='utf-8', stdout=PIPE) as fortune:
|
|
|
|
|
17
|
+ with Popen([FORTUNE_CMD, '-s', '-n', str(MAX_LENGTH)], encoding='utf-8', stdout=PIPE) as fortune:
|
17
|
rss_items.append(gen_item(
|
18
|
rss_items.append(gen_item(
|
18
|
title=fortune.stdout.read().strip().replace('\n',' ').replace('\t',' '),
|
19
|
title=fortune.stdout.read().strip().replace('\n',' ').replace('\t',' '),
|
19
|
link=FEED_LINK,
|
20
|
link=FEED_LINK,
|