#!/bin/bash # # Author: Zerial # Version: 0.1 # URL: http://dev.zerial.org/mpd-twitter # License: GPL # CONF_FILE=$HOME/.mpd-twitter USER=$(grep ^USERNAME $CONF_FILE |cut -f 2 -d "=") PASS=$(grep ^PASSWORD $CONF_FILE |cut -f 2 -d "=") if [ -f $CONF_FILE ]; then BEFORE=$(grep ^BEFORE $CONF_FILE |cut -f 2 -d "=") AFTER=$(grep ^AFTER $CONF_FILE |cut -f 2 -d "=") else Xdialog --title "Error" --beep --msgbox "Can't read your local config file. Please copy the /usr/local/share/mpd-twitter/mpd-twitter.local to $HOME/.mpd-twitter" 200 100 exit fi CURRENT_SONG=$(mpc current) MY_UPDATE="$BEFORE $CURRENT_SONG $AFTER" curl -u "$USER:$PASS" -d "status=$MY_UPDATE" -d "source=mpd-twit" "http://twitter.com/statuses/update.json" exit