Beispiel #1
0
def createPreview(file):
    type = getType(file.name)
    if type == "text":
        return createTextPreview(file)
    elif type == "image":
        return createImagePreview(file)
    elif type == "sound":
        return createSoundPreview(file)
    else:
        return ("", "Sorry, no preview for %s files available" % type, "")
Beispiel #2
0
def createPreview(file):
    type = getType(file.name)
    if type == "text":
        return createTextPreview(file)
    elif type == "image":
        return createImagePreview(file)
    elif type == "sound":
        return createSoundPreview(file)
    else:
        return ("", "Sorry, no preview for %s files available" % type, "")
Beispiel #3
0
def getIcon(file):
    """getIcon(File) -> string
    If needed, generates an icon and saves it to the thumb_dir
    Returns the path to the icon file.
    """
    icon_name = loadPreview(file, "icon")
    if icon_name == None:
        icon_name = createPreview(file, "icon")
        if icon_name == None:
            return "/images/%s.png" % getType(file.name)

    return "/thumb/%s" % icon_name
Beispiel #4
0
def getIcon(file):
    """getIcon(File) -> string
    If needed, generates an icon and saves it to the thumb_dir
    Returns the path to the icon file.
    """
    icon_name = loadPreview(file, "icon")
    if icon_name == None:
        icon_name = createPreview(file, "icon")
        if icon_name == None:
            return "/images/%s.png" % getType(file.name)

    return "/thumb/%s" % icon_name