add more immich control options
This commit is contained in:
@@ -105,6 +105,14 @@ QVector<ImmichAsset> ImmichClient::fetchAssets()
|
||||
bool triedZero = false;
|
||||
int page = 1;
|
||||
|
||||
if (ShouldLog())
|
||||
{
|
||||
Log("Immich search: size=", config.size, ", order=", config.order,
|
||||
", pageSize=", pageSize, ", maxAssets=", maxAssets,
|
||||
", albumIds=", config.albumIds.size(),
|
||||
", personIds=", config.personIds.size());
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
QJsonObject body;
|
||||
@@ -121,6 +129,13 @@ QVector<ImmichAsset> ImmichClient::fetchAssets()
|
||||
ids.append(QString::fromStdString(id));
|
||||
body["albumIds"] = ids;
|
||||
}
|
||||
if (config.personIds.size() > 0)
|
||||
{
|
||||
QJsonArray ids;
|
||||
for (const auto &id : config.personIds)
|
||||
ids.append(QString::fromStdString(id));
|
||||
body["personIds"] = ids;
|
||||
}
|
||||
|
||||
QByteArray response = postJson(apiUrl("/search/metadata"), body, nullptr, kMetadataTimeoutMs);
|
||||
if (response.isEmpty())
|
||||
@@ -134,6 +149,7 @@ QVector<ImmichAsset> ImmichClient::fetchAssets()
|
||||
QJsonObject assetsObj = root["assets"].toObject();
|
||||
QJsonArray items = assetsObj["items"].toArray();
|
||||
int total = assetsObj["total"].toInt();
|
||||
Log("Immich page ", page, ": ", items.size(), " assets (total ", total, ")");
|
||||
if (items.isEmpty())
|
||||
{
|
||||
if (total > 0 && page == 1 && !triedZero)
|
||||
@@ -194,6 +210,7 @@ bool ImmichClient::downloadAsset(const QString &assetId, QByteArray &data, QStri
|
||||
url.setQuery(query);
|
||||
}
|
||||
|
||||
Log("Immich download asset ", assetId.toStdString(), " (", size.toStdString(), ")");
|
||||
QByteArray payload = getBytes(url, &contentType, kAssetTimeoutMs);
|
||||
if (payload.isEmpty())
|
||||
return false;
|
||||
@@ -297,7 +314,10 @@ QString ImmichAssetCache::getCachedPath(const QString &assetId, const QString &a
|
||||
|
||||
QString existing = findExisting(assetId);
|
||||
if (!existing.isEmpty())
|
||||
{
|
||||
Log("Immich cache hit: ", assetId.toStdString());
|
||||
return existing;
|
||||
}
|
||||
|
||||
QByteArray data;
|
||||
QString contentType;
|
||||
@@ -318,6 +338,8 @@ QString ImmichAssetCache::getCachedPath(const QString &assetId, const QString &a
|
||||
if (!file.commit())
|
||||
return "";
|
||||
|
||||
Log("Immich cached asset: ", assetId.toStdString(), " -> ", filePath.toStdString());
|
||||
|
||||
if (cacheMaxBytes > 0)
|
||||
{
|
||||
if (!cacheSizeKnown)
|
||||
|
||||
Reference in New Issue
Block a user