Giter Club home page Giter Club logo

libcamera_to_x's Introduction

libcarema_to_x

libcarema-jpegで取得した画像をX(Twitter)に日付付きでアップロードするプログラム。

動作環境

以下のOS(Archive)をRaspberry Pi 4 Model Bにインストールして動作確認済。

Raspberry Pi OS (Legacy) with desktop
Release date: March 12th 2024
System: 64-bit
Kernel version: 6.1
Debian version: 11 (bullseye)
Size: 853MB
Show SHA256 file integrity hash:
Release notes

前提

Bunが必要です。従って、32bitのOSでは動作しません。(2024/3/24現在)

使い方

以下はOSをインストールしたRaspberry Pi上での操作です。

  1. カメラが使えることを確認

    libcamera-hello
  2. 環境変数の定義

    以下を埋めた.envファイルをプロジェクトルートに作成

    // Twitter API関係
    X_API_KEY=
    X_API_KEY_SECRET=
    X_ACCESS_TOKEN=
    X_ACCESS_TOKEN_SECRET=
    
    // 撮影画像の画素数
    WIDTH=
    HEIGHT=
    
  3. 実行ファイルの生成

    プロジェクトディレクトリ内で以下を実行

    bun install
    bun run build

    [プロジェクトルート]/build/に実行ファイルlibcamera_to_xが生成される

  4. 実行

    $ /PATH/TO/EXECUTABLE/FILE/libcamera_to_x

cronの設定例

cronを使用することで、定期実行が可能になります。

crontab -eでエディタを開いたあと、以下のように追記してください。

この例では、毎日0時、8時、16時に実行されます。

0 0,8,16 * * * /PATH/TO/EXECUTABLE/FILE/libcamera_to_x

現在cronやsystemdからの実行でのみエラーが発生していることを確認しています。 タスクランナーから起動するときは、実行ファイルでなくbun runコマンドから起動してください。

0 0,8,16 * * * /PATH/TO/BUN/DIR/bun run /PATH/TO/PROJECT/ROOT/index.ts

cronの詳細についてはこちらを参照してください。

libcamera_to_x's People

Contributors

azishio avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.