Added checking if filtered tweets has changed
This commit is contained in:
		
							
								
								
									
										55
									
								
								dashboard.py
									
									
									
									
									
								
							
							
						
						
									
										55
									
								
								dashboard.py
									
									
									
									
									
								
							| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user