예제 #1
0
 def __init__(self, event_info):
     super(LivePlayer, self).__init__()
     self._event_id = event_info['event_id']
     self._channel_id = event_info['channel_id']
     self._host_id = event_info['host_id']
     self._site = event_info['site']
     self._web_url = event_info['web_url']
     self._title = event_info['event_theme']
     self._cover_url = event_info['event_poster']
     self._category_id = mapping(self._site, event_info['category'])
     self._online_ts = event_info['online_ts']
 def _category_mapping(self, crawled_live):
     if 'category' not in crawled_live or not bool(crawled_live['category']):
         logging.error("Category is not found for crawled_live id=%s", crawled_live['id'])
         crawled_live['map_category'] = 1 # default value
         return False        
     
     try:
         crawled_live['map_category'] = mapping(crawled_live['site'], crawled_live['category'])
         return True
     except KeyError:
         crawled_live['map_category'] = 1 # default value
         logging.error("no category mapping for crawled_live id=%s with category=%s", 
                       crawled_live['id'], crawled_live['category'])
         return False
     except Exception, e:
         crawled_live['map_category'] = 1 # default value
         logging.error(str(e))
         return False