def manifest(identifier):
    domain = purify_domain(request.args.get('domain', request.url_root))
    page = None
    if '$' in identifier:
        identifier, page = identifier.split('$')
        page = int(page)
    #try:
    return ldjsonify(create_manifest(identifier, domain=domain, page=page))
Esempio n. 2
0
def info(identifier):
    try:
        path, mediatype = ia_resolver(identifier)
    except ValueError:
        abort(404)
    try:
        domain = '%s%s' % (purify_domain(request.url_root), identifier)
        info = web.info(domain, path)
        return ldjsonify(info)
    except:
        abort(400)  # , "Invalid item, may actually be collection")
Esempio n. 3
0
def url2iiif():
    url = request.args.get('url', '')
    if not url:
        abort(400)
    try:
        domain = purify_domain(request.args.get('domain', request.url_root))
        filehash = url2ia(url)
        time.sleep(20)
        return redirect('%surl2iiif$%s' % (domain, filehash))
    except Exception as e:
        print(e)
        abort(400)
def view(identifier):
    domain = purify_domain(request.args.get('domain', request.url_root))
    uri = '%s%s' % (domain, identifier)
    page = request.args.get('page', None)
    citation = request.args.get('citation', None)

    try:
        path, mediatype = ia_resolver(identifier)
    except ValueError:
        abort(404)
    if mediatype == 'image' or '$' in identifier:
        return render_template('viewer.html', domain=domain,
                               info=web.info(uri, path))
    return render_template('reader.html', domain=request.base_url, page=page, citation=citation)
Esempio n. 5
0
def catalog():
    cursor = request.args.get('cursor', '')
    q = request.args.get('q', '')
    domain = purify_domain(request.args.get('domain', request.url_root))
    return ldjsonify(collection(domain, getids(q, limit, cursor)['ids']))