'Parse json entry of details of a torrent entry
to Torrent object.'

@staticmethod
def map_details(json_details, resolver):

    result = Torrent()
    result.id = json_details.get(u'id')
    result.name = json_details.get(u'name')
    result.category_id = json_details.get(u'category')
    for (term_type_name, terms_candidat) in json_details.get(u'terms').items():
        if isinstance(terms_candidat, list):
            for term_name in terms_candidat:
                term_entity = resolver(result.category_id, term_type_name, term_name)
                if (term_entity is not None):
                    result.terms.append(term_entity)
        else:
            term_entity = resolver(result.category_id, term_type_name, terms_candidat)
            if (term_entity is not None):
                result.terms.append(term_entity)
    return result
