All Projects → tanaikech → GPhotoApp

tanaikech / GPhotoApp

Licence: MIT license
This is a GAS library for retrieving and creating the albums and media items using Google Photo API using Google Apps Script (GAS).

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to GPhotoApp

GPhotos
A wrapper around the Google Photos API.
Stars: ✭ 21 (-16%)
Mutual labels:  google-photos, google-photos-api
ArchiverForGooglePhotos
A tool to maintain an archive/mirror of your Google Photos library for backup purposes.
Stars: ✭ 104 (+316%)
Mutual labels:  google-photos, google-photos-api
php-photoslibrary
PHP client library for the Google Photos Library API
Stars: ✭ 75 (+200%)
Mutual labels:  google-photos
RunAll
This is a library for running the concurrent processing using only native Google Apps Script (GAS).
Stars: ✭ 55 (+120%)
Mutual labels:  gas-library
java-photoslibrary
Java client library for the Google Photos Library API
Stars: ✭ 87 (+248%)
Mutual labels:  google-photos
flickr to google photos migration
A tool for migrating your photo library from Flickr to Google Photos
Stars: ✭ 39 (+56%)
Mutual labels:  google-photos
Timeliner
In general, Timeliner obtains items from data sources and stores them in a timeline.
Stars: ✭ 2,911 (+11544%)
Mutual labels:  google-photos
jiotty-photos-uploader
Uploads your media files to Google Photos creating albums based on the directory structure
Stars: ✭ 54 (+116%)
Mutual labels:  google-photos
PixelCrop
A Crop library like Google Photos
Stars: ✭ 52 (+108%)
Mutual labels:  google-photos
google-photos-upload
Upload a local image directory into an Album in Google Photos (works on mac/pc/linux). Coded in C# .NET Core 3.0
Stars: ✭ 26 (+4%)
Mutual labels:  google-photos
Ownphotos
Self hosted alternative to Google Photos
Stars: ✭ 2,587 (+10248%)
Mutual labels:  google-photos
google-photos-exif
A tool to populate missing `DateTimeOriginal` EXIF metadata in Google Photos takeout, using Google's JSON metadata.
Stars: ✭ 288 (+1052%)
Mutual labels:  google-photos
google-photos-api-client-go
Google photos api client in go
Stars: ✭ 35 (+40%)
Mutual labels:  google-photos
Drag Select Recyclerview
👇 Easy Google Photos style multi-selection for RecyclerViews, powered by Kotlin and AndroidX.
Stars: ✭ 1,818 (+7172%)
Mutual labels:  google-photos
gphotos sort
Sort Google Photos album images by filename.
Stars: ✭ 40 (+60%)
Mutual labels:  google-photos
photos
"Fx Fotos" is an opensource gallery app in react native with the same smoothness and features of Google Photos and Apple Photos. It is backend gnostic and connects to decentralized backends like "box", "Dfinity", "Filecoin" and "Crust".
Stars: ✭ 620 (+2380%)
Mutual labels:  google-photos
google-photos-vue
Google Photos album viewer built with Vue.js
Stars: ✭ 17 (-32%)
Mutual labels:  google-photos
google-photos-plus
A chrome extension that allows you to download photos from Google Photos in better quality than the default download option.
Stars: ✭ 61 (+144%)
Mutual labels:  google-photos
google-photos-timezone-fix
Iterates over photos in given Google Photos album and edits date/time/timezone of each photo in order to fix their order
Stars: ✭ 22 (-12%)
Mutual labels:  google-photos
Google-Apps-Script-Library-Database
This is for the Google Apps Script Library Database and a web application for searching the libraries..
Stars: ✭ 51 (+104%)
Mutual labels:  gas-library

GPhotoApp

MIT License

Overview

A Google Apps Script (GAS) library exposing the Google Photos Library API.

Based on https://github.com/tanaikech/GPhotoApp

Description

Currently, the Photos Library API is not available under Advanced Google services. This library enables access via the UrlFetchApp service.

