Twidge can post to both Twitter and Identica but can't do it with a single invocation. That's easily solved with a simple three line shell script taken from the Twidge web site. Or you can use the slightly more fancy script which gives a text length marker so you don't exceed the 140 character limit.
Of course, it was hard to resist "improving" things. ^_^ Here is my current script:
#!/bin/bashThere basically two additions over the original script. First, the text for the post is created in the vim editor, which is a more comfortable writing enviroment and, more importantly, has a spell checker! The second addition is to convert Identica groups, which are specified as "!tag", into a Twitter "#tag", since Twitter doesn't have groups.
tmpfile=$(mktemp)
trap "rm ${tmpfile}" EXIT
vim ${tmpfile}
if [ ! -s "${tmpfile}" ]; then
echo "No text, aborting update."
exit 1
fi
text=$(cat "${tmpfile}")
twidge -c "$HOME/.twidge/identica" update "${text}"
text=$(echo "${text}"|sed 's/\(^\| \)!\([[:alnum:]]\)/\1#\2/g')
twidge -c "$HOME/.twidge/twitter" update "${text}"
Hah, I hear you say! Why did my script become so complicated? But it is not really complicated once you realize these scripts are able to duplicate the basic functionality of Ping.fm, a complex web service, in a few lines of shell code. And so far, the script has proven to be more reliable that Ping.fm. The script is only as complicated as it needs to be, but no more.
Long live the command line!
No comments:
Post a Comment