# relhirs/wallget architecture

> Architecture diagram of the GitHub repository relhirs/wallget, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/relhirs/wallget
- Repository: https://github.com/relhirs/wallget

## Overview

#### Purpose and Entry Point
WallGet is a standalone macOS command-line utility for managing Apple live-wallpaper video assets: discovering locally installed assets, downloading missing ones from Apple, and deleting selected files. The sole executable and application boundary is `wallget.py`.

#### Runtime and Operating-System Integration
The script runs under Python 3 on macOS Sonoma or later. It detects which Apple wallpaper storage model is active:
- Per-user Sonoma-era storage under `~/Library/Application Support/com.apple.wallpaper/aerials`
- Legacy system-wide storage under `/Library/Application Support/com.apple.idleassetsd`

Legacy operations require administrator execution because they modify a protected system directory. The implementation is contained in `wallget.py`.

#### Catalog Discovery and Asset State
`wallget.py` enumerates Apple’s wallpaper catalog, organizes assets into categories, and compares each catalog entry with the applicable local storage directory. Local download status is determined from file presence and expected manifest size, allowing incomplete files to be treated as missing.

#### Interactive Selection Flow
The CLI presents category counts, then assets for the chosen category or full catalog. Users select individual assets, comma-separated groups, ranges, or all entries, then choose download or deletion. This selection layer constrains later filesystem and network work to explicitly selected targets. Entry-point and UI flow reside in `wallget.py`.

#### Download Pipeline
For download actions, `wallget.py` calculates the required transfer size, verifies free disk capacity, obtains confirmation, and streams only missing or incomplete assets over HTTPS from Apple’s CDN. Correctly sized existing files are skipped, avoiding redundant transfers.

#### Deletion and Daemon Refresh
Deletion is limited to selected local asset files. In legacy mode, after file mutations, `wallget.py` can stop the macOS `idleassetsd` daemon so Wallpaper settings promptly observe the changed asset inventory; otherwise the operating system refreshes state after reboot.

#### External Boundaries
Primary external dependencies are Apple’s wallpaper catalog/CDN over HTTPS, the local macOS wallpaper asset directories, filesystem free-space and file-size metadata, and—in legacy mode—the `idleassetsd` system daemon. There is no separate service, package structure, or persistent application database beyond the wallpaper files themselves.

