0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

ATOMCamの画像をBlueskyへ投稿する

Posted at

目的

ATOMCamを使った定点カメラの画像を定期的にBlueskyへPostしてみた。
カメラは空を写しているので雲が写っています。
https://bsky.app/profile/roxabot.bsky.social

環境

  • マシン : Raspberry PI 4
  • Python : 3.7.3
  • ATOMCam : ATOMCam2

ATOMCam

下記のatomcam_toolsを導入済み
https://github.com/mnakada/atomcam_tools/blob/main/README.md

Blueskyのアプリパスワードを取得

設定 -> アプリパスワード からパスワードを取得しておく。

python環境作成

Raspberry PI へ仮想環境を作成してatprotoモジュールをインストールする。

% python3 -m venv atproto
% source atproto/bin/activate
% sudo pip3 install atproto

Blueskyへ投稿するスクリプト

Postしたいメッセージとローカルにある画像ファイルを引数としてBlueskyへPostするスクリプトです。
https://github.com/roxa-delphi/post_sns/blob/main/bs_postimage.py
コマンドラインから実行するときは下記のように実行します。

% atproto/bin/python3 bs_postimage.py "message" image_filename

ATOMCamからの画像取得とBlueskyへのポスト

ATOMCamから画像を取得して"data/yymmdd/yymmdd_hhmmss.jpg"へ保存し、
それをBlueskyへポストしています。
https://github.com/roxa-delphi/post_sns/blob/main/get_atomcam.pl

cronで実行する

10分毎にスクリプトを実行し、毎時0分にはBlueskyへ投稿しています。
毎時0分の設定は get_atomcam.pl 内の '$mm eq "00"' で実施してます。

0-59/10 * * * * cd /target-directory;./get_atomcam.pl

結果

Blueskyは下記で見れます。
https://bsky.app/profile/roxabot.bsky.social

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?