fix(ImmichElias): show >50 photos via random pagination, filter IMAGE only, increase to 100, JSON 128KB, slideshow + cache
This commit is contained in:
@@ -31,8 +31,8 @@ static const char* TAG = "ImmichElias";
|
||||
|
||||
#define RESIZE_PROXY_URL "http://192.168.68.110:8106"
|
||||
|
||||
#define MAX_PHOTOS 50
|
||||
#define JSON_BUF_SIZE (64 * 1024)
|
||||
#define MAX_PHOTOS 100
|
||||
#define JSON_BUF_SIZE (128 * 1024)
|
||||
#define THUMB_BUF_SIZE (512 * 1024)
|
||||
|
||||
#define FALLBACK_W 320
|
||||
@@ -157,8 +157,15 @@ static int fetch_person_assets(void) {
|
||||
HttpBuf hb = { .buf = (uint8_t*)json_buf, .cap = JSON_BUF_SIZE - 1, .len = 0 };
|
||||
char url[256];
|
||||
snprintf(url, sizeof(url), "%s/api/search/metadata", IMMICH_BASE_URL);
|
||||
char body[256];
|
||||
snprintf(body, sizeof(body), "{\"personIds\":[\"%s\"],\"size\":%d}", IMMICH_PERSON_ID, MAX_PHOTOS);
|
||||
// Pick random page to get variety from 10k+ photos
|
||||
// Estimate total photos 10739, with MAX_PHOTOS 100 => ~107 pages
|
||||
int total_estimate = 10739;
|
||||
int max_page = total_estimate / MAX_PHOTOS;
|
||||
if (max_page < 1) max_page = 1;
|
||||
int random_page = (esp_random() % max_page) + 1;
|
||||
char body[320];
|
||||
snprintf(body, sizeof(body), "{\"personIds\":[\"%s\"],\"size\":%d,\"page\":%d}", IMMICH_PERSON_ID, MAX_PHOTOS, random_page);
|
||||
ESP_LOGI(TAG, "Fetching person assets page %d/%d size %d", random_page, max_page, MAX_PHOTOS);
|
||||
int status = http_post_json(url, body, &hb);
|
||||
if (status != 200) { heap_caps_free(json_buf); return -1; }
|
||||
if (hb.len >= JSON_BUF_SIZE) hb.len = JSON_BUF_SIZE - 1;
|
||||
|
||||
Reference in New Issue
Block a user