Functions to set folder of app in ~.
This commit is contained in:
parent
06dda64e73
commit
34720daf12
1 changed files with 61 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
||||||
import yaml
|
import yaml
|
||||||
|
import os
|
||||||
|
|
||||||
class Utilities:
|
class Utilities:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -20,6 +21,66 @@ class Utilities:
|
||||||
except PermissionError as e:
|
except PermissionError as e:
|
||||||
print(f"Error saving setings: {e}")
|
print(f"Error saving setings: {e}")
|
||||||
|
|
||||||
|
def program_configs(self):
|
||||||
|
"""Prepear folder for config and generate default exif if non aviable"""
|
||||||
|
program_folder = self._ensure_program_folder_exists()
|
||||||
|
if not os.path.isfile(f"{program_folder}/exif.yaml"):
|
||||||
|
self._default_exif(f"{program_folder}/exif.yaml")
|
||||||
|
|
||||||
|
def _ensure_program_folder_exists(self):
|
||||||
|
program_folder = os.path.expanduser("~/.config/OptimaLab35")
|
||||||
|
print(program_folder)
|
||||||
|
if not os.path.exists(program_folder):
|
||||||
|
print("in not, make folder")
|
||||||
|
os.makedirs(program_folder)
|
||||||
|
return program_folder
|
||||||
|
|
||||||
|
def _default_exif(self, file):
|
||||||
|
"""Makes a default exif file."""
|
||||||
|
print("Making default")
|
||||||
|
def_exif = {
|
||||||
|
"artist": [
|
||||||
|
"Mr Finchum",
|
||||||
|
"John Doe"
|
||||||
|
],
|
||||||
|
"copyright_info": [
|
||||||
|
"All Rights Reserved",
|
||||||
|
"CC BY-NC 4.0",
|
||||||
|
"No Copyright"
|
||||||
|
],
|
||||||
|
"image_description": [
|
||||||
|
"ILFORD DELTA 3200",
|
||||||
|
"ILFORD ILFOCOLOR",
|
||||||
|
"LomoChrome Turquoise",
|
||||||
|
"Kodak 200"
|
||||||
|
],
|
||||||
|
"iso": [
|
||||||
|
"200",
|
||||||
|
"400",
|
||||||
|
"1600",
|
||||||
|
"3200"
|
||||||
|
],
|
||||||
|
"lens": [
|
||||||
|
"Nikon LENS SERIES E 50mm",
|
||||||
|
"AF NIKKOR 35-70mm",
|
||||||
|
"Canon FD 50mm f/1.4 S.S.C"
|
||||||
|
],
|
||||||
|
"make": [
|
||||||
|
"Nikon",
|
||||||
|
"Canon"
|
||||||
|
],
|
||||||
|
"model": [
|
||||||
|
"FG",
|
||||||
|
"F50",
|
||||||
|
"AE-1"
|
||||||
|
],
|
||||||
|
"user_comment": [
|
||||||
|
"Scanner.NORITSU-KOKI",
|
||||||
|
"Scanner.NA"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
self.write_yaml(file, def_exif)
|
||||||
|
|
||||||
def append_number_to_name(self, base_name: str, current_image: int, total_images: int, invert: bool):
|
def append_number_to_name(self, base_name: str, current_image: int, total_images: int, invert: bool):
|
||||||
""""Returns name, combination of base_name and ending number."""
|
""""Returns name, combination of base_name and ending number."""
|
||||||
total_digits = len(str(total_images))
|
total_digits = len(str(total_images))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue