Exemplo n.º 1
0
def iiif_info_url(msid, filename):
    kwargs = {
        'padded-msid': utils.pad_msid(msid),
        'fname': filename
    }
    raw_link = (conf.IIIF % kwargs)
    return utils.pad_filename(msid, raw_link)
Exemplo n.º 2
0
def pdf_uri(triple):
    """predict an article's pdf url.
    some article types don't have a PDF (like corrections) and some
    older articles that should have a pdf, don't. this function doesn't
    concern itself with those latter exceptions."""
    content_type, msid, version = triple
    if content_type and any(lmap(lambda type: type in ['Correction', 'Retraction'], content_type)):
        return EXCLUDE_ME
    filename = "elife-%s-v%s.pdf" % (utils.pad_msid(msid), version) # ll: elife-09560-v1.pdf
    return cdnlink(msid, filename)
Exemplo n.º 3
0
def figures_pdf_uri(triple):
    graphics, msid, version = triple
    filename_match = '-figsupp'

    if any(lmap(lambda graphic: graphic.get('xlink_href')
                and filename_match in graphic.get('xlink_href'), graphics)):
        filename = "elife-%s-figures-v%s.pdf" % (utils.pad_msid(msid), version) # ll: elife-09560-figures-v1.pdf
        figures_pdf_cdnlink = cdnlink(msid, filename)
        return cdn.url_exists(figures_pdf_cdnlink, msid)
    else:
        return None
Exemplo n.º 4
0
def pdf_uri(triple):
    """predict an article's pdf url.
    some article types don't have a PDF (like corrections) and some
    older articles that should have a pdf, don't. this function doesn't
    concern itself with those latter exceptions."""
    content_type, msid, version = triple
    if content_type and any(
            lmap(lambda type: type in ['Correction'], content_type)):
        return EXCLUDE_ME
    filename = "elife-%s-v%s.pdf" % (utils.pad_msid(msid), version
                                     )  # ll: elife-09560-v1.pdf
    return cdnlink(msid, filename)
Exemplo n.º 5
0
def figures_pdf_uri(triple):
    graphics, msid, version = triple
    filename_match = '-figsupp'
    if (True in map(
            lambda graphic: graphic.get('xlink_href') and filename_match in
            graphic.get('xlink_href'), graphics)):
        filename = "elife-%s-figures-v%s.pdf" % (
            utils.pad_msid(msid), version)  # ll: elife-09560-figures-v1.pdf
        figures_pdf_cdnlink = cdnlink(msid, filename)
        return cdn.url_exists(figures_pdf_cdnlink, msid)
    else:
        return None
Exemplo n.º 6
0
def iiiflink(msid, filename):
    kwargs = {'padded-msid': utils.pad_msid(msid), 'fname': filename}
    raw_link = (conf.CDN_IIIF % kwargs)
    return utils.pad_filename(msid, raw_link)
Exemplo n.º 7
0
def cdnlink(msid, filename):
    kwargs = {'padded-msid': utils.pad_msid(msid), 'fname': filename}
    return conf.CDN % kwargs
Exemplo n.º 8
0
def glencoe_url(msid):
    doi = "10.7554/eLife." + utils.pad_msid(msid)
    url = "https://movie-usa.glencoesoftware.com/metadata/" + doi
    return url
Exemplo n.º 9
0
def xml_uri(params):
    """predict an article's xml url."""
    msid, version = params
    filename = "elife-%s-v%s.xml" % (utils.pad_msid(msid), version
                                     )  # ll: elife-09560-v1.xml
    return cdnlink(msid, filename)
Exemplo n.º 10
0
def xml_uri(params):
    """predict an article's xml url."""
    msid, version = params
    filename = "elife-%s-v%s.xml" % (utils.pad_msid(msid), version) # ll: elife-09560-v1.xml
    return cdnlink(msid, filename)
Exemplo n.º 11
0
def cdnlink(msid, filename):
    kwargs = {
        'padded-msid': utils.pad_msid(msid),
        'fname': filename
    }
    return conf.CDN % kwargs
Exemplo n.º 12
0
def glencoe_url(msid):
    doi = "10.7554/eLife." + utils.pad_msid(msid)
    url = "https://movie-usa.glencoesoftware.com/metadata/" + doi
    return url