29 lines
821 B
Python
29 lines
821 B
Python
import sys
|
|
import zlib
|
|
import json
|
|
import piexif
|
|
from PIL import Image
|
|
import uu
|
|
from io import BytesIO
|
|
|
|
from ketrface.util import *
|
|
from ketrface.config import *
|
|
|
|
config = read_config()
|
|
|
|
html_path = merge_config_path(config['path'], 'frontend')
|
|
pictures_path = merge_config_path(config['path'], config['picturesPath'])
|
|
faces_path = merge_config_path(config['path'], config['facesPath'])
|
|
db_path = merge_config_path(config['path'], config["db"]["photos"]["host"])
|
|
html_base = config['basePath']
|
|
|
|
faceId = int(sys.argv[1])
|
|
path = f'{faces_path}/{"{:02d}".format(faceId % 100)}'
|
|
|
|
img = Image.open(f'{path}/{faceId}.jpg')
|
|
exif_dict = piexif.load(img.info["exif"])
|
|
compressed_str = exif_dict["Exif"][piexif.ExifIFD.UserComment]
|
|
|
|
str = zlib_uudecode(compressed_str)
|
|
parsed = json.loads(str)
|
|
print(json.dumps(parsed, indent=2)) |