from pathlib import Path
from src.timeGeo import timeGeoObject
from fastcrc import crc64
import numpy  as np
from src.db_skeleton import dbs_class
import logging
def process_file(db: dbs_class, fname: Path) -> any:
    hash=np.array([crc64.ecma_182(fname.stem.encode())]).astype(np.int64)[0]
    timeGeo_=db.is_in_image_db(hash)
    if timeGeo_ is None:
        logging.debug(f"New image {fname.stem} found")
        timeGeo_= timeGeoObject(hash,fname, None)
        db.insert_image(timeGeo_)
    else:
        logging.debug(f"Existing image {fname.stem} found")

    return timeGeo_