# anderbggo/googlephotosmatcher architecture

> Architecture diagram of the GitHub repository anderbggo/googlephotosmatcher, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/anderbggo/googlephotosmatcher
- Repository: https://github.com/anderbggo/googlephotosmatcher

## Overview

##### Project Type and Purpose
- This is a standalone desktop application (packaged as an executable, GPMatcher.exe) designed to update image/video files with metadata extracted from accompanying JSON files.
- Its primary function is to process downloaded Google Photos content, match JSON metadata with corresponding media, and output the updated files into designated folders (Matched and EditedRaw).

##### Main Components
a. User Interface (UI)
- Represented primarily by the contents of files/window.py.
- This component handles user interactions like selecting the download folder and triggering the matching process.

b. Application Controller/Engine
- Represented by files/main.py which likely acts as the entry point. It integrates the UI with the core business logic.
- It coordinates the overall flow when the executable (GPMatcher.exe) is launched.

c. Core Matching Logic
- Encapsulated in files/auxFunctions.py which contains the algorithm used to match JSON data with image/video metadata.
- This module handles parsing of JSON, reading media file attributes, and performing the matching and renaming operations.

d. File System and I/O Operations
- Input: User-selected folder containing both JSON files and media files.
- Outputs: Creation of the “Matched” and “EditedRaw” folders for storing processed files.

e. External Dependencies/Resources
- Though minimal, include the user’s file browser interaction (such as folder selection) and the underlying file system operations (reading and writing to disk).

##### Relationships and Interactions
- The UI forwards user actions to the Controller (main.py), which in turn calls the Core Matching Logic (auxFunctions.py).
- The Core Matching Logic interacts with the file system: reading JSON metadata and image/video files, performing look-ups, and then writing the updated files into the “Matched” (and, if applicable, “EditedRaw”) folders.
- Optionally, feedback from the matching process is relayed back to the UI to update the user regarding the success or any issues (for example, unmatched cases due to special characters).

##### Technologies/Frameworks to Mention
- Python as the programming language (as inferred from .py files).
- Likely used GUI toolkit in files/window.py (could be Tkinter, PyQt or similar), though the exact framework isn’t mentioned – indicate it as “GUI Framework.”
- File system operations through standard Python libraries.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Entities
    U("User"):::user
    Exec("Executable Package (GPMatcher.exe)"):::exec

    %% Main Application Layers
    subgraph "Application Layer"
        direction TB
        UI("User Interface (window.py)"):::ui
        Controller("Application Controller (main.py)"):::controller
        Core("Core Matching Logic (auxFunctions.py)"):::core
    end

    subgraph "File System I/O"
        direction TB
        Input["Input Folder\n(JSON & Media Files)"]:::fs
        Matched["Matched Folder\n(Output)"]:::fs
        EditedRaw["EditedRaw Folder\n(Output)"]:::fs
    end

    %% Connections
    U -->|"Launches"| Exec
    Exec -->|"Starts"| UI
    U -->|"Selects folder"| UI
    UI -->|"Triggers Process"| Controller
    Controller -->|"Calls Matching"| Core
    Core -->|"Reads JSON/Media"| Input
    Core -->|"Writes Processed Files"| Matched
    Core -->|"Writes Backup Files"| EditedRaw
    Core -->|"Sends Feedback"| UI

    %% Click Events
    click UI "https://github.com/anderbggo/googlephotosmatcher/blob/main/files/window.py"
    click Controller "https://github.com/anderbggo/googlephotosmatcher/blob/main/files/main.py"
    click Core "https://github.com/anderbggo/googlephotosmatcher/blob/main/files/auxFunctions.py"
    click Exec "https://github.com/anderbggo/googlephotosmatcher/blob/main/GPMatcher.exe"

    %% Styles
    classDef user fill:#d0e6ff,stroke:#1a73e8,stroke-width:2px;
    classDef exec fill:#fdd835,stroke:#f9a825,stroke-width:2px;
    classDef ui fill:#b3e5fc,stroke:#039be5,stroke-width:2px,stroke-dasharray: 5 5;
    classDef controller fill:#c8e6c9,stroke:#388e3c,stroke-width:2px;
    classDef core fill:#ffe0b2,stroke:#f57c00,stroke-width:2px;
    classDef fs fill:#e1bee7,stroke:#8e24aa,stroke-width:2px,stroke-dasharray: 2 2;
```
