[lastbash-cvs] lastbash lastbash,1.91,1.92
Status: Beta
Brought to you by:
cstroie
|
From: Costin S. <cs...@us...> - 2006-12-08 12:48:57
|
Update of /cvsroot/lastbash/lastbash In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv5313 Modified Files: lastbash Log Message: Fixed the player activation. Added debug toggling support. Index: lastbash =================================================================== RCS file: /cvsroot/lastbash/lastbash/lastbash,v retrieving revision 1.91 retrieving revision 1.92 diff -u -d -r1.91 -r1.92 --- lastbash 8 Dec 2006 12:14:38 -0000 1.91 +++ lastbash 8 Dec 2006 12:48:54 -0000 1.92 @@ -98,6 +98,24 @@ [ "${DEBUG}" == "y" ] && echo "$1" >> "${DEBUG_FILE}" } +# Function: Write the debug header {{{1 +#----------------------------------------------------------------------------- +function debug_header() +{ + debug "------------------------------------------------" + debug " Debug session started on `date`" + debug "------------------------------------------------" +} + +# Function: Write the debug footer {{{1 +#----------------------------------------------------------------------------- +function debug_footer() +{ + debug "------------------------------------------------" + debug " Debug session ended on `date`" + debug "------------------------------------------------" +} + # Function: Set the xterm title {{{1 #----------------------------------------------------------------------------- function set_xterm() @@ -275,6 +293,9 @@ # Eventually, save the settings #save_settings + + # Write the debug footer + debug_footer fi exit $1 } @@ -1539,6 +1560,26 @@ tui_sbar } +# Function: TUI for toggling debug mode {{{1 +#----------------------------------------------------------------------------- +function tui_debug_toggle() +{ + if [ "${DEBUG}" == "y" ] + then + tui_sbar "Debug mode disabled" + DEBUG="n" + debug_footer + else + tui_sbar "Debug mode enabled" + DEBUG="y" + debug_header + fi + + # Sleep one moment and restore the status bar + sleep 1 + tui_sbar +} + # Function: Send commands to the player {{{1 #----------------------------------------------------------------------------- function player_command() @@ -1558,10 +1599,11 @@ function player_start() { # Return if no player is to be used - [ "${USE_PLAYER}" == "y" ] || return + [ "${USE_PLAYER}" != "y" ] || return if ! type -t mkfifo >/dev/null 2>&1 then + tui_sbar "No way to control the player, mkfifo is absent" "2" debug "No way to control the player, mkfifo is absent" USE_PLAYER="n" return @@ -1602,7 +1644,7 @@ function player_load() { # Return if no player is to be used - [ "${USE_PLAYER}" == "y" ] || return + [ "${USE_PLAYER}" != "y" ] || return # Set the status line tui_sbar "Loading the stream..." @@ -1630,7 +1672,7 @@ #----------------------------------------------------------------------------- function player_stop() { - [ "${USE_PLAYER}" == "y" ] || return + [ "${USE_PLAYER}" != "y" ] || return # Set the status line tui_sbar "Stop playing..." @@ -1647,7 +1689,7 @@ #----------------------------------------------------------------------------- function player_quit() { - [ "${USE_PLAYER}" == "y" ] || return + [ "${USE_PLAYER}" != "y" ] || return # Set the status line tui_sbar "Closing the player..." @@ -1827,6 +1869,7 @@ "k") tui_lastfm_command_skip ;; "p") tui_lastfm_rtp ;; "d") tui_lastfm_discovery ;; + "D") tui_debug_toggle ;; "s") tui_scroll_toggle ;; # Redisplay the TUI "${CTRL_L}") sigwinch ;; @@ -1908,9 +1951,7 @@ done # Write the debug header -debug "------------------------------------------------" -debug " Debug started on `date`" -debug "------------------------------------------------" +debug_header # Set a parameter, if this is the first instance first_instance && FIRST_INSTANCE="y" |