Esempio n. 1
0
def get_metadata(media_id, key):
    """Return the value associated with the given metadata `key` for the given
    `media_id`, None if there is no such value.

    get_metadata(string, string) -> object or None
    """
    if media_id in __tp_dynamic:
        tp = __tp_dynamic[media_id]
        if   key == 'filext':       return tp.filext
        elif key == 'tilesize':     return tp.tilesize
        elif key == 'aspect_ratio': return tp.aspect_ratio
        else: return None
    else:
        return TileStore.get_metadata(media_id, key)
Esempio n. 2
0
    def _load(self, tile_id):
        media_id, tilelevel, row, col = tile_id

        maxtilelevel = TileStore.get_metadata(media_id, 'maxtilelevel')
        if tilelevel > maxtilelevel:
            return None

        filename = TileStore.get_tile_path(tile_id)
        try:
            tile = Image.open(filename)
            tile.load()
            return tile
        except IOError:
            return None