Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jindalshreyansh opened this issue May 21, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@jindalshreyansh
Copy link

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?

@xob0t
Copy link
Owner

xob0t commented May 21, 2024

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 xob0t added the enhancement New feature or request label May 21, 2024
@jindalshreyansh
Copy link
Author

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.

@xob0t
Copy link
Owner

xob0t commented May 22, 2024

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
Copy link
Owner

xob0t commented Jun 21, 2024

@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

@leocrawford
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants