def src(photo_key, size=None): SIZES = (32, 48, 64, 72, 94, 104, 110, 128, 144, 150, 160, 200, 220, 288, 320, 400, 512, 576, 640, 720, 800, 912, 1024, 1152, 1280, 1440, 1600) img_url = PicasaStorage().url(photo_key) if size is not None: try: size = SIZES[bisect(SIZES, size-1)] except IndexError: size = SIZES[-1] url, img = img_url.rsplit ('/',1) return '%s/s%d/%s' %(url, size, img) return img_url
def src(photo_key, size=None): SIZES = (32, 48, 64, 72, 94, 104, 110, 128, 144, 150, 160, 200, 220, 288, 320, 400, 512, 576, 640, 720, 800, 912, 1024, 1152, 1280, 1440, 1600) img_url = PicasaStorage().url(photo_key) if size is not None: try: size = SIZES[bisect(SIZES, size - 1)] except IndexError: size = SIZES[-1] url, img = img_url.rsplit('/', 1) return '%s/s%d/%s' % (url, size, img) return img_url
def albums(): from picasa import PicasaStorage storage = PicasaStorage() return [(a.title.text, a.title.text) for a in storage.albumsFromUser()]