Files
immich-frame/src/immich_client.h
cottongin 679e9e1721 feat: wire up album filtering to photo queue
Album selection now controls which photos are displayed.
Uses POST /api/search/random with albumIds filter (Immich v3
compatible) instead of the removed GET /api/albums/{id} assets.

- Add albumIds parameter to fetchRandomAssets/fetchRandomAssetIds
- syncFromAlbums: fetch random assets filtered by selected albums
- syncFromAllPhotos: preserve existing global random behavior
- Album mode reshuffles on exhaustion instead of re-fetching
- 24h resync checks album assetCounts for changes before re-fetch
- requestSync + albums_changed action triggers queue rebuild on save
- timerWakeCycle respects album selection
- Discard stale pre-renders on album change

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-03 22:46:17 -04:00

53 lines
1.4 KiB
C++

#pragma once
#include <Arduino.h>
#include <vector>
#include "settings.h"
struct AlbumInfo {
String id;
String title;
int assetCount;
};
struct AssetInfo {
String id;
String originalFileName;
String dateTime;
String city;
String camera;
bool isFavorite;
bool isPortrait;
std::vector<String> people;
};
struct RandomAsset {
String id;
String dateTime;
};
class ImmichClient {
public:
void begin(const String& baseUrl, const String& apiKey);
std::vector<AlbumInfo> fetchAlbums();
std::vector<String> fetchAlbumAssetIds(const String& albumId);
std::vector<String> fetchRandomAssetIds(int count = 50,
const std::vector<String>& albumIds = {});
std::vector<RandomAsset> fetchRandomAssets(int count = 50,
const std::vector<String>& albumIds = {});
std::vector<String> fetchFavoriteAssetIds();
AssetInfo fetchAssetInfo(const String& assetId);
bool downloadAsset(const String& assetId, ImageQuality quality,
uint8_t** outBuffer, size_t* outSize);
private:
String _baseUrl;
String _apiKey;
String buildUrl(const String& path);
String httpGet(const String& url);
String httpPost(const String& url, const String& body);
char* httpGetPsram(const String& url, size_t* outLen);
bool httpGetBinary(const String& url, uint8_t** outBuffer, size_t* outSize);
};