Exemplo n.º 1
0
def run():
    data = {}
    if len(sys.argv) > 2:
        root = sys.argv[2]
    else:
        root = None
    files = get_files(root)
    for file in files:
        exif = ExifParser(file)
        focal = exif.focal_length()
        camera = exif.camera()
        iso = exif.iso()
        lens = exif.lens()
        combo = (focal, camera, iso, lens)
        if data.get(combo):
            data[combo] = data[combo] + 1
        else:
            data[combo] = 1
    show_grouped_output(data)
Exemplo n.º 2
0
def extract_data(files, args):
    data = {}

    for file in files:
        exif = ExifParser(file)

        if args.lens:
            key = exif.lens()
            if key:
              label = key
            else:
              label = 'N/A'
        elif args.iso:
            key = exif.iso()
            if key:
              label = "ISO%s" % key
            else:
              label = 'N/A'
        else:
            key = exif.focal_length()
            if key:
              label = "%smm" % key
            else:
              label = 'N/A'

        if args.group_by_camera:
            camera = exif.camera()
        else:
            camera = None

        group = (camera, key, label)

        if data.get(group):
            data[group] = data[group] + 1
        else:
            data[group] = 1

    return data