# post to mastodon + twitter + gnu social post + diaspora
#
-# usage: pdt [--dbd] [-m MEDIA_FILE] [POST]
+# usage: pdt [--dbd] [-m MEDIA_FILE] [-v VIDEO_PATH] [POST]
pdt() {
if [[ $pdttest ]]; then
rbow_account=iank
mastodon_account=fsf@hostux.social
fi
dbd=false
+ video=false
while [[ $1 == -* ]]; do
case $1 in
-m)
media="$2"
shift 2
- if [[ ! -e $media ]]; then
- echo "error: file not found $media"
- return 1
- fi
- if [[ $media == *\ * ]]; then
- echo "error: file path contains a space. move it to non-space path"
- return 1
- fi
rbow_arg=" --i $media"
toot_arg="--media $media"
dia_arg="-p $media "
mastodon_account=endDRM@hostux.social
shift
;;
+ -v)
+ video=true
+ media="$2"
+ shift 2
+ ;;
esac
done
+ if [[ $media ]]; then
+ if [[ ! -e $media ]]; then
+ echo "error: file not found $media"
+ return 1
+ fi
+ if [[ $media == *\ * ]]; then
+ echo "error: file path contains a space. move it to non-space path"
+ return 1
+ fi
+ fi
# if we have no argument
if (( ! $# )); then
read -r -p "input PDT text: " input
echo "$input"
read
fi
+ if $video; then
+ local oath
+ oath=$HOME/.rainbow_oauth
+ account=fsf
+ if $dbd; then
+ account=dbd
+ fi
+ rm -f $oath
+ ln -s ${oath}-$account $oath
+ python3 ~/src/async-upload.py "$media" "$*"
+ return
+ fi
fails=()
if ! rbow -$rbow_account t "$*" $rbow_arg; then
fails+=(tweet)
mkdir -p ~/src
cd ~/src
- for repo in errhandle rainbowstream diaspy jan-pona-mute; do
+ for repo in errhandle rainbowstream diaspy jan-pona-mute video-tweet; do
if [[ -e $repo ]]; then
cd $repo
git fetch