Move constants into constants.py

This commit is contained in:
2023-05-12 02:40:15 -05:00
parent 5648c5533c
commit 76182fe2f3
4 changed files with 14 additions and 7 deletions

View File

@@ -36,8 +36,3 @@ logger.info("Path constants built successfully...")
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = os.path.join(CONFIG_PATH, config.config["google"]["credentials"])
# Extension Constants
RAW_EXTS = ["3fr", "ari", "arw", "bay", "braw", "crw", "cr2", "cr3", "cap", "data", "dcs", "dcr", "dng", "drf", "eip",
"erf", "fff", "gpr", "iiq", "k25", "kdc", "mdc", "mef", "mos", "mrw", "nef", "nrw", "obm", "orf", "pef",
"ptx", "pxn", "r3d", "raf", "raw", "rwl", "rw2", "rwz", "sr2", "srf", "srw", "tif", "x3f", ]
LOSSY_EXTS = ["jpeg", "jpg", "jpe", "png"]

10
phototag/constants.py Normal file
View File

@@ -0,0 +1,10 @@
from pathlib import Path
# Root directory of the project
PROJECT_ROOT: Path = Path(__file__).parent.parent
# Extension Constants
RAW_EXTS = ["3fr", "ari", "arw", "bay", "braw", "crw", "cr2", "cr3", "cap", "data", "dcs", "dcr", "dng", "drf", "eip",
"erf", "fff", "gpr", "iiq", "k25", "kdc", "mdc", "mef", "mos", "mrw", "nef", "nrw", "obm", "orf", "pef",
"ptx", "pxn", "r3d", "raf", "raw", "rwl", "rw2", "rwz", "sr2", "srf", "srw", "tif", "x3f", ]
LOSSY_EXTS = ["jpeg", "jpg", "jpe", "png"]

View File

@@ -12,7 +12,8 @@ from glob import glob
from pathlib import Path
from typing import List, Optional, Tuple, Generator
from phototag import LOSSY_EXTS, RAW_EXTS, CWD
from phototag import CWD
from phototag.constants import LOSSY_EXTS, RAW_EXTS
from phototag.exceptions import PhototagException, InvalidSelectionError
ALL_EXTENSIONS = RAW_EXTS + LOSSY_EXTS

View File

@@ -21,7 +21,8 @@ from PIL import Image
from google.cloud import vision
from rich.progress import Progress
from phototag import TEMP_PATH, RAW_EXTS, CWD
from phototag import TEMP_PATH, CWD
from phototag.constants import RAW_EXTS
from phototag.exceptions import InvalidConfigurationError, NoSidecarFileError
from phototag.helpers import random_characters
from phototag.xmp import XMPParser