def _get_stream_info_from_value(self, result, name):
        r_dict = {}
        if 'value' in result:
            value = result['value']
            try:
                value_dict = json.loads(value)
            except (__HOLE__, TypeError):
                return Failure(InvalidStreamInfoError(name))
            known_fields = ['stream_hash', 'name', 'description', 'key_fee', 'key_fee_address', 'thumbnail',
                            'content_license', 'sources', 'fee', 'author']
            known_sources = ['lbry_sd_hash', 'btih', 'url']
            known_fee_types = {'LBC': ['amount', 'address']}
            for field in known_fields:
                if field in value_dict:
                    if field == 'sources':
                        for source in known_sources:
                            if source in value_dict[field]:
                                if source == 'lbry_sd_hash':
                                    r_dict['stream_hash'] = value_dict[field][source]
                                else:
                                    r_dict[source] = value_dict[field][source]
                    elif field == 'fee':
                        fee = value_dict['fee']
                        if 'type' in fee:
                            if fee['type'] in known_fee_types:
                                fee_fields = known_fee_types[fee['type']]
                                if all([f in fee for f in fee_fields]):
                                    r_dict['key_fee'] = fee['amount']
                                    r_dict['key_fee_address'] = fee['address']
                                else:
                                    for f in ['key_fee', 'key_fee_address']:
                                        if f in r_dict:
                                            del r_dict[f]
                    else:
                        r_dict[field] = value_dict[field]
            if 'stream_hash' in r_dict and 'txid' in result:
                d = self._save_name_metadata(name, r_dict['stream_hash'], str(result['txid']))
            else:
                d = defer.succeed(True)
            d.addCallback(lambda _: r_dict)
            return d
        elif 'error' in result:
            log.warning("Got an error looking up a name: %s", result['error'])
        return Failure(UnknownNameError(name))
dataset/ETHPy150Open lbryio/lbry/lbrynet/core/LBRYcrdWallet.py/LBRYWallet._get_stream_info_from_value