#twitter #bot #aws-s3 #google-drive #config-file

app twitter_send_frame

Twitter bot to send images from a google drive

2 releases

0.1.1 Jan 30, 2022
0.1.0 Jan 29, 2022

#15 in #google-drive

GPL-3.0-or-later

17KB
346 lines

Twitter send frame

dependency status pipeline status

A Twitter bot to send images from an AWS S3 bucket.

Requirements

Some env var are required

  • AWS_ACCESS_KEY Required for working with AWS S3
  • AWS_SECRET_KEY Required for working with AWS S3
  • TWITTER_SEND_FRAME_CONFIG_FILE Absolute or relative config file path. See Config file section for more details.
  • TWITTER_CONSUMER_KEY The consumer key, required for posting on Twitter. Can also be an executable parameter.
  • TWITTER_CONSUMER_SECRET The consumer secret, required for posting on Twitter. Can also be an executable parameter.

Usage

twitter_send_frame 0.1.0

USAGE: twitter_send_frame --twitter-consumer-key --twitter-consumer-secret

FLAGS: -h, --help Prints help information -V, --version Prints version information

OPTIONS: --twitter-consumer-key [env: TWITTER_CONSUMER_KEY] --twitter-consumer-secret [env: TWITTER_CONSUMER_SECRET]

Config file

{
    // Number of frame to post
    "nb_to_post": 3,
    // Resource directory. Used to store Twitter access token and keep trace of image index.
    "resource_dir": "/home/dwittwer/projects/twitter_send_frame/res",
    // Tmp dir to use to keep images from S3 before posting it. Tis directory is removed after each execution
    "tmp_dir": "/tmp/twitter_send_frame",
    "aws": {
        // AWS bucket to use
        "bucket": "my-bucket",
        // AWS region to use
        "region": "us-east-1",
        // Endpoint to use if AWS like object storage [optional]
        "endpoint": "https://my-custom.endpoint.cloud",
        // object key prefix [optional]
        "key_prefix": "frames/storage/",
        // Object key template. {nb | nb_formatter} must be present and will be replaced with the current image number to post
        "key_template": "FRAME{nb | nb_formatter}.jpg",
        // Padding number for the key. For example if set to 4, current number to 42 with previous template the object key will be "FRAME0042.jpg"
        "key_nb_padding": 4
    },
    "twitter": {
        // The message of the tweet. {nb} must be present and will be replaced by the curren frame number
        "message_template": "My awesome movie \n\nframe {nb} of 122894"
    }
}

Run cargo install twitter_send_frame.

To specify log level, add RUST_LOG env var.

From sources

Install the Rust toolchain https://www.rust-lang.org/tools/install
Download sources on Gitlab
Inside the downloaded project run cargo install --path . to install the tool or cargo run to run it.

Versioning

This project adheres to Semantic Versioning and use git flow branching model.

Copyright 2022 David Wittwer and Contributors

This project is licensed under GNU GPLv3 license. See license file

Dependencies

~28–42MB
~753K SLoC