Hooks let you run external scripts or programs at key points in the gallery lifecycle. Combined with JSON key mappings, they create a pipeline where external tool output flows directly into your BBCode templates.
Three events are available:
| Event | When It Fires |
|---|---|
| On Gallery Added | When a gallery is added to the queue |
| On Gallery Started | When a gallery upload begins |
| On Gallery Completed | When a gallery upload finishes successfully |
Go to Settings > Hooks (or click the App Hooks button) and configure any of the three events.
Each hook has a command template — a command line with % variables that get replaced with gallery data at runtime:
python my_script.py "%N" "%p" --images %C
Available variables:
| Variable | Description | Available |
|---|---|---|
%N |
Gallery name | All events |
%T |
Tab name | All events |
%p |
Gallery folder path | All events |
%C |
Number of images | All events |
%s |
Gallery size in bytes | All events |
%t |
Template name | All events |
%z |
ZIP archive path (created on demand) | All events |
%e1-%e4 |
ext field values | All events |
%c1-%c4 |
custom field values | All events |
%g |
Gallery ID | On Completed only |
%j |
JSON artifact path | On Completed only |
%b |
BBCode artifact path | On Completed only |
Use %% for a literal percent sign.
The Insert % Variable dropdown and live preview help you build commands. Click Run Test Command to test with sample data before saving.
!!! tip
Always wrap % variables in quotes in your command template (e.g., "%N" not %N) to handle gallery names with spaces.
This is where hooks become powerful. If your external program outputs JSON to stdout, BBDrop can map specific keys back into the gallery’s ext fields.
{"download_url": "https://example.com/abc123", "file_id": "abc123"}
download_urlfile_idBBDrop parses the JSON, extracts the values, and stores them in the gallery’s ext1 and ext2 fields.
#ext1# and #ext4#:
[if ext1]Download: [url=#ext1#]Link[/url][/if]
When you click Run Test Command, the output panel shows:
BBDrop can auto-detect URLs, file paths, and IDs in the output and suggest mappings.
A script that uploads an archive to a custom host and returns the link:
Command:
python upload_to_host.py "%z" --name "%N"
Script output:
{"url": "https://myhost.com/files/abc123"}
Mapping: ext1 → url
Template usage:
[if ext1]My Host: [url=#ext1#]Download[/url][/if]
The download link appears in your BBCode automatically, only when a URL was actually returned.
Upload to both GoFile and Pixeldrain after gallery completion, then reference both links in your template.
Hook 1 — GoFile:
python hooks/muh.py gofile "%z"
Mapping: ext1 → download_link
Hook 2 — Pixeldrain:
python hooks/muh.py pixeldrain "%z"
Mapping: ext2 → download_link
Template usage:
[b]Download Links:[/b]
[url=#ext1#]GoFile[/url] | [url=#ext2#]Pixeldrain[/url]
Each hook maps its output to a different ext field, so the template can reference both links.
"%N" not %N%e1 are matched before single-character ones like %e