Usage

  1. Copy + paste the contents of PhotoApp.js to a new file in your Apps Script project.
  2. Link the Cloud Platform project to your Google Apps Script project: Apps Script Sidebar > Project Settings > Google Cloud Platform (GCP) Project. See also here.
  3. Enable the Photos Library API at the GCP Console
  4. Edit appsscript.json in your project to include the scopes required for Google Photos access (see included sample file):
  "oauthScopes": [
    "https://www.googleapis.com/auth/photoslibrary",
    "https://www.googleapis.com/auth/script.external_request"
  ]

Public library

I got a contact that the library key had been removed. The script ID of the library is as follows.

1lGrUiaweQjQwVV_QwWuJDJVbCuY2T0BfVphw6VmT85s9LJFntav1wzs9
  • How to install the Google Apps Script can be seen at here.

Notes

  • This library uses modern Javascript. V8 runtime must be enabled.
  • Media items can be created only within the albums created by your app (see here). Attempting to upload to an album not created by your app will result in the error: No permission to add media items to this album.
  • Paginated results are returned as iterators. Use for...of to iterate over them. If you need all of them, you can use Array.from().

Documentation

Methods Description
createAlbum(object) Create new album.
getAlbumList(excludeNonAppCreatedData) Get album list.
getMediaItemList() Get media item list.
getMediaItems(object) Get media items.
getMediaItem(object) Gets a media item.
getMediaItemBlob(object) Gets data for a media item.
uploadMediaItems(object) Upload images to album.

Sample scripts

createAlbum (albums.create)

function createAlbum() {
  const resource = { album: { title: "sample title" } };
  const res = PhotoApp.createAlbum(resource);
  console.log(res);
}

getAlbumList (albums.list)

function getAlbumList() {
  const res = Array.from(
    PhotoApp.getAlbumList({ excludeNonAppCreatedData: true })
  );
  console.log(res);
}

getMediaItemList (mediaItems.list)

function getMediaItemList() {
  const res = Array.from(PhotoApp.getMediaItemList());
  console.log(res);
}

searchMediaItems (mediaItems.search)

function searchMediaItems() {
  const albumId = "###"; // Album ID
  const res = Array.from(PhotoApp.searchMediaItems({ albumId }));
  console.log(res);
}

getMediaItems (mediaItems.batchGet)

function getMediaItems() {
  const resource = { mediaItemIds: ["###", "###"] };
  // Note that since the list is limited to requested items, this does not return an iterator.
  const res = PhotoApp.getMediaItems(resource);
  console.log(res);
}

getMediaItem (mediaItems.get)

function getMediaItem() {
  const id = "###";
  const res = PhotoApp.getMediaItem({ mediaItemId: id });
  console.log(res);
}

getMediaItemBlob

function getMediaItems() {
  const id = "###";
  const mediaItem = PhotoApp.getMediaItem({ mediaItemId: id });
  const blob = PhotoApp.getMediaItemBlob(mediaItem);
  blob.setName(mediaItem.filename);
  DriveApp.createFile(blob);
  console.log(res);
}

uploadMediaItems (mediaItems.batchCreate)

function uploadMediaItems() {
  const albumId = "###"; // Album ID
  const fileId = "###"; // File ID
  const url = "###"; // URL of image file
  const resource = {
    albumId: albumId,
    items: [
      {
        blob: DriveApp.getFileById(fileId).getBlob(),
        description: "description1",
        filename: "filename1",
      },
      {
        blob: UrlFetchApp.fetch(url).getBlob(),
        description: "description2",
        filename: "filename2",
      },
    ],
  };
  const res = PhotoApp.uploadMediaItems(resource);
  console.log(JSON.stringify(res));
}

License

MIT

Authors

Tanaike, kwikwag

Update History

  • v1.0.0 (February 26, 2020) (tanaikech)

    1. Initial release.
  • v1.1.0 (January 20, 2022) (kwikwag)

    1. Added some methods
    2. Refactored code
    3. Fixed broken pagination API
    4. Minor breaking interface changes
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].