Display your photos from album of Google Photos on MagicMirror
[[PlaceHolder]]
- Install Module
git clone https://github.com/eouia/MMM-GooglePhotos.git
cd MMM-GooglePhotos
npm install
If you doubt errors are caused by different node.JS
version, you can try to compile it by yourself.
In that case, you need to rebuild some binaries to match with Electron version.
cd ~/MagicMirror/modules/MMM-GooglePhotos
npm install --save-dev electron-rebuild
./node_modules/.bin/electron-rebuild # It could takes dozens sec.
- Go to Google API Console
- From the menu bar, select a project or create a new project.
- To open the Google API Library, from the Navigation menu, select
APIs & Services > Library
. - Search for "Google Photos Library API". Select the correct result and click Enable. (You may need to enable "Google Plus" also.)
- Then, from the menu, select
APIs & Services > Credentials
. - On the Credentials page, click
Create Credentials > OAuth client ID
. - Select your Application type as
Other
and submit. (Before or After that, you might be asked for making consent screen. do that.) - Then, you can download your credential json file from list. Downloaded file name would be
client_secret_xxxx...xxx.json
. rename it ascredentials.json
and save it to yourMMM-GooglePhotos
directory. - Now, open your termial(not via SSH, directly in your RPI).
cd ~/MagicMirror/modules/MMM-GooglePhotos
node auth_and_test.js
- At first execution, It will open a browser and will ask you to login google account and to consent your allowance.
- After consent, some code (
4/ABCD1234xxxx...
) will be appeared. copy it and return to your terminal. paste it for answer of prompt in console. - Now you can get list of your Google Photos albums. like these;
<ALBUM_NAME> : <ALBUM_ID>
travel to paris : AGj1epU5VMNoBGK9GDX3k_zDQaPT16Fe56o0N93eN6aXn-f21M98
...
- Remember the id of album to show.
- now set your
config.js
{
module: "MMM-GooglePhotos",
position: "top_right",
config: {
albumId: "YOUR_GOOGLE_PHOTOS_ALBUM_ID", // your album id from result of `auth_and_test.js`
refreshInterval: 1000*60,
scanInterval: 1000*60*10, // too many scans might cause API quota limit also.
//note(2018-07-29). It is some weird. API documents said temporal image url would live for 1 hour, but it might be broken shorter. So, per 10 min scanning could prevent dead url.
sort: "time", //'time', 'reverse', 'random'
showWidth: "800px", // how large the photo will be shown as. (e.g;'100%' for fullscreen)
showHeight: "600px",
originalWidthPx: 800, // original size of loaded image. (related with image quality)
originalHeightPx: 600, // Bigger size gives you better quality, but can give you network burden.
mode: "cover", // "cover" or "contain" (https://www.w3schools.com/cssref/css3_pr_background-size.asp)
}
},
- MagicMirror : v2.4.1
- node.js : 8.11.3 & 10.x
- Fix the issue of dead url. (It seems also the problem of API. documents said temporal url would live for 1 hour, but it might be broken shorter.)
- Fix the issue of photos shared from others.
(I think it was the problem of API, because
mediaItem:search
can access shared photos butmediaItem/Id
cannot. That is out of sense.)