Skip to content

Commit

Permalink
feat: add cli wrapper
Browse files Browse the repository at this point in the history
Major change to allow the bot to be distributed as a pip package.

app.py has been removed and replaced with a CLI utility called
'rybo'.

Existing video generation, TTS and Reddit post processing logic
has been left as is, however now sits inside the CLI.

Removed auth.py, as credentials are now passed via environment
variables or a YAML configuration file. The default expected
location of the configuration file is `~/rybo.yaml`. A
sample configuration file has been included in the codebase.

ArgParse parameters updated to allow loading of configuration
from the command line, a configuration file, or environment
variables.

The order of precendence for loading configuration options is:

1. Configuration file
2. Environment variables.
3. CLI parameters.

Configuration options provided as CLI parameters will override
the same option provided as an environment variable, and the
environment variable will override the same option provided in
the configuration file.

Replaced all calls to "print" with module specific loggers to
ensure consistent output and facilitate configurable logging
behaviour.

Updated existing GitHub workflows to reflect the new expected
environment variable names.

Updated the readme with instructions on how to use the new CLI.

BREAKING CHANGE: app.py no longer exists, use the `rybo` command.

refs:
  - resolves alexlaverty#82
  • Loading branch information
nathonfowlie committed May 14, 2023
1 parent f314126 commit 3be18cc
Show file tree
Hide file tree
Showing 41 changed files with 2,079 additions and 1,254 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
final/*
config/auth.py
.env
client_secret.json
cookies.json
Expand Down
29 changes: 15 additions & 14 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ jobs:

- name: Run ttsvibelounge Script
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
RYBO_POLLY_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
RYBO_POLLY_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
CREDENTIALS_STORAGE: ${{ secrets.CREDENTIALS_STORAGE }}
PRAW_CLIENT_ID: ${{ secrets.PRAW_CLIENT_ID }}
PRAW_CLIENT_SECRET: ${{ secrets.PRAW_CLIENT_SECRET }}
PRAW_USER_AGENT: ${{ secrets.PRAW_USER_AGENT }}
PRAW_USERNAME: ${{ secrets.PRAW_USERNAME }}
PRAW_PASSWORD: ${{ secrets.PRAW_PASSWORD }}
RUMBLE_PASSWORD: ${{ secrets.RUMBLE_PASSWORD }}
RUMBLE_USERNAME: ${{ secrets.RUMBLE_USERNAME }}
RYBO_REDDIT_CLIENT_ID: ${{ secrets.PRAW_CLIENT_ID }}
RYBO_REDDIT_CLIENT_SECRET: ${{ secrets.PRAW_CLIENT_SECRET }}
RYBO_REDDIT_USER_AGENT: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/112.0
RYBO_REDDIT_USERNAME: ${{ secrets.PRAW_USERNAME }}
RYBO_REDDIT_PASSWORD: ${{ secrets.PRAW_PASSWORD }}
RYBO_RUMBLE_PASSWORD: ${{ secrets.RUMBLE_PASSWORD }}
RYBO_RUMBLE_USERNAME: ${{ secrets.RUMBLE_USERNAME }}
YOUTUBE_CLIENT_SECRET: ${{ secrets.YOUTUBE_CLIENT_SECRET }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
Expand All @@ -31,12 +31,13 @@ jobs:
echo $GITHUB_WORKSPACE
echo $YOUTUBE_CLIENT_SECRET > client_secret.json
echo $CREDENTIALS_STORAGE > credentials.storage
cp config/auth-env.py config/auth.py
pip install -r requirements.txt
playwright install
python3 app.py --total-posts 1 \
--enable-background \
--background-directory /app/assets/backgrounds \
--enable-mentions
pip install --editable .
rybo --total-posts 1 \
--enable-background \
--background-directory /app/assets/backgrounds \
--enable-mentions
python3 refresh_token.py
rm -f client_secret.json
rm -f credentials.storage
Expand Down
32 changes: 16 additions & 16 deletions .github/workflows/tssvibelounge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ jobs:

- name: Run ttsvibelounge Script
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
RYBO_POLLY_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
RYBO_POLLY_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
CREDENTIALS_STORAGE: ${{ secrets.CREDENTIALS_STORAGE }}
PRAW_CLIENT_ID: ${{ secrets.PRAW_CLIENT_ID }}
PRAW_CLIENT_SECRET: ${{ secrets.PRAW_CLIENT_SECRET }}
PRAW_USER_AGENT: ${{ secrets.PRAW_USER_AGENT }}
PRAW_USERNAME: ${{ secrets.PRAW_USERNAME }}
PRAW_PASSWORD: ${{ secrets.PRAW_PASSWORD }}
RUMBLE_PASSWORD: ${{ secrets.RUMBLE_PASSWORD }}
RUMBLE_USERNAME: ${{ secrets.RUMBLE_USERNAME }}
RYBO_REDDIT_CLIENT_ID: ${{ secrets.PRAW_CLIENT_ID }}
RYBO_REDDIT_CLIENT_SECRET: ${{ secrets.PRAW_CLIENT_SECRET }}
RYBO_REDDIT_USER_AGENT: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/112.0
RYBO_REDDIT_USERNAME: ${{ secrets.PRAW_USERNAME }}
RYBO_REDDIT_PASSWORD: ${{ secrets.PRAW_PASSWORD }}
RYBO_RUMBLE_PASSWORD: ${{ secrets.RUMBLE_PASSWORD }}
RYBO_RUMBLE_USERNAME: ${{ secrets.RUMBLE_USERNAME }}
YOUTUBE_CLIENT_SECRET: ${{ secrets.YOUTUBE_CLIENT_SECRET }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
Expand All @@ -47,18 +47,18 @@ jobs:
echo $GITHUB_WORKSPACE
echo $YOUTUBE_CLIENT_SECRET > client_secret.json
echo $CREDENTIALS_STORAGE > credentials.storage
cp config/auth-env.py config/auth.py
pip install -r requirements.txt
playwright install
python3 app.py --total-posts 1 \
--enable-upload \
--enable-background \
--background-directory /app/assets/backgrounds \
--enable-mentions
pip install --editable .
rybo --total-posts 1 \
--enable-upload \
--enable-background \
--background-directory /app/assets/backgrounds \
--enable-mentions
python3 refresh_token.py
rm -f client_secret.json
rm -f credentials.storage
- name: check for changes
run: |
git config --global --add safe.directory $(realpath .)
Expand Down
Loading

0 comments on commit 3be18cc

Please sign in to comment.