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)
|
exit(1)
|
||||||
return sys.argv[1]
|
return sys.argv[1]
|
||||||
|
|
||||||
def get_exif(files, raw):
|
def get_exif(folder: str, raw: str):
|
||||||
exifs: list[str] = [file for file in files if file.endswith(".exif")]
|
absolut_path = os.path.join(folder, "exif.txt")
|
||||||
exif: str
|
if os.path.exists(absolut_path):
|
||||||
if len(exifs) > 0:
|
return absolut_path
|
||||||
exif = exifs[0]
|
if os.system(f"exiftool {raw} > {absolut_path} 2>/dev/null") == 0:
|
||||||
elif (raw is not None):
|
return absolut_path
|
||||||
exif = raw[:-3] + "exif"
|
os.remove(absolut_path)
|
||||||
if os.system(f"exiftool {raw} > {exif}"):
|
return None
|
||||||
os.remove(exif)
|
|
||||||
exif = None
|
|
||||||
else:
|
|
||||||
exif = None
|
|
||||||
return exif
|
|
||||||
|
|
||||||
def get_images(files):
|
def get_images(files):
|
||||||
images_datas: list[str] = []
|
images_datas: list[str] = []
|
||||||
@ -64,7 +59,7 @@ def main():
|
|||||||
images: list[str] = get_images(files)
|
images: list[str] = get_images(files)
|
||||||
raws: list[str] = [file for file in files if file.endswith(".NEF")]
|
raws: list[str] = [file for file in files if file.endswith(".NEF")]
|
||||||
raw: str = raws[0] if len(raws) > 0 else None
|
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"]
|
readmes: list[str] = [file for file in files if file == "readme.md"]
|
||||||
readme: str = readmes[0] if len(readmes) > 0 else None
|
readme: str = readmes[0] if len(readmes) > 0 else None
|
||||||
bar.next()
|
bar.next()
|
||||||
|
Loading…
Reference in New Issue
Block a user