How viniciusarz/figurefeed-ai works
Purpose and execution
figurefeed-ai is a Python 3.12 batch automation pipeline that turns unposted anime-figure photos in a Google Photos album into Instagram Business posts. The operational entry point is post_figurefeed.py; it delegates orchestration to workflow.py. A root config.json (runtime secret/config boundary) supplies Google Photos, OpenAI, Meta, and Imgur credentials and identifiers.
Workflow orchestration
workflow.py is the central control-flow layer. Its intended sequence is: list album photos, exclude already-published items, obtain image bytes, identify the figure, generate a caption, temporarily host the image, create an Instagram post, then remove the temporary image. post_figurefeed.py is the executable wrapper for this workflow, suitable for manual or scheduler-driven invocation.
Paths: post_figurefeed.py, workflow.py.
Google Photos ingestion and deduplication
The Google Photos adapter retrieves album media and supports inspection of albums/media identifiers. It forms the source-system boundary and supplies both candidate photo metadata and downloadable content. Deduplication checks whether an album photo has already been processed/published before expensive AI or posting stages; persistent state is not evident in the supplied tree, so this likely depends on remote metadata or workflow logic.
Paths: google_photos_client/google_photos_client.py, google_photos_client/check_album_photos.py, google_photos_client/check_folder_ids.py.
AI figure understanding
Figure identification is isolated from caption writing. agents/identify_figure.py uses OpenAI models to derive figure information from image input. That result becomes structured/contextual input to caption generation rather than being directly posted, creating a clear AI-enrichment boundary.
Paths: agents/identify_figure.py, agents/get_caption.py.
CrewAI caption generation
Caption generation is implemented as a CrewAI agent/task configuration plus execution code. Agent roles and task prompts are externalized in YAML, allowing editorial behavior to change without reshaping the workflow. agents/crew.py assembles/runs the configured CrewAI process and returns post-ready text.
Paths: agents/crew.py, agents/config/agents.yaml, agents/config/tasks.yaml.
Publication and temporary media hosting
Instagram Graph publishing requires a publicly reachable image URL, so Imgur is a transient transport/storage boundary between local Google Photos bytes and Meta’s API. The workflow uploads first, invokes the Instagram client to publish, and deletes the Imgur asset afterward. Publishing requires an Instagram Business account linked to a Facebook Page and a Meta long-lived token.
Paths: meta_client/instagram_client.py, workflow.py, post_figurefeed.py.
External systems and operational dependencies
Material integrations are Google Photos Library API, OpenAI, CrewAI, Imgur API, and Meta/Instagram Graph API. Poetry manages the Python environment (pyproject.toml). Token lifecycle support is separated from publication logic in meta_client/meta_long_lived_token.py, enabling renewal of Meta credentials without modifying the posting pipeline.
Paths: pyproject.toml, meta_client/meta_long_lived_token.py, agents/crew.py.
Main entry points: workflow.py Posting workflow · crew.py Caption generation · google_photos_client.py Google Photos client · identify_figure.py Figure identification
Components 18
Batch Runtime
- Post command · Manual or scheduler-driven entry point.
post_figurefeed.py - Posting workflow · Coordinates the end-to-end posting sequence.
workflow.py - Runtime config · Supplies integration credentials and identifiers.
- Poetry environment
pyproject.toml
Photo Ingestion
- Google Photos client · Lists album media and downloads image content.
google_photos_client/google_photos_client.py - Album inspection · Inspects album and media identifiers.
google_photos_client/check_album_photos.py - Folder ID inspection
google_photos_client/check_folder_ids.py - Google Photos API
- Published-item filter · Excludes already processed album photos.
workflow.py
AI Enrichment
- Figure identification · Derives figure information from image input.
agents/identify_figure.py - Caption generation · Produces post-ready caption text.
agents/crew.py - Agent roles
agents/config/agents.yaml - Caption tasks
agents/config/tasks.yaml - OpenAI
Publication
- Imgur API · Provides a public image URL for publishing.
- Instagram publisher · Creates Instagram Business posts.
meta_client/instagram_client.py - Instagram Graph API
- Meta token renewal · Renews Meta long-lived credentials separately from publishing.
meta_client/meta_long_lived_token.py
Connections 22
- Post command → Posting workflow: invokes
- Runtime config → Posting workflow: runtime settings
- Poetry environment → Post command: defines dependencies
- Posting workflow → Google Photos client: lists and downloads
- Google Photos client → Google Photos API: album media requests
- Album inspection → Google Photos API: inspects media
- Folder ID inspection → Google Photos API: inspects identifiers
- Google Photos client → Published-item filter: candidate metadata
- Published-item filter → Posting workflow: unposted photos
- Posting workflow → Figure identification: image bytes
- Figure identification → OpenAI: vision request
- Figure identification → Caption generation: figure context
- Agent roles → Caption generation: defines roles
- Caption tasks → Caption generation: defines prompts
- Caption generation → OpenAI: generation request
- Caption generation → Posting workflow: caption text
- Posting workflow → Imgur API: uploads image bytes
- Imgur API → Instagram publisher: public image URL
- Posting workflow → Instagram publisher: publishes caption and media
- Instagram publisher → Instagram Graph API: creates post
- Posting workflow → Imgur API: deletes temporary asset
- Meta token renewal → Instagram Graph API: renews long-lived token