forked from encrypt/toot
37 lines
No EOL
689 B
Bash
Executable file
37 lines
No EOL
689 B
Bash
Executable file
#
|
|
# CONFIGURATION
|
|
#
|
|
|
|
# Interval between two consecutive posts
|
|
SLEEP_INTERVAL=3h
|
|
|
|
# File containing the toots to post
|
|
DATA_FILE=megafono.txt
|
|
|
|
#
|
|
# CONFIGURATION END
|
|
#
|
|
|
|
extract_image() {
|
|
sed -e 's/.*<img>\(.*\)<\/img>.*/\1/g' <<< $1
|
|
}
|
|
|
|
extract_text() {
|
|
sed -e "s/\(.*\)<img>.*<\/img>\(.*\)/\1\2/g" <<< $1
|
|
}
|
|
|
|
while :
|
|
do
|
|
# Last line should be empty, so we dont need an additional read here
|
|
# after the while loop
|
|
while read line
|
|
do
|
|
text=`extract_text "$line"`
|
|
image=`extract_image "$line"`
|
|
echo "[$(date)][INFO] Now tooting: $text"
|
|
echo "[$(date)][INFO] with image: $image"
|
|
./toot.sh -i=images/$image $text >/dev/null 2>&1 &
|
|
sleep ${SLEEP_INTERVAL}
|
|
done < ${DATA_FILE}
|
|
|
|
done |