2 个版本
0.1.1 | 2022 年 1 月 30 日 |
---|---|
0.1.0 | 2022 年 1 月 29 日 |
#15 在 #google-drive
17KB
346 行
Twitter 发送帧
一个从 AWS S3 存储桶发送图片的 Twitter 机器人。
要求
需要一些环境变量
AWS_ACCESS_KEY
用于 AWS S3 的操作所必需AWS_SECRET_KEY
用于 AWS S3 的操作所必需TWITTER_SEND_FRAME_CONFIG_FILE
绝对路径或相对路径的配置文件。更多详细信息请参阅配置文件部分。TWITTER_CONSUMER_KEY
消费者密钥,用于在 Twitter 上发布。也可以作为可执行参数。TWITTER_CONSUMER_SECRET
消费者密钥,用于在 Twitter 上发布。也可以作为可执行参数。
用法
twitter_send_frame 0.1.0
用法: twitter_send_frame --twitter-consumer-key --twitter-consumer-secret
标志: -h, --help 打印帮助信息 -V, --version 打印版本信息
选项: --twitter-consumer-key [环境: TWITTER_CONSUMER_KEY] --twitter-consumer-secret [环境: TWITTER_CONSUMER_SECRET]
配置文件
{
// 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"
}
}
使用 Cargo(推荐)
运行 cargo install twitter_send_frame
。
要指定日志级别,请添加 RUST_LOG
环境变量。
从源代码
安装 Rust 工具链 https://rust-lang.net.cn/tools/install
在 Gitlab 上下载源代码
在下载的项目中运行 cargo install --path .
以安装工具或运行 cargo run
以运行它。
版本管理
本项目遵循 语义版本控制 并使用 git flow 分支模型。
版权和许可
版权 2022 David Wittwer 和贡献者
本项目采用 GNU GPLv3 许可。请参阅 许可文件
依赖关系
~28–42MB
~753K SLoC