Beispiel #1
0
def cut_tweet(cut_player, curator, league):
    tweet = [curator[user_keys.user_role] + '/#' + league[keys.entity_league], 'drops']
    tweet.append(fixed.adjust_name(cut_player))
    #if keys.entity_twitter in cut_player:
    #    tweet.append('@' + cut_player[keys.entity_twitter])        
    tweet.append(cut_player[keys.entity_profile])
    tweet.append('#BestOfLuck')
    tweet.extend(twitter_keys.bio_hash(cut_player, league))
    return u' '.join(tweet)
Beispiel #2
0
def add_tweet(add_player, curator, league):
    tweet = [curator[user_keys.user_role] + '/#' + league[keys.entity_league], 'adds']
    tweet.append(fixed.adjust_name(add_player))
    #if keys.entity_twitter in add_player:
    #    tweet.append('@' + add_player[keys.entity_twitter])    
    if add_player[keys.entity_profile].startswith('http://'):
        tweet.extend(['via', add_player[keys.entity_profile]])
    tweet.extend(twitter_keys.bio_hash(add_player, league))
    return u' '.join(tweet)
Beispiel #3
0
def bg_tweet(curator, league, entity, count):
    tweet = [curator[user_keys.user_role] + '/#' + league[keys.entity_league],'updates', 'background-image', '#' + str(count)]
    tweet.append(curator[user_keys.user_role] + '/tw/' + entity[keys.entity_twitter_id] + '/background.png')
    tweet.append('for')
    tweet.append(fixed.adjust_name(entity))
    #if entity[keys.entity_twitter]:
    #    tweet.append('@' + entity[keys.entity_twitter])    
    tweet.extend(twitter_keys.bio_hash(entity, league))
    return u' '.join(tweet)
Beispiel #4
0
def id_twitter(id_player, curator, league):
    tweet = [curator[user_keys.user_role] + '/#' + league[keys.entity_league], 'ids']
    tweet.append(fixed.adjust_name(id_player))
    tweet.append('as')    
    tweet.append('#' + id_player[keys.entity_twitter])
    if id_player[keys.entity_profile].startswith('http'):             
        tweet.extend(['via', id_player[keys.entity_profile]])
    else:
        tweet.extend(['via', id_player[keys.entity_profile].split(':', 1)[1]])
    tweet.extend(twitter_keys.bio_hash(id_player, league))
    return u' '.join(tweet)
Beispiel #5
0
def delta_tweet(delta_player, existing_player, differences, curator, league):
    try:
        tweet = [curator[user_keys.user_role] + '/#' + league[keys.entity_league], 'updates']
        if keys.entity_twitter in delta_player and delta_player[keys.entity_twitter]:
            tweet.append(fixed.adjust_name(delta_player))
            #tweet.append('@' + delta_player[keys.entity_twitter])
        elif keys.entity_twitter in existing_player and existing_player[keys.entity_twitter]:
            tweet.append(fixed.adjust_name(existing_player))
        else:            
            tweet.append(fixed.adjust_name(delta_player))
        tweet.append(delta_player[keys.entity_profile])
        change_suffix = delta(differences)
        tweet.append(u' '.join([u' '.join(c) for c in change_suffix]).replace('  ', ' ').replace(' ,', ','))
        if len(differences.keys()) == 1 and differences.keys()[0] == 'age__change' and int(differences['age__change'].split('__')[0]) + 1 == int(differences['age__change'].split('__')[1]):
            tweet.append('#HappyBirthday')
        if keys.entity_twitter in delta_player:
            tweet.extend(twitter_keys.bio_hash(delta_player, league))
        return u' '.join(tweet)
    except Exception as e:
        print 'delta tweet exception:', e, delta_player, existing_player, differences
        return ''
Beispiel #6
0
 def match_entity(self, ltp, force_match=False):
     search = fixed.adjust_name(ltp) + ' twitter'
     try:
         print 'search term:', search
     except:
         pass
     cites = yield self.google(search, results=5, domain='twitter.com')
     possibles = self.match_filter_status(cites)
     try:
         print 'possibles:', possibles, ltp[keys.entity_profile]
     except:
         print 'cannot print possibles'
     d2 = self.match_possibles(possibles)
     d2.addCallback(self.create_match, ltp)
     d2.addErrback(self.match_error)
     yield d2