[PYTHON] Show grass on Google Nest Hub

I bought a Pixel 4 and received a Google Nest Hub. It seems that it can be used as a digital photo frame. Since it's a big deal, I'll try to display the grass image on GitHub.

nesthub.jpg

Google Nest Hub settings

Immediately after purchase, Nest Hub will display an art gallery prepared by Google. Change this to a setting that allows you to display your favorite images.

  1. Launch the Google Home app on your iOS or Android device
  1. Go to Nest Hub> Photo Frames
  1. Change the "Organize personal photos" setting to "Real-time shared albums only"

Select the Google Photos album to display in the photo frame. The script that will be introduced later automatically creates the album that saves the grass image.

Get access token for Google Photos API

We're going to run a python script that will generate a grass image and upload it to the Google Photos API. To do this, you need to enable the Google Photos API, which is disabled by default, and get an OAuth 2.0 token.

This time, I got the token by referring to this Qiita article.

You will use the Client ID, Client Secret, and Refresh Token later. These are things that should not be published, so please be careful about management.

Script to create and upload grass images

In the following repository, I have prepared a python script that generates a grass image of GitHub and uploads it to Google Photos.

In generating the grass image, I referred to https://grass-graph.moshimo.works/.

When you run the script, a Google Photos album for saving grass images will be created automatically. The default name is "GitHub grass". Please set Google Nest Hub to display this album.

Automation

The repository contains GitHub Actions settings. If you set the following secrets, grass images will be automatically generated and uploaded every day.

For those who want to display grass images on Nest Hub

The scripts I made are distributed under the Apache 2.0 license. By forking the GitHub repository, you can use it including automation functions.

However, please note the following points.

in conclusion

Thanks to @ u_akihir0 for all the advice this time around. Have a nice Nest Hub life!

Recommended Posts

Show grass on Google Nest Hub
ls -R on Google Drive
Use music21 on Google Colaboratory
Try StyleGAN on Google Colaboratory
Plotly Dash on Google Colab
Pandas 100 knocks on Google Colaboratory