Git Product home page Git Product logo

photo-organizer's Introduction

photo-organizer

Original LLM Prompt

I'm creating a Python utility called "photo-organizer" that will handle automated title, description, and keyword tagging for my Apple Photos library. I'll be using MongoDB in a Docker Container, and Python will be the execution core.

To interact with Photos, photo-organizer will use the subprocess module to call JXA scripts that interact with Photos, and then return results to stdout.

I've already got the first JXA script working, so now we're going to start on the Python core.

I want the application to be modular, maintainable, robust, and it should explicitly handle errors.

Overview

The application will consist of several Python modules, each responsible for a specific part of the system's functionality:

  • main.py: Core controller of the application, coordinating the interactions between the other modules.
  • jxaHandler.py: Manages the execution of JXA scripts, interacting with the Apple Photos library.
  • mongoHandler.py: Handles all interactions with MongoDB for storing and retrieving photo metadata.
  • apiHandler.py: Centralized API request and response management, including error handling and logging.
  • awsHandler.py: Interacts with AWS Rekognition for automated photo tagging.
  • openAiHandler.py: Utilizes OpenAI's Vision API to enrich photo descriptions post-Rekognition analysis.

Environment Variables

Create a file called .env in the project root directory, replacing any relevant values for your setup:

MONGO_URL=mongodb://localhost:27017
DB_NAME=photoOrganizer
COLLECTION_NAME=mediaItemMetadata
AWS_ACCESS_KEY_ID=your_aws_access_key_id
AWS_SECRET_ACCESS_KEY=your_aws_secret_access_key
AWS_REGION=us-east-2
OPENAI_API_KEY=your_openai_api_key
REKOGNITION_COLLECTION_ID=photo-organizer-collection

Detailed Module Design

main.py

Orchestrates the application flow. Manages module interactions and handles high-level exceptions.

jxaHandler.py

Executes JXA scripts using subprocess. Parses and returns results from stdout. Handles errors specifically related to JXA script execution.

mongoHandler.py

Establishes and maintains the MongoDB connection. Implements CRUD operations for photo metadata. Handles database-related exceptions.

apiHandler.py

Standardizes API interactions. Implements common request-response patterns. Manages logging and centralized error handling.

awsHandler.py

Interfaces with AWS Rekognition. Handles API calls and processes responses. Manages errors and retries for AWS services.

openAiHandler.py

Communicates with OpenAI Vision API. Processes and enhances descriptions based on AI analysis. Handles API-specific errors and data parsing.

Error Handling

Each module will include robust error handling to manage and log exceptions specific to their operations. The main.py will handle any uncaught exceptions from the modules, ensuring the application can gracefully recover or terminate.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.