aboutsummaryrefslogtreecommitdiff
path: root/src/client/apis/google_docs/GooglePhotosClientUtils.ts
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2020-05-07 18:13:16 -0400
committerBob Zeleznik <zzzman@gmail.com>2020-05-07 18:13:16 -0400
commit34db0a78d2dc8989313decf8993691f40847b231 (patch)
tree1b8739610442a64e033539cbb71696adf4148cd2 /src/client/apis/google_docs/GooglePhotosClientUtils.ts
parent51a1f88b4e975946eb5ac8cef75a122e197cd872 (diff)
fixes for adding/remove documents -- needs to be extended for views other than freeform.
Diffstat (limited to 'src/client/apis/google_docs/GooglePhotosClientUtils.ts')
-rw-r--r--src/client/apis/google_docs/GooglePhotosClientUtils.ts23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/client/apis/google_docs/GooglePhotosClientUtils.ts b/src/client/apis/google_docs/GooglePhotosClientUtils.ts
index ff471853a..1e4c120bc 100644
--- a/src/client/apis/google_docs/GooglePhotosClientUtils.ts
+++ b/src/client/apis/google_docs/GooglePhotosClientUtils.ts
@@ -153,21 +153,20 @@ export namespace GooglePhotos {
}
const tagMapping = new Map<string, string>();
const images = (await DocListCastAsync(collection.data))!.map(Doc.GetProto);
- images && images.forEach(image => tagMapping.set(image[Id], ContentCategories.NONE));
- const values = Object.values(ContentCategories);
+ images?.forEach(image => tagMapping.set(image[Id], ContentCategories.NONE));
+ const values = Object.values(ContentCategories).filter(value => value !== ContentCategories.NONE);
for (const value of values) {
- if (value === ContentCategories.NONE) {
- continue;
- }
- for (const id of (await ContentSearch({ included: [value] }))?.mediaItems?.map(({ id }) => id)) {
+ const searched = (await ContentSearch({ included: [value] }))?.mediaItems?.map(({ id }) => id);
+ console.log("Searching " + value);
+ console.log(searched);
+ searched?.forEach(async id => {
const image = await Cast(idMapping[id], Doc);
- if (!image) {
- continue;
+ if (image) {
+ const key = image[Id];
+ const tags = tagMapping.get(key);
+ !tags?.includes(value) && tagMapping.set(key, tags + delimiter + value);
}
- const key = image[Id];
- const tags = tagMapping.get(key);
- !tags?.includes(value) && tagMapping.set(key, tags + delimiter + value);
- }
+ });
}
images?.forEach(image => {
const concatenated = tagMapping.get(image[Id])!;