@@ -116,6 +116,13 @@ else | |||||
log_done "$HOME/.wxtoimgrc installed" | log_done "$HOME/.wxtoimgrc installed" | ||||
fi | fi | ||||
if [ -e "$HOME/.tweepy.conf" ]; then | |||||
log_done "$HOME/.tweepy.conf already exists" | |||||
else | |||||
cp "templates/tweepy.conf" "$HOME/.tweepy.conf" | |||||
log_done "$HOME/.tweepy.conf installed" | |||||
fi | |||||
### Install meteor_demod | ### Install meteor_demod | ||||
if [ -e /usr/bin/meteor_demod ]; then | if [ -e /usr/bin/meteor_demod ]; then | ||||
log_done "meteor_demod was already installed" | log_done "meteor_demod was already installed" | ||||
@@ -179,7 +186,7 @@ sudo mount -a | |||||
set -e | set -e | ||||
sudo chmod 777 /var/ramfs | sudo chmod 777 /var/ramfs | ||||
success "Install (almost) done! Let's do some configuration" | |||||
success "Install (almost) done!" | |||||
echo " | echo " | ||||
It's time to configure your ground station | It's time to configure your ground station | ||||
You'll be asked for your latitude and longitude | You'll be asked for your latitude and longitude | ||||
@@ -199,3 +206,8 @@ sed -i -e "s/change_latitude/${lat}/g;s/change_longitude/${lon}/g" "sun.py" | |||||
success "Install done! Double check your $HOME/.noaa.conf settings" | success "Install done! Double check your $HOME/.noaa.conf settings" | ||||
echo " | |||||
If you want to post your images to Twitter, please setup | |||||
your Twitter credentials on $HOME/.tweepy.conf | |||||
" |
@@ -1,12 +1,13 @@ | |||||
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# -*- coding: utf-8 -*- | # -*- coding: utf-8 -*- | ||||
import os | |||||
import sys | import sys | ||||
import tweepy | import tweepy | ||||
CONSUMER_KEY = '' | |||||
CONSUMER_SECRET = '' | |||||
ACCESS_TOKEN_KEY = '' | |||||
ACCESS_TOKEN_SECRET = '' | |||||
CONSUMER_KEY = os.environ['CONSUMER_KEY'] | |||||
CONSUMER_SECRET = os.environ['CONSUMER_SECRET'] | |||||
ACCESS_TOKEN_KEY = os.environ['ACCESS_TOKEN_KEY'] | |||||
ACCESS_TOKEN_SECRET = os.environ['ACCESS_TOKEN_SECRET'] | |||||
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) | auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) | ||||
auth.set_access_token(ACCESS_TOKEN_KEY, ACCESS_TOKEN_SECRET) | auth.set_access_token(ACCESS_TOKEN_KEY, ACCESS_TOKEN_SECRET) | ||||
@@ -2,8 +2,9 @@ | |||||
## import common lib | ## import common lib | ||||
. ~/.noaa.conf | |||||
. "${NOAA_HOME}"/common.sh | |||||
. "$HOME/.noaa.conf" | |||||
. "$HOME/.tweepy.conf" | |||||
. "$NOAA_HOME/common.sh" | |||||
## pass start timestamp and sun elevation | ## pass start timestamp and sun elevation | ||||
@@ -41,11 +42,12 @@ for i in $ENHANCEMENTS; do | |||||
/usr/local/bin/wxtoimg -o -m "${NOAA_HOME}/map/${3}-map.png" -e "$i" "${NOAA_AUDIO}/audio/${3}.wav" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-$i.jpg" | /usr/local/bin/wxtoimg -o -m "${NOAA_HOME}/map/${3}-map.png" -e "$i" "${NOAA_AUDIO}/audio/${3}.wav" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-$i.jpg" | ||||
/usr/bin/convert -quality 90 -format jpg "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-$i.jpg" -undercolor black -fill yellow -pointsize 18 -annotate +20+20 "${1} $i ${START_DATE}" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-$i.jpg" | /usr/bin/convert -quality 90 -format jpg "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-$i.jpg" -undercolor black -fill yellow -pointsize 18 -annotate +20+20 "${1} $i ${START_DATE}" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-$i.jpg" | ||||
done | done | ||||
if [ "${SUN_ELEV}" -gt "${SUN_MIN_ELEV}" ]; then | |||||
python3 "${NOAA_HOME}/post.py" "$1 ${START_DATE}" "$7" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-MCIR-precip.jpg" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-MSA-precip.jpg" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-HVC-precip.jpg" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-HVCT-precip.jpg" | |||||
else | |||||
python3 "${NOAA_HOME}/post.py" "$1 ${START_DATE}" "$7" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-MCIR-precip.jpg" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-MCIR.jpg" | |||||
if [ -n "$CONSUMER_KEY" ]; then | |||||
if [ "${SUN_ELEV}" -gt "${SUN_MIN_ELEV}" ]; then | |||||
python3 "${NOAA_HOME}/post.py" "$1 ${START_DATE}" "$7" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-MCIR-precip.jpg" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-MSA-precip.jpg" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-HVC-precip.jpg" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-HVCT-precip.jpg" | |||||
else | |||||
python3 "${NOAA_HOME}/post.py" "$1 ${START_DATE}" "$7" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-MCIR-precip.jpg" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/$3-MCIR.jpg" | |||||
fi | |||||
fi | fi | ||||
rm "${NOAA_AUDIO}/audio/${3}.wav" | rm "${NOAA_AUDIO}/audio/${3}.wav" |
@@ -1,8 +1,9 @@ | |||||
#!/bin/bash | #!/bin/bash | ||||
## import common lib | ## import common lib | ||||
. ~/.noaa.conf | |||||
. "${NOAA_HOME}"/common.sh | |||||
. "$HOME/.noaa.conf" | |||||
. "$HOME/.tweepy.conf" | |||||
. "$NOAA_HOME/common.sh" | |||||
## pass start timestamp and sun elevation | ## pass start timestamp and sun elevation | ||||
PASS_START=$(expr "$5" + 90) | PASS_START=$(expr "$5" + 90) | ||||
@@ -53,8 +54,10 @@ if [ -f "${METEOR_OUTPUT}/${3}.dec" ]; then | |||||
python3 "${NOAA_HOME}/rectify.py" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.jpg" | python3 "${NOAA_HOME}/rectify.py" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122.jpg" | ||||
rm "${METEOR_OUTPUT}/${3}-122.bmp" | rm "${METEOR_OUTPUT}/${3}-122.bmp" | ||||
rm "${METEOR_OUTPUT}/${3}.bmp" | rm "${METEOR_OUTPUT}/${3}.bmp" | ||||
log "Posting to Twitter" "INFO" | |||||
python3 "${NOAA_HOME}/post.py" "$1 EXPERIMENTAL ${START_DATE} Resolución completa: http://weather.reyni.co/image/${FOLDER_DATE}/${3}-122-rectified.jpg" "$7" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified.jpg" | |||||
if [ -n "$CONSUMER_KEY" ]; then | |||||
log "Posting to Twitter" "INFO" | |||||
python3 "${NOAA_HOME}/post.py" "$1 EXPERIMENTAL ${START_DATE} Resolución completa: http://weather.reyni.co/image/${FOLDER_DATE}/${3}-122-rectified.jpg" "$7" "${NOAA_OUTPUT}/image/${FOLDER_DATE}/${3}-122-rectified.jpg" | |||||
fi | |||||
else | else | ||||
log "Decoding failed, either a bad pass/low SNR or a software problem" "ERROR" | log "Decoding failed, either a bad pass/low SNR or a software problem" "ERROR" | ||||
fi | fi |
@@ -0,0 +1,4 @@ | |||||
export CONSUMER_KEY="" | |||||
export CONSUMER_SECRET="" | |||||
export ACCESS_TOKEN_KEY="" | |||||
export ACCESS_TOKEN_SECRET="" |