[bglug] blogjob twitter support

k|b|s kbs@bglug.it
Dom 3 Gen 2010 14:32:42 CET


blogjob adesso supporta anche twitter.
http://www.stixx.org/listing
http://twitter.com/joegalassia
;^)


--8<-- CUT HERE --8<-- 
#!/bin/bash
# Time-stamp: <bj, 3/1/2010 14:23:42 joe Exp>
# Version 0.3
# blogjob by Joe Galaxy
# the simpliest blog engine ever

EDITOR="emacs -nw"
NOW="`date +%s`"
BDIR="$HOME/blogjob"
RAW="$BDIR/.raw.$NOW"
TITLE="/tmp/title.$NOW"
POST="$BDIR/.post.$NOW"
HEAD="$BDIR/head.tmpl"
CONT="$BDIR/cont.tmpl"
FOOT="$BDIR/foot.tmpl"
if [ ! -d $BDIR ]; then
		mkdir "$BDIR"
fi
if (($#!=1)); then
	echo "usage:"
	echo -e "\tblogjob 'Post Title'"
	exit 1
else
echo "$1" > "$TITLE"

$EDITOR $RAW

echo "<!-- START $NOW -->" > $POST
echo "<h3><!-- TITLE -->`cat $TITLE`<!-- ENDTITLE --></h3>" >> $POST
echo "<p><!-- POST -->`cat $RAW`<!-- ENDPOST --></p>" >> $POST
echo "<hr /><h4><!-- DATE --> `date +'%Y-%m-%dT%H:%M:%SZ'` <!-- ENDDATE --> \
| $NOW | <a href='.raw.$NOW'>raw</a></h4>" >> $POST
echo "<!-- LINK .raw.$NOW -->" >> $POST
echo "<!-- END $NOW -->" >> $POST

cat $HEAD > $BDIR/index.html
awk '{print}' `ls -r $BDIR/.post.*` >> $BDIR/index.html
cat $FOOT >> $BDIR/index.html
# Optional
tidy -asxhtml -i -utf8 -m $BDIR/index.html
bj2atom > $BDIR/atom.xml

# bj2twitter
# tw is something like:
# tw() {
# curl -u "username:password" -d status="$*" -d source="blogjob" http://twitter.com/statuses/update.xml
# }
tw "`sed -e 's/<[^>]*>//g' $RAW`"

rm $TITLE
fi
--8<-- CUT HERE --8<-- 

-- 
perl -e '$_="m2jxmoaye.og\@iaqglcla";$_.=$1,print$2while s/(..)(.)//;'


Maggiori informazioni sulla lista bglug