Add reverse geocoding location support and fix NoneType error

- Add location template inputs (common_location_template, location_if_unique_template, location_format)
- Display common location in header when all assets share the same location
- Show per-asset location when locations differ using {location_if_unique}
- Location only shown when all three fields (city, state, country) are present
- Fix TypeError on NoneType length check when asset.created_at is null
- Add defensive checks for date parsing to prevent template errors

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-01 02:51:15 +03:00
parent 7b00899903
commit e63bb3da95
3 changed files with 132 additions and 16 deletions

View File

@@ -71,6 +71,9 @@ Each item in `added_assets` contains:
| `playback_url` | Video playback URL (for VIDEO assets only, if shared link exists) |
| `photo_url` | Photo preview URL (for IMAGE assets only, if shared link exists) |
| `people` | List of people detected in this specific asset |
| `city` | City name from reverse geocoding (if available) |
| `state` | State/region name from reverse geocoding (if available) |
| `country` | Country name from reverse geocoding (if available) |
## Message Template Variables
@@ -86,6 +89,7 @@ All message templates support these placeholder variables (use single braces):
| `{assets}` | Formatted list of added assets (using asset item template) |
| `{video_warning}` | Warning about video size limits (Telegram only, empty otherwise) |
| `{common_date}` | Common date formatted with template if all assets share same date, empty otherwise |
| `{common_location}` | Common location formatted with template if all assets share same location (requires city, state, country), empty otherwise |
## Asset Item Template Variables
@@ -107,6 +111,11 @@ These variables can be used in the image and video asset templates. Also used fo
| `{album_name}` | Name of the album |
| `{is_favorite}` | Favorite indicator (using template) if asset is favorite, empty otherwise |
| `{rating}` | User rating (1-5) or empty if not rated |
| `{location}` | Formatted location string (using location format template), empty if location data incomplete |
| `{location_if_unique}` | Location formatted with template if locations differ between assets, empty if all same or data incomplete |
| `{city}` | City name from reverse geocoding, empty if not available |
| `{state}` | State/region name from reverse geocoding, empty if not available |
| `{country}` | Country name from reverse geocoding, empty if not available |
## Telegram Media Attachments