import json


def photo_list(albumno):
    """Return list of photos for specified album.
    Returned list contains tuples of (photono, filename, location, caption)
    """
    photodata = json.loads(open("static/json/photos.json").read())
    photolist = []
    for photono in photodata:
        if photodata[photono]["albumno"] == albumno:
            photolist.append(
                dict(
                    photono=photono,
                    filename=photodata[photono]["filename"],
                    location=photodata[photono]["location"],
                    caption=photodata[photono]["caption"],
                )
            )
    return sorted(photolist, key=lambda _: _["filename"].upper())