core: rename exif file exif.txt
This commit is contained in:
parent
97533dc6d8
commit
a5e03ae8d5
23
src/main.py
23
src/main.py
@ -11,19 +11,14 @@ def argument_parsing():
|
||||
exit(1)
|
||||
return sys.argv[1]
|
||||
|
||||
def get_exif(files, raw):
|
||||
exifs: list[str] = [file for file in files if file.endswith(".exif")]
|
||||
exif: str
|
||||
if len(exifs) > 0:
|
||||
exif = exifs[0]
|
||||
elif (raw is not None):
|
||||
exif = raw[:-3] + "exif"
|
||||
if os.system(f"exiftool {raw} > {exif}"):
|
||||
os.remove(exif)
|
||||
exif = None
|
||||
else:
|
||||
exif = None
|
||||
return exif
|
||||
def get_exif(folder: str, raw: str):
|
||||
absolut_path = os.path.join(folder, "exif.txt")
|
||||
if os.path.exists(absolut_path):
|
||||
return absolut_path
|
||||
if os.system(f"exiftool {raw} > {absolut_path} 2>/dev/null") == 0:
|
||||
return absolut_path
|
||||
os.remove(absolut_path)
|
||||
return None
|
||||
|
||||
def get_images(files):
|
||||
images_datas: list[str] = []
|
||||
@ -64,7 +59,7 @@ def main():
|
||||
images: list[str] = get_images(files)
|
||||
raws: list[str] = [file for file in files if file.endswith(".NEF")]
|
||||
raw: str = raws[0] if len(raws) > 0 else None
|
||||
exif: str = get_exif(files, raw)
|
||||
exif: str = get_exif(folder, raw)
|
||||
readmes: list[str] = [file for file in files if file == "readme.md"]
|
||||
readme: str = readmes[0] if len(readmes) > 0 else None
|
||||
bar.next()
|
||||
|
Loading…
Reference in New Issue
Block a user