Main entry points: [`wallget.py`](https://github.com/relhirs/wallget/blob/main/wallget.py) (Download pipeline)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["WallGet CLI"]
  node_entry["wallget.py<br/>Python entry point<br/>[wallget.py]"]
  node_catalog["Catalog discovery<br/>catalog enumerator<br/>[wallget.py]"]
  node_storage_mode["Storage mode detection<br/>OS storage resolver<br/>[wallget.py]"]
  node_asset_state["Asset state check<br/>manifest verifier<br/>[wallget.py]"]
  node_selection["Interactive selection<br/>terminal UI<br/>[wallget.py]"]
  node_action["Action dispatcher<br/>command flow<br/>[wallget.py]"]
  node_download["Download pipeline<br/>HTTPS transfer<br/>[wallget.py]"]
  node_deletion["Selected-file deletion<br/>filesystem mutation<br/>[wallget.py]"]
end

subgraph group_macos["macOS Integration"]
  node_sonoma_store[("Sonoma user asset store<br/>macOS directory")]
  node_legacy_store[("Legacy system asset store<br/>protected macOS directory")]
  node_disk_metadata["Filesystem metadata<br/>OS filesystem API"]
  node_idleassetsd{{"idleassetsd daemon<br/>macOS system daemon"}}
end

subgraph group_apple["Apple Network"]
  node_apple_catalog["Apple wallpaper catalog<br/>external catalog"]
  node_apple_cdn["Apple CDN<br/>HTTPS asset source"]
end

node_entry -->|"enumerates"| node_catalog
node_entry -->|"detects"| node_storage_mode
node_catalog -->|"reads catalog"| node_apple_catalog
node_storage_mode -->|"Sonoma mode"| node_sonoma_store
node_storage_mode -->|"legacy mode"| node_legacy_store
node_catalog -->|"catalog entries"| node_asset_state
node_storage_mode -->|"active directory"| node_asset_state
node_asset_state -->|"checks sizes"| node_disk_metadata
node_asset_state -->|"availability and categories"| node_selection
node_selection -->|"selected targets and action"| node_action
node_action -->|"download"| node_download
node_action -->|"delete"| node_deletion
node_download -->|"verifies free space"| node_disk_metadata
node_download -->|"streams missing assets"| node_apple_cdn
node_download -->|"writes in Sonoma mode"| node_sonoma_store
node_download -->|"writes in legacy mode"| node_legacy_store
node_deletion -->|"removes selected files"| node_sonoma_store
node_deletion -->|"removes selected files"| node_legacy_store
node_deletion -.->|"stops after legacy mutation"| node_idleassetsd

click node_entry "https://github.com/relhirs/wallget/blob/main/wallget.py"
click node_catalog "https://github.com/relhirs/wallget/blob/main/wallget.py"
click node_storage_mode "https://github.com/relhirs/wallget/blob/main/wallget.py"
click node_asset_state "https://github.com/relhirs/wallget/blob/main/wallget.py"
click node_selection "https://github.com/relhirs/wallget/blob/main/wallget.py"
click node_action "https://github.com/relhirs/wallget/blob/main/wallget.py"
click node_download "https://github.com/relhirs/wallget/blob/main/wallget.py"
click node_deletion "https://github.com/relhirs/wallget/blob/main/wallget.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_catalog,node_storage_mode,node_asset_state,node_selection,node_action,node_download,node_deletion toneBlue
class node_sonoma_store,node_legacy_store,node_disk_metadata,node_idleassetsd toneAmber
class node_apple_catalog,node_apple_cdn toneMint
```

## Components

### WallGet CLI

Single-process Python command-line application.

- [wallget.py](https://github.com/relhirs/wallget/blob/main/wallget.py): Python entry point · Standalone executable and application boundary. · `wallget.py`
- [Catalog discovery](https://github.com/relhirs/wallget/blob/main/wallget.py): catalog enumerator · Organizes Apple wallpaper assets into categories. · `wallget.py`
- [Storage mode detection](https://github.com/relhirs/wallget/blob/main/wallget.py): OS storage resolver · Selects Sonoma per-user or legacy system storage. · `wallget.py`
- [Asset state check](https://github.com/relhirs/wallget/blob/main/wallget.py): manifest verifier · Uses presence and expected size to identify missing or incomplete assets. · `wallget.py`
- [Interactive selection](https://github.com/relhirs/wallget/blob/main/wallget.py): terminal UI · Accepts individual, grouped, ranged, or all catalog selections. · `wallget.py`
- [Action dispatcher](https://github.com/relhirs/wallget/blob/main/wallget.py): command flow · Routes selected assets to download or deletion. · `wallget.py`
- [Download pipeline](https://github.com/relhirs/wallget/blob/main/wallget.py): HTTPS transfer · Checks capacity and confirmation before streaming only needed assets. · `wallget.py`
- [Selected-file deletion](https://github.com/relhirs/wallget/blob/main/wallget.py): filesystem mutation · Removes only selected local asset files. · `wallget.py`

### macOS Integration

- **Sonoma user asset store**: macOS directory · ~/Library/Application Support/com.apple.wallpaper/aerials
- **Legacy system asset store**: protected macOS directory · /Library/Application Support/com.apple.idleassetsd; requires administrator access.
- **Filesystem metadata**: OS filesystem API · Provides file sizes and free-space capacity.
- **idleassetsd daemon**: macOS system daemon · Can be stopped after legacy mutations to refresh Wallpaper inventory.

### Apple Network

- **Apple wallpaper catalog**: external catalog
- **Apple CDN**: HTTPS asset source

## Connections

- wallget.py → Catalog discovery: enumerates
- wallget.py → Storage mode detection: detects
- Catalog discovery → Apple wallpaper catalog: reads catalog
- Storage mode detection → Sonoma user asset store: Sonoma mode
- Storage mode detection → Legacy system asset store: legacy mode
- Catalog discovery → Asset state check: catalog entries
- Storage mode detection → Asset state check: active directory
- Asset state check → Filesystem metadata: checks sizes
- Asset state check → Interactive selection: availability and categories
- Interactive selection → Action dispatcher: selected targets and action
- Action dispatcher → Download pipeline: download
- Action dispatcher → Selected-file deletion: delete
- Download pipeline → Filesystem metadata: verifies free space
- Download pipeline → Apple CDN: streams missing assets
- Download pipeline → Sonoma user asset store: writes in Sonoma mode
- Download pipeline → Legacy system asset store: writes in legacy mode
- Selected-file deletion → Sonoma user asset store: removes selected files
- Selected-file deletion → Legacy system asset store: removes selected files
- Selected-file deletion → idleassetsd daemon: stops after legacy mutation
