[lastbash-cvs] SF.net SVN: lastbash: [234] lastbash/lastbash
Status: Beta
Brought to you by:
cstroie
From: <cs...@us...> - 2007-05-22 15:40:09
|
Revision: 234 http://lastbash.svn.sourceforge.net/lastbash/?rev=234&view=rev Author: cstroie Date: 2007-05-22 08:38:26 -0700 (Tue, 22 May 2007) Log Message: ----------- Added basic support for popup notifications on track change. Modified Paths: -------------- lastbash/lastbash Modified: lastbash/lastbash =================================================================== --- lastbash/lastbash 2007-04-25 15:36:06 UTC (rev 233) +++ lastbash/lastbash 2007-05-22 15:38:26 UTC (rev 234) @@ -63,7 +63,7 @@ COMMAND_FILE="${HOME_DIR}/command" COMMAND_FILE_LOCK="${HOME_DIR}/command.lock" NOWPLAYING_FILE="${HOME_DIR}/now_playing" -HISTORY_CVS_FILE="${HOME_DIR}/history.csv" +HISTORY_CSV_FILE="${HOME_DIR}/history.csv" # Internal stuff PLAYERS="mplayer" @@ -234,7 +234,7 @@ fi # The first row contains the columns titles - [ -f "${HISTORY_CVS_FILE}" ] || echo "\"${LBL_ARTIST}\",\"${LBL_ALBUM}\",\"${LBL_TRACK}\",\"${LBL_LENGTH}\",\"${LBL_ACTION}\"" > "${HISTORY_CVS_FILE}" + [ -f "${HISTORY_CSV_FILE}" ] || echo "\"${LBL_ARTIST}\",\"${LBL_ALBUM}\",\"${LBL_TRACK}\",\"${LBL_LENGTH}\",\"${LBL_ACTION}\"" > "${HISTORY_CSV_FILE}" local ARTIST ALBUM TRACK DURATION ACTION @@ -246,9 +246,17 @@ ACTION="${HISTORY_ACTION[$1]//\"/\"\"}" # Save the history items - echo "\"${ARTIST}\",\"${ALBUM}\",\"${TRACK}\",\"${DURATION}\",\"${ACTION}\"" >> "${HISTORY_CVS_FILE}" + echo "\"${ARTIST}\",\"${ALBUM}\",\"${TRACK}\",\"${DURATION}\",\"${ACTION}\"" >> "${HISTORY_CSV_FILE}" } +# Function: Run an external command on track change {{{1 +#----------------------------------------------------------------------------- +function run_on_track_change() +{ + # TODO Add generic support for notification + type -t notify-send >/dev/null 2>&1 && notify-send -t 2000 -i gtk-dialog-info "${PROG_TITLE}" "${META_ARTIST} - ${META_TRACK}" 2>/dev/null 1>/dev/null +} + # Function: Print usage summary {{{1 #----------------------------------------------------------------------------- function url_encode() @@ -589,7 +597,7 @@ # Send the request if wget --quiet \ --tries="3" \ - --timeout="5" \ + --timeout="30" \ --save-headers \ --header="Connection: Close" \ --user-agent="${PROG_TITLE}/${PROG_VER}" \ @@ -1200,6 +1208,7 @@ then set_term_title "${META_ARTIST} - ${META_TRACK}" save_nowplaying "${META_ARTIST} - ${META_TRACK}" + run_on_track_change "1" save_html "1" || tui_sbar $"Error while creating the HTML file." else set_term_title $"Not streaming" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |