Added details on optional dependencies to README.md

This commit is contained in:
JC Francois 2020-03-29 13:57:18 +02:00
parent 6fa2019618
commit 965317f5b2
2 changed files with 16 additions and 13 deletions

View File

@ -31,7 +31,7 @@ of last week.
``` ```
twoot.py [-h] -t <twitter account> -i <mastodon instance> -m <mastodon twoot.py [-h] -t <twitter account> -i <mastodon instance> -m <mastodon
account> -p <mastodon password> [-r] account> -p <mastodon password> [-r] [-v]
[-a <max age in days>] [-d <min delay in mins>] [-a <max age in days>] [-d <min delay in mins>]
``` ```
@ -42,19 +42,19 @@ is @superduperbot@botsin.space
|Switch |Description | Example | Req | |Switch |Description | Example | Req |
|-------|--------------------------------------------------|--------------------|-----| |-------|--------------------------------------------------|--------------------|-----|
| -t | twitter account name without '@' | `SuperDuperBot` | Yes | | -t | twitter account name without '@' | `SuperDuper` | Yes |
| -i | Mastodon instance domain name | `botsin.space` | Yes | | -i | Mastodon instance domain name | `botsin.space` | Yes |
| -m | Mastodon username | `superduperbot` | Yes | | -m | Mastodon username | `superduperbot` | Yes |
| -p | Mastodon password | `my_Sup3r-S4f3*pw` | Yes | | -p | Mastodon password | `my_Sup3r-S4f3*pw` | Yes |
| -v | upload videos to Mastodon | *N/A* | No | | -v | upload videos to Mastodon | *N/A* | No |
| -r | Post reply-to tweets (ignored by default) | *N/A* | No | | -r | Post reply-to tweets (ignored by default) | *N/A* | No |
| -a | Max. age of tweet to post (in days) | `1` | No | | -a | Max. age of tweet to post (in days) | `5` | No |
| -d | Min. delay before posting new tweet (in minutes) | `15` | No | | -d | Min. delay before posting new tweet (in minutes) | `15` | No |
When using the `-v` switch consider: When using the `-v` switch consider:
* The copyright of the content that you want to cross-post * whether the copyright of the content that you want to cross-post allows it
* The storage / transfer limitations of the Mastodon instance that you are posting to * the storage / transfer limitations of the Mastodon instance that you are posting to
* The upstream bandwidth that you may consume on your internet connection * the upstream bandwidth that you may consume on your internet connection
Default max age is 1 day. Decimal values are OK. Default max age is 1 day. Decimal values are OK.
@ -64,13 +64,15 @@ Default min delay is 0 minutes.
Make sure python3 is installed. Make sure python3 is installed.
Twoot depends on beautifulsoup4 and mastodon python module. It also Twoot depends on `beautifulsoup4` and `Mastodon.py` python modules.
requires m3u8 and ffmpeg-python.
ffmpeg must also be installed. If you plan to use the `-v` switch to download videos, the additional depedencies are required:
* Python modules `m3u8` and `ffmpeg-python`
pip install beautifulsoup4 Mastodon.py m3u8 ffmpeg-python * [ffmpeg](https://ffmpeg.org/download.html) (check the package manager of your distribution)
```
> pip install beautifulsoup4 Mastodon.py m3u8 ffmpeg-python
```
In your user folder, execute `git clone https://gitlab.com/jeancf/twoot.git` In your user folder, execute `git clone https://gitlab.com/jeancf/twoot.git`
to clone repo with twoot.py script. to clone repo with twoot.py script.

View File

@ -126,9 +126,10 @@ def cleanup_tweet_text(tt_iter, tweet_uri, get_vids):
data_expanded_path = tag['data-expanded-path'] data_expanded_path = tag['data-expanded-path']
if 'video' in data_expanded_path: if 'video' in data_expanded_path:
if get_vids: if get_vids:
# Download video from twitter and store in filesystem # Download video from twitter and store in filesystem. Running as subprocess to avoid
# TODO set output location to ./output/twit_account # requirement to install ffmpeg and ffmpeg-python for those that do not want to post videos
try: try:
# TODO set output location to ./output/twit_account
dl_feedback = subprocess.run(["./twitterdl.py", tweet_uri, "-w 500"], capture_output=True) dl_feedback = subprocess.run(["./twitterdl.py", tweet_uri, "-w 500"], capture_output=True)
if dl_feedback.returncode != 0: if dl_feedback.returncode != 0:
# TODO Log dl_feedback.stderr # TODO Log dl_feedback.stderr