主な役割と処理
Spotify
- WebAPI を使用します
M5AtomS3
- 今回のメインで、WiFi/Internetに接続し、定期的にSpotifyの再生状態を取得します
- 再生状態が変化したら、カバー画像をリサイズトリミングするための処理に送信します
- 曲のタイトルとアーティスト名を流れる表示で画面へ出力します
- タイトルとアーティスト表示が終わったら、カバー画像を画面に出力します
- 画面が押される(ボタンとして押される)とリスト再生中の場合、次の曲に変更されます ・変更されたあとすぐに曲の状態を取得して表示します(カバー画像も表示します)
- 表示の際には内蔵のIMUを使い上下左右を判定していますので向きを気にせずに使えます
- 曲が再生されていない場合は、液晶の表示をオフにしバックライトも消しておきます(焼付き防止)
- 画面を長押しすると再度曲名とカバー画像を表示します
レンタルサーバ
- M5AtomS3だけでjpgのリサイズとトリミングが重たいので、外部で処理しています。
- この処理にはImageMagickを使っています。
メモ : spotify の WebAPI を使用するにあたり事前にtokenを得ておいて、tokenが期限切れになったら更新して使うようにしています。
http接続は、以下のコードを使わせて頂いています(ありがとうございます) https://qiita.com/poruruba/items/82a683866aef872665a4
For English
Spotify
- Uses WebAPI.
M5AtomS3
- Connects to the internet to monitor Spotify's playback status.
- Changes songs and displays song information and cover images on screen.
- Adjusts display orientation with a built-in sensor and powers down the display when not in use to prevent burn-in.
Rental Server
- Manages heavy image processing tasks using ImageMagick.
Note: Manages authentication with Spotify via tokens that are regularly refreshed.