def convert_db_channel_to_json(channel, include_rel_score=False):
 res_json = {'id': channel[0], 'dispersy_cid': channel[1].encode('hex'), 'name': channel[2], 'description': channel[3], 'votes': channel[5], 'torrents': channel[4], 'spam': channel[6], 'modified': channel[8], 'subscribed': (channel[7] == VOTE_SUBSCRIBE)}
 if include_rel_score:
  res_json['relevance_score'] = channel[9]
 return res_json

def convert_db_channel_to_json ( channel , include_rel_score = False ) : res_json = { 'id' : channel [ 0 ] , 'dispersy_cid' : channel [ 1 ] . encode ( 'hex' ) , 'name' : channel [ 2 ] , 'description' : channel [ 3 ] , 'votes' : channel [ 5 ] , 'torrents' : channel [ 4 ] , 'spam' : channel [ 6 ] , 'modified' : channel [ 8 ] , 'subscribed' : ( channel [ 7 ] == VOTE_SUBSCRIBE ) } if include_rel_score : res_json [ 'relevance_score' ] = channel [ 9 ] return res_json
this method converts a channel in the database to a json dictionary .