Display your photos from files stored in Google Drive
Inspired by MMM-GooglePhotos and MMM-GoogleBirthdaysProvider
- Install Module
cd modules
git clone https://github.com/clegallic/MMM-GoogleDriveSlideShow.git
cd MMM-GoogleDriveSlideShow
npm install
- 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
. Don't forget to enable the Google API Services. - Search for
Google Drive API
. Select the correct result and click Enable. - 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-GoogleDriveSlideShow/secrets
directory. - Now, open your terminal(not via SSH, directly in your RPI).
cd ~/MagicMirror/modules/MMM-GoogleDriveSlideShow
npm run token:generate
- At first execution, It will display a link that 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 set your
config.js
(next chapter)
To use this module, add it to the modules array in the config/config.js file:
var config = {
modules: [
{
module: "MMM-GoogleDriveSlideShow",
position: "bottom_bar",
config: {
rootFolderId: null,
maxFolders: 10,
maxResults: 100,
playMode: "AUTO",
nextOnNotification: null,
stopOnNotification: null,
startOnNotification: null,
refreshDriveDelayInSeconds: 24 * 3600,
refreshSlideShowIntervalInSeconds: 10,
maxWidth: "800",
maxHeight: "600",
theme: "whiteFrame",
opacity: 1,
debug: false
}
}
]
};
Option | Description |
---|---|
rootFolderId |
Google Drive root folder id, or null for root folderType: string Default value: null |
maxFolders |
Maximum number of sub-folders to scan if rootFolderId != root Type: integer Default value: 10 |
maxResults |
Maximum of images to load from Google Drive Type: integer Default value: 100 |
playMode |
Slideshow play mode : AUTO (automatic) or NOTIFICATION (only on the notification configured with nextOnNotification ) Type: string Default value: AUTO |
nextOnNotification |
Change image only when this notification is received. Automatic refresh otherwise if null Type: string Default value: null |
stopOnNotification |
Stop slideshow when this notification is received Type: string Default value: null |
startOnNotification |
Stop slideshow when this notification is received Type: string Default value: null |
refreshDriveDelayInSeconds |
How often Google Drive cache is refresh (fetch new photos, update existings) Type: integer (seconds)Default value: 24 * 3600 |
refreshSlideShowIntervalInSeconds |
How often the image on the slideshow is refreshed Type: integer (seconds) Default value: 10 |
maxWidth |
Maximum width of the image displayed Type: integer (pixels)Default value: 800 |
maxHeight |
Maximum height of the image displayed Type: integer (pixels) Default value: 600 |
theme |
Name of CSS class to use for theme : none , insetShadow or whiteFrame . See below for examples of these themesType: string Default value: whiteFrame |
opacity |
Resulting image opacity. Consider reducing this value if you are using this module as a background picture frame Type: float (below one)Default value: 1 |
mode |
"cover" or "contain" Type: string Default value: contain |
debug |
Display debug informations in Electron and NodeJS consoles / logs Type: boolean Default value: false |
- MagicMirror : v2.10.1
- node.js : 8.16.2 & 10.17.0
- 2020-03-16 : Handle
suspend()
andresume()
functions
- Add rootFolderId in cache to compare any change and reset if any
- Display a message on the Mirror while reloading the cache
- Explain who to get the folderId in Google Drive
- Add option to display filename, date and parent folder name
- Add option to choose mimetype of files to search
- Detect and correct photo orientation when portait is displayed as landscape
- Allow multiple root folders Ids
- Allow memory only cache for read-only MM