Update of /cvsroot/lastbash/lastbash
In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv24823
Modified Files:
lastbash
Log Message:
Save the current playing meta info to a file.
Index: lastbash
===================================================================
RCS file: /cvsroot/lastbash/lastbash/lastbash,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- lastbash 8 Dec 2006 18:12:49 -0000 1.96
+++ lastbash 9 Dec 2006 12:24:17 -0000 1.97
@@ -31,6 +31,7 @@
USE_PLAYER="y"
AUTO_PLAY="y"
HTTP_CLIENT="auto" # $HTTP_CLIENTS, builtin, auto
+SAVE_NOW_PLAYING="y"
# Program identification
PROG_NAME="lastbash"
@@ -59,6 +60,7 @@
PID_FILE="${HOME_DIR}/pid"
COMMAND_FILE="${HOME_DIR}/command"
COMMAND_FILE_LOCK="${HOME_DIR}/command.lock"
+NOW_PLAYING_FILE="${HOME_DIR}/now_playing"
# Internal stuff
PLAYERS="mplayer"
@@ -124,6 +126,13 @@
[[ "${TERM}" =~ "^xterm" ]] && echo -ne "\e]0;$1\a"
}
+# Function: Save the now_playing file {{{1
+#-----------------------------------------------------------------------------
+function save_now_playing()
+{
+ [ "${SAVE_NOW_PLAYING}" == "y" ] && echo -n "$1" > "${NOW_PLAYING_FILE}"
+}
+
# Function: Print usage summary {{{1
#-----------------------------------------------------------------------------
function url_encode()
@@ -1028,12 +1037,14 @@
tput cup 6 2
echo -ne "${LINE}${T_EL}"
- # Set the xterm title
+ # Set the xterm title and save the now_playing file
if [ "${META_STREAMING}" == "true" ]
then
set_xterm "${META_ARTIST} - ${META_TRACK}"
+ save_now_playing "${META_ARTIST} - ${META_TRACK}"
else
set_xterm "${PROG_TITLE}: Not streaming"
+ save_now_playing
fi
}
|