Implement metadata fetching
This commit is contained in:
parent
991e1d47e6
commit
2f8de442f2
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,6 @@
|
|||||||
|
include
|
||||||
|
bin
|
||||||
|
|
||||||
# ---> Python
|
# ---> Python
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
2
LICENSE
2
LICENSE
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) <year> <owner>. All rights reserved.
|
Copyright (c) 2023 Frederick Boniface. All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
21
image_processing.py
Normal file
21
image_processing.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import pyexiv2
|
||||||
|
|
||||||
|
def get_image_data(path: str):
|
||||||
|
img = pyexiv2.Image(path)
|
||||||
|
xmp = img.read_xmp()
|
||||||
|
create_date = xmp.get('Xmp.xmp.CreateDate', 'N/A')
|
||||||
|
title = xmp.get('Xmp.dc.title', 'N/A')
|
||||||
|
description = xmp.get('Xmp.dc.description', 'N/A')
|
||||||
|
tags = xmp.get('Xmp.dc.subject', 'N/A')
|
||||||
|
description_parts = description['lang="x-default"'].split('|')
|
||||||
|
main_description = description_parts[0].strip()
|
||||||
|
alt_text = description_parts[1].strip()
|
||||||
|
image_data = {
|
||||||
|
'path': path,
|
||||||
|
'create': create_date + "Z",
|
||||||
|
'title': title['lang="x-default"'],
|
||||||
|
'description': main_description,
|
||||||
|
'alt': alt_text,
|
||||||
|
'tags': tags
|
||||||
|
}
|
||||||
|
print(image_data)
|
5
pyvenv.cfg
Normal file
5
pyvenv.cfg
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
home = /usr/bin
|
||||||
|
include-system-site-packages = false
|
||||||
|
version = 3.11.6
|
||||||
|
executable = /usr/bin/python3.11
|
||||||
|
command = /usr/bin/python -m venv /home/fred.boniface/git/social-photos
|
Loading…
Reference in New Issue
Block a user