Added checking if filtered tweets has changed

This commit is contained in:
2022-11-03 16:35:06 +01:00
parent 6bcdaf7d8c
commit 1793dd4175
5 changed files with 60 additions and 24 deletions

View File

@@ -13,7 +13,7 @@ root_content_path = 'dashboard_static'
# the action will be called with the context and the event
@event('init')
def setup(ctx, e):
start_offline_tweets('sports1.txt', event_name="tweet", time_factor=0.1)
start_offline_tweets('sports1.txt', event_name="tweet", time_factor=1)
ctx.count = 0
# fire('sample', {'previous': 0.0})
@@ -40,7 +40,58 @@ def words(message):
@event('tweet')
def generate_tweet(ctx, e):
tweet = e.data
tweet = dict(e.data)
try:
try:
tweet.pop("id_str")
except KeyError:
pass
try:
tweet.pop("display_text_range")
except KeyError:
pass
try:
tweet.pop("in_reply_to_status_id")
except KeyError:
pass
try:
tweet.pop("in_reply_to_status_id_str")
except KeyError:
pass
try:
tweet.pop("in_reply_to_user_id")
except KeyError:
pass
try:
tweet.pop("in_reply_to_user_id_str")
except KeyError:
pass
try:
tweet.pop("in_reply_to_screen_name")
except KeyError:
pass
try:
tweet.pop("geo")
except KeyError:
pass
try:
tweet.pop("coordinates")
except KeyError:
pass
try:
tweet.pop("place")
except KeyError:
pass
try:
tweet.pop("contributors")
except KeyError:
pass
try:
tweet.pop("is_quote_status")
except KeyError:
pass
except:
pass
# base sample on previous one
# sample = clip(-100, e.data['previous'] + random.uniform(+5.0, -5.0), 100)
# emit to outside world