Ejemplo n.º 1
0
    query_results = rc.action.package_search(
        q='producttypecode_bi_strs:24',
        rows=1000,
        start=i*1000)
    n = query_results['count'] / 1000.0
    i += 1
    for line in query_results['results']:
        for e in line['extras']:
            line[e['key']] = e['value']

        product_out = do_product(line)
        product_out['type'] = u'daily'
        product_out['name'] = u'{type}-{product_id}'.format(
                type=product_out['type'],
                product_id=product_out['product_id_new']
            ).lower()
        print json.dumps(product_out)

        if product_out['product_id_new'] in release_dict:
            release_dict[product_out['product_id_new']] += 1
        else:
            release_dict[product_out['product_id_new']] = 1
        line['release_id'] = release_dict[product_out['product_id_new']]

        release_out = do_release(line)
        print json.dumps(release_out)

        format_out = do_format(line)
        format_out['release_slug'] = release_out['name']
        print json.dumps(format_out)
Ejemplo n.º 2
0
             'zckownerorg_bi_strs DESC',
        rows=1000,
        start=i*1000
    )
    n = query_results['count'] / 1000.0
    i += 1

    for line in query_results['results']:
        for e in line['extras']:
            line[e['key']] = e['value']

        product_id_new = line.get(u'productidnew_bi_strs').upper()
        if product_id_new[:8] not in generic_ids:
            continue
        product_dict = do_product(line)
        format_dict = do_format(line)
        format_code = format_dict.get(u'format_code')
        product_dict[u'type'] = u'generic'
        product_dict[u'name'] = u'{type}-{product_id}'.format(
                type=product_dict[u'type'],
                product_id=product_id_new
            ).lower()
        product_dict[u'product_type_code'] = u'26'
        if product_id_new not in product_id_list:
            product_id_list.append(product_id_new)
        if len(product_id_new) > 8 and \
                product_id_new[:8] not in product_id_list:
            sys.stderr.write(
                '{product_id}: missing parent {parent_id}\n'
                .format(
                    product_id=product_id_new,
Ejemplo n.º 3
0
    n = query_results['count'] / 1000.0
    i += 1

    for line in query_results['results']:
        for e in line['extras']:
            line[e['key'].strip()] = e['value'].strip()

        product_id_new = line.get(u'productidnew_bi_strs').upper()
        if product_id_new[:8] in generic_ids:
            continue
        if (product_id_new in dropped_products or
                product_id_new[:8] in dropped_products or
                product_id_new[:15] in dropped_products):
            continue
        product_dict = do_product(line)
        format_dict = do_format(line)
        format_code = format_dict.get(u'format_code')
        if format_code == u'12' and (
            product_id_new[:8] in dnl_list or
            product_id_new in dnl_list
        ):
            format_dict[u'load_to_olc_code'] = u'0'
        if len(product_id_new) == 8:
            product_dict[u'type'] = u'publication'
            product_dict[u'name'] = u'{type}-{product_id}'.format(
                    type=product_dict[u'type'],
                    product_id=product_id_new
                ).lower()
            if product_id_new not in product_id_list:
                product_id_list.append(product_id_new)
        elif len(product_id_new) == 15: