Beispiel #1
0
def _file_entry(f, mimetype=None):
    return {
        "type": mimetype if mimetype else get_mimetype(f),
        "file":
        media_url(f, absolute=False),  # This silliness will be fixed in API 2
        "url": media_url(f),
    }
Beispiel #2
0
def _file_entry(f, mimetype=None):
    return {
        'type': mimetype if mimetype else get_mimetype(f),
        'file':
        media_url(f, absolute=False),  # This silliness will be fixed in API 2
        'url': media_url(f)
    }
Beispiel #3
0
def _file_object(f):
    mimetype = f.mimetype
    processor = get_processor(f.processor)

    metadata = {}
    if f.metadata and f.metadata != 'None':
        metadata = json.loads(f.metadata)
    ret = {
        'original': media_url(f.original, absolute=False),
        'type': mimetype,
        'blob_type': normalise_processor(f.processor),
        'hash': f.hash,
        'files': [],
        'extras': [],
        'metadata': metadata,
        'flags': f.flags.as_dict(),
        'title': f.title,
        'description': f.description,
    }
    if f.compression:
        ret['compression'] = float(f.compression)

    ret['files'].append(_file_entry(f.original, mimetype=f.mimetype))

    for f_ext in processor.outputs:
        name = "%s.%s" % (f.hash, f_ext)
        if name == f.original:
            continue

        ret['files'].append(_file_entry(name))
    for f_ext in processor.extras:
        ret['extras'].append(_file_entry("%s.%s" % (f.hash, f_ext)))

    return ret
Beispiel #4
0
def _file_object(f):
    mimetype = f.mimetype
    processor = get_processor(f.processor)

    metadata = {}
    if f.metadata and f.metadata != 'None':
        metadata = json.loads(f.metadata)
    ret = {
        'original': media_url(f.original, absolute=False),
        'type': mimetype,
        'blob_type': normalise_processor(f.processor),
        'hash': f.hash,
        'files': [],
        'extras': [],
        'metadata': metadata,
        'flags': f.flags.as_dict(),
        'title': f.title,
        'description': f.description,
    }
    if f.compression:
        ret['compression'] = float(f.compression)

    ret['files'].append(_file_entry(f.original, mimetype=f.mimetype))

    for f_ext in processor.outputs:
        name = "%s.%s" % (f.hash, f_ext)
        if name == f.original:
            continue

        ret['files'].append(_file_entry(name))
    for f_ext in processor.extras:
        ret['extras'].append(_file_entry("%s.%s" % (f.hash, f_ext)))

    return ret
Beispiel #5
0
def _file_object(f):
    mimetype = f.mimetype
    processor = get_processor(f.processor)

    metadata = {}
    if f.metadata and f.metadata != "None":
        metadata = json.loads(f.metadata)
    ret = {
        "original": media_url(f.original, absolute=False),
        "type": mimetype,
        "blob_type": normalise_processor(f.processor),
        "hash": f.hash,
        "files": [],
        "extras": [],
        "metadata": metadata,
        "flags": f.flags.as_dict(),
        "title": f.title,
        "description": f.description,
    }
    if f.compression:
        ret["compression"] = float(f.compression)

    ret["files"].append(_file_entry(f.original, mimetype=f.mimetype))

    for f_ext in processor.outputs:
        name = "%s.%s" % (f.hash, f_ext)
        if name == f.original:
            continue

        ret["files"].append(_file_entry(name))
    for f_ext in processor.extras:
        ret["extras"].append(_file_entry("%s.%s" % (f.hash, f_ext)))

    return ret
Beispiel #6
0
def _file_object(f):
    mimetype = f.mimetype
    processor = get_processor(f.processor)

    ret = {
        'original': media_url(f.original),
        'type': mimetype,
        'blob_type': normalise_processor(f.processor),
        'hash': f.hash,
        'files': [],
        'extras': [],
        'flags': f.flags.as_dict(),
    }
    if f.compression:
        ret['compression'] = float(f.compression)

    ret['files'].append(_file_entry(f.original, mimetype=f.mimetype))

    for f_ext in processor.outputs:
        name = "%s.%s" % (f.hash, f_ext)
        if name == f.original:
            continue

        ret['files'].append(_file_entry(name))
    for f_ext in processor.extras:
        ret['extras'].append(_file_entry("%s.%s" % (f.hash, f_ext)))

    return ret
Beispiel #7
0
def _file_object(f):
    mimetype = f.mimetype
    processor = get_processor(f.processor)

    ret = {
        'original': media_url(f.original),
        'type': mimetype,
        'blob_type': f.processor.split('/')[0] if '/' in f.processor else f.processor,
        'hash': f.hash,
        'files': [],
        'extras': []
    }
    if f.compression:
        ret['compression'] = float(f.compression)

    ret['files'].append(_file_entry(f.original, mimetype=f.mimetype))

    for f_ext in processor.outputs:
        ret['files'].append(_file_entry("%s.%s" % (f.hash, f_ext)))
    for f_ext in processor.extras:
        ret['extras'].append(_file_entry("%s.%s" % (f.hash, f_ext)))

    return ret
Beispiel #8
0
def _file_entry(f, mimetype=None):
    return {
        'type': mimetype if mimetype else get_mimetype(f),
        'file': media_url(f, absolute=False), # This silliness will be fixed in API 2
        'url': media_url(f)
    }
Beispiel #9
0
def _file_entry(f, mimetype=None):
    return {
        'type': mimetype if mimetype else get_mimetype(f),
        'file': media_url(f),
    }
Beispiel #10
0
def _file_entry(f, mimetype=None):
    return {
        'type': mimetype if mimetype else get_mimetype(f),
        'file': media_url(f),
        'url': _cfg("cdn") + media_url(f)
    }
Beispiel #11
0
def _file_entry(f, mimetype=None):
    return {
        'type': mimetype if mimetype else get_mimetype(f),
        'file': media_url(f),
        'url': _cfg("cdn") + media_url(f)
    }