forked from Astalaseven/twitter-rss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
32 lines (27 loc) · 917 Bytes
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import twitter_rss
import time
import subprocess
import config
# Launch web server
p = subprocess.Popen(['/usr/bin/python', config.DIR + 'server.py'])
# Update the feeds
try:
while 1:
print 'Updating ALL THE FEEDS!'
try:
with open(config.DIR + 'user/user.txt', 'r') as usernames:
for user in usernames:
twitter_rss.UserTweetGetter(user)
usernames.close()
with open(config.DIR + 'htag/htag.txt', 'r') as hashtags:
for htag in hashtags:
twitter_rss.HashtagTweetGetter(user)
hashtags.close()
except IOError:
print 'File could not be read'
time.sleep(config.TIMER)
except (KeyboardInterrupt, SystemExit):
p.kill() # kill the subprocess
print '\nKeyboardInterrupt catched -- Finishing program.'