def c_status_length(self): stream_status = self.kvi.get('stream_status') if stream_status == 1: return time_since(time.time(), self.kvi.get('last_offline')) else: return time_since(time.time(), self.kvi.get('last_online'))
def get_last_tweet(self, key, extra={}): if self.twitter: try: public_tweets = self.twitter.user_timeline(key) for tweet in public_tweets: if not tweet.text.startswith('RT ') and tweet.in_reply_to_screen_name is None: return '{0} ({1} ago)'.format(tweet.text.replace("\n", " "), time_since(datetime.now().timestamp(), tweet.created_at.timestamp(), format='short')) except Exception as e: log.error('Exception caught {0}'.format(e)) return 'FeelsBadMan' else: return 'Twitter not set up FeelsBadMan' return 'FeelsBadMan'
def get_last_tweet(self, key, extra={}): if self.twitter: try: public_tweets = self.twitter.user_timeline(key) for tweet in public_tweets: if not tweet.text.startswith('RT ') and tweet.in_reply_to_screen_name is None: tw = tweet_prettify_urls(tweet) return '{0} ({1} ago)'.format(tw.replace("\n", " "), time_since(datetime.now().timestamp(), tweet.created_at.timestamp(), format='short')) except Exception: log.exception('Exception caught while getting last tweet') return 'FeelsBadMan' else: return 'Twitter not set up FeelsBadMan' return 'FeelsBadMan'
def c_time_since_latest_deck(self): return time_since(time.time(), self.kvi.get('latest_deck_time'))
def c_uptime(self): return time_since(datetime.now().timestamp(), self.start_time.timestamp())