diff --git a/TODO b/TODO index e876ab4..b522b14 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,10 @@ ### GENERAL * change the rotation code to use that jpeg util to reduce/remove compression loss? + * allow changing dates in move dbox and then re-scan for existing folders OR just have a browse for existing... + - for use on scanned photos, they register as 2010, but are datestamped in visuals for 95 + (is there a library for this???) + * read this: https://flask.palletsprojects.com/en/2.2.x/testing/#faking-resources-and-context * could get better AI optim, by keeping track of just new files since scan (even if we did this from the DB), @@ -25,6 +29,9 @@ job.py:@app.route("/jobs", methods=["GET", "POST"]) job.py:@app.route("/job/", methods=["GET","POST"]) -- these need to store 'job prefs' somewhere... (extras?) + * if on jobs page and jobs increase, then 'rebuild' the content of the page to show new jobs, and potentially do that every 5 seconds... + - THINK: could also 'refresh' /job/id via Ajax not a reload, to avoid the POST issue above needing to remember job prefs somewhere? + files.py:@app.route("/fix_dups", methods=["POST"]) ??? @@ -103,6 +110,7 @@ ### FUTURE: * real first-run, 'no or empty settings' -- need to think this through + - should set base_path to /pa (and then either /pa or /pa/import, /pa/storage, etc. can be 1 or more volume(s) in docker) * deal with changing a path in settings @@ -110,3 +118,89 @@ -NO sadly * work out why gitignore does not ignore say .pa_bin but has to ignore .pa_metada + +#### CHAT GPT f/b + +docstrings for documentation / example: + +def AddRefimgToPerson(person, refimg): + """ + Adds a reference image to a person object's list of reference images. + + Args: + person (Person): A Person object to which the reference image should be added. + refimg (str): The filepath to the reference image to be added. + + Returns: + None + + Raises: + ValueError: If person or refimg are None or empty strings. + TypeError: If person is not an instance of the Person class. + + Example: + person = Person(name="John Doe") + AddRefimgToPerson(person, "/path/to/reference/image.jpg") + """ + if not person: + raise ValueError("person is None or empty") + if not refimg: + raise ValueError("refimg is None or empty") + + if not isinstance(person, Person): + raise TypeError("person must be an instance of the Person class") + + person.add_reference_image(refimg) + + + +TESTING: + +def test_AddRefimgToPerson(): + # Create a test person object + person = Person(name='John Doe', age=30) + + # Create a test image object + image = Image(file_path='test.jpg', caption='Test image') + + # Call the function to add the image to the person + AddRefimgToPerson(person, image) + + # Check that the image was added to the person's list of images + assert image in person.images, "Image was not added to person's list of images" + + # Check that the image's reference to the person is set correctly + assert image.person == person, "Image's reference to person is not set correctly" + +TYPING: +look at from typing, e.g. ... + +from typing import Type + +def get_person_info(person: Type[Person]) -> str: + + +OR: + + +from typing import List + +def AddRefimgToPerson(person_id: int, ref_images: List[str]) -> bool: + """ + Adds reference images to a person's profile. + + Args: + person_id (int): The ID of the person whose profile should be updated. + ref_images (List[str]): A list of file paths or URLs for the reference images to add. + + Returns: + bool: True if the images were successfully added, False otherwise. + + Raises: + ValueError: If person_id is not a positive integer or if ref_images is empty or contains + any non-string values. + + Example: + >>> AddRefimgToPerson(123, ['http://example.com/img1.jpg', '/path/to/img2.png']) + True + """