Google-Photos-Toolkit icon indicating copy to clipboard operation
Google-Photos-Toolkit copied to clipboard

[Feature Idea] Any way to search for all photos "Shared by a Google user"?

Open jindalshreyansh opened this issue 1 year ago • 5 comments

My library consist of photos that I saved from various shared album and partner account. Now, I have filtered photos not owned by me using gptk, can I futher filter them by ownership of specific person?

jindalshreyansh avatar May 21 '24 17:05 jindalshreyansh

theoretically possible, but would require sending a request to get each file's info, so it would be slow

and be vary of the ownership filter, it produces inconsistent results

xob0t avatar May 21 '24 17:05 xob0t

Ownership filter worked fine for me, it separated all files not owned by me in a separate album. Could you guide what request to send in order to get photos owned by specific people.

jindalshreyansh avatar May 22 '24 15:05 jindalshreyansh

It would not be possible to just get all media owned by "x", the only way is to scan the library, then for each media item send a request to get that info, and filter based on it.

xob0t avatar May 22 '24 16:05 xob0t

@jindalshreyansh @leocrawford

Here is a little POC script to find and delete "shared by x" items. Goes over the whole library one item at a time. If item's sharedByUserName matches sharedByName, moves the item to trash. Paste it to your browser's console. Reload the page to stop the script.

let nextPageId = null;
const ownerName = 'John';
do {
  const page = await gptkApi.getItemsByUploadedDate(nextPageId);
  for (const item of page.items){
    if (item.isOwned) continue
    const itemInfo = await gptkApi.getItemInfo(item.mediaKey);
    if (itemInfo.owner.name == ownerName){
      await gptkApi.moveItemsToTrash([itemInfo.dedupKey]);
      console.log('item moved to trash', itemInfo);
    }
  }
  nextPageId = page.nextPageId;
} while (nextPageId);
console.log("DONE")

04.07.24 - updated the script to work with the latest version of gptk

xob0t avatar Jun 21 '24 16:06 xob0t

Thank you so much. That's really helpful. In the end I archived by date uploaded, restored those taken by my partners phone, and deleted those in archive - but this would have been much better, and is what I'll use next time (if there is a next time).

I'm also rebuilding my own library from scratch, using my own API key (rather than rclones) so I can share albums, rather than rely on partner sharing. SO much learnt. Your tool has been an invaluable part of fixing my own mistakes, so thank you.

leocrawford avatar Jun 23 '24 11:06 leocrawford