GNOME Bugzilla – Bug 521628
Banshee allows multiple instances
Last modified: 2008-09-08 03:55:04 UTC
Please describe the problem: I am huge fan of Banshee, and I've tried to make it work with Conky ( http://conky.sourceforge.net/ ). Steps to reproduce: 1. Setup a ${if_running banshee} ${execi 10 banshee --query-title} $endif in .conkyrc 2. Launch Conky 3. Launch Banshee Actual results: Multiple instances of Banshee occur when you query it while the splash screen is showing. When you try to close the application, it gets restarted. Expected results: banshee --query-* should fail if banshee is not running. You might consider having a separate banshee-query process or writing the now playing information to a file that can be read off disk and parsed. Does this happen every time? Yes Other information: I have pasted the .conkyrc file and my workaround script to this bug. Change the path to the script to match where you saved it onto your system. I'm getting around this bug by querying Banshee indirectly with another PID check and an initial sleep command to wait for it to initialise properly. Check .conkyrc to see how the 'init' part is called. .conkyrc --------------------------------------------------------------------------------- # THIS CONFIG RELIES ON 2 SCRIPTS, CPUSPEED AND CPUTEMP # YOUR SYSTEM MAY NOT REQUIRE THEM, REPLACE AS DESIRED # This is the number of times Conky will update before quitting. # Set to zero to run forever. total_run_times 0 # maintain spacing between certain elements use_spacer yes # set to yes if you want conky to be forked in the background background yes use_xft yes # Xft font when Xft is enabled xftfont Sans-8 #xftfont Andale Mono-9 #xftfont Clean-8 #xftfont cubicfive10:pixelsize=8 #xftfont squaredance10:pixelsize=14 #xftfont swf!t_v02:pixelsize=10 # Text alpha when using Xft xftalpha 1 mail_spool $MAIL # Update interval in seconds update_interval 1.0 # Create own window instead of using desktop (required in nautilus) own_window yes own_window_type override own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager own_window_transparent yes maximum_width 200 # Use double buffering (reduces flicker, may not work for everyone) double_buffer yes # Minimum size of text area minimum_size 200 5 # Draw shades? draw_shades no # Draw outlines? draw_outline no # amplifies text # Draw borders around text draw_borders no # Stippled borders? stippled_borders 5 # border margins border_margin 9 # border width border_width 1 # Default colors and also border colours default_color white default_shade_color 7b7b7b default_outline_color white # Heading colour color0 ffffff # Label colour color1 b1eaff # Graph outline color2 ffffff # Graph colour one color3 ffffff # Graph colour two color4 ffffff color5 ffffff # Top colour one color6 b1eaff # Top colour two color7 ffffff # Top colour three color8 ffffff # Top colour four color9 ffffff # Text alignment, other possible values are commented # Values:top_left|top_right bottom_left|bottom_right alignment bottom_left # Gap between borders of screen and text gap_x 5 gap_y 5 # Subtract file system buffers from used memory? no_buffers yes # set to yes if you want all text to be in uppercase uppercase no #${execi 10 if [ -z "$BANSHEE_STARTING" ]; then sleep 5;BANSHEE_STARTING=1; fi} # stuff after 'TEXT' will be formatted on screen TEXT ${color0}${font openlogos:bold:size=20}B${font impact:bold size=20} ARCH LINUX$font ${color1}Date: $color${alignr}${exec date +"%a, %d %b, %H:%m"} ${color1}Weather: $color${alignr}${execi 600 ~/Scripts/weather.sh "30043"} ${color1}Gmail: $color${execi 600 perl ~/Scripts/gmail.pl n} ${color1}Uptime: $color${alignr}${uptime} ${color1}Load: $color${alignr}${loadavg 1} ${loadavg 2} ${loadavg 3} ${if_running banshee} ${execi 10 export BANSHEE_STARTING=`~/Scripts/banshee.sh init`} ${color0}${font impact:bold size=20}MUSIC$font ${color1}Artist: $color${alignr}${execi 10 ~/Scripts/banshee.sh artist} ${color1}Title: $color${alignr}${execi 10 ~/Scripts/banshee.sh title} ${color1}Album: $color${alignr}${execi 10 ~/Scripts/banshee.sh album} ${color0}${execibar 10 ~/Scripts/banshee.sh progress} $endif ${color0}${font impact:bold size=20}PROCESSES$font ${color1}CPU: $color$cpu% ${alignr}${acpitemp}°C ${color1}${cpugraph 20,200 ffffff ffffff} ${color6}${top name 1}${alignr}${top cpu 1}% ${color7}${top name 2}${alignr}${top cpu 2}% ${color8}${top name 3}${alignr}${top cpu 3}% ${color0}${font impact:bold size=20}MEMORY$font ${color1}RAM: $color${alignr}$memperc% ${color2}${membar 3,200}${color} ${color1}Swap: $color${alignr}$swapperc% ${color2}${swapbar 3,200}${color} ${alignr}$swap/$swapmax ${color0}${font impact:bold size=20}FILESYSTEM$font$color ${color1}Root: $color${alignr}${fs_free_perc /}% ${color2}${fs_bar 3,200 /} ${color1}Home: $color${alignr}${fs_free_perc /home}% ${color2}${fs_bar 3,200 /home} ${color0}${font impact:bold size=20}NETWORK$font$color ${color1}Name: $color${alignr}${wireless_essid eth1} ${color1}Bitrate: $color${alignr}${wireless_bitrate eth1} ${color1}Quality: $color${wireless_link_qual_perc eth1} ${color2}${wireless_link_bar 3,200 eth1} ${color1}Down: $color${downspeed eth1}KiB/s ${color1}${alignr}Up: $color${upspeed eth1}KiB/s ${color1}${downspeedgraph eth1 20,99 ffffff ffffff} ${upspeedgraph eth1 20,99 ffffff ffffff} banshee.sh ------------------------------------------------------------------------------- #!/bin/sh if [ -z "$(pidof banshee)" ] then exit fi case "$1" in ( "init" ) if [ -z "$BANSHEE_STARTING" ] then sleep 7; echo "started" else echo "started" fi ;; ( "artist" ) echo `banshee --no-present --hide-field --query-artist` ;; ( "album" ) echo `banshee --no-present --hide-field --query-title` ;; ( "title" ) echo `banshee --no-present --hide-field --query-title` ;; ( "genre" ) echo `banshee --no-present --hide-field --query-genre` ;; ( "duration" ) echo `banshee --no-present --hide-field --query-duration` ;; ( "position" ) echo `banshee --no-present --hide-field --query-position` ;; ( "uri" ) echo `banshee --no-present --hide-field --query-uri` ;; ( "cover-uri" ) echo `banshee --no-present --hide-field --query-uri` ;; ( "progress" ) STATUS=`banshee --no-present --hide-field --query-status` if [ "$STATUS" -ne "-1" ] then SONG_POSITION=`banshee --no-present --hide-field --query-position` SONG_DURATION=`banshee --no-present --hide-field --query-duration` echo $SONG_POSITION $SONG_DURATION | awk '{ print $1 / $2 * 100}' else echo 0 fi ;; esac
Created attachment 107073 [details] The banshee query wrapper script conky has to be started with 'rm /tmp/conky_banshee_started;conky
Created attachment 107074 [details] The conky configuration file The code in the bug comment does not work because exported variables expire. These two attachments should work.
There's a lot of extraneous information here; I'm not sure what affects Banshee. Are you just suggesting that 'banshee --query-*' not create a new instance?
Yes it should not create a new instance. If banshee is closed, there is nothing to query anyway. When it launches it, again there is nothing to query, because it will not automatically play anything. Furthermore, if you launch banshee, and if you query while it still showing the splash screen, you get multiple instances. In my case, 4-5 instances.
Does this still affect 1.0?
No, it has not been fixed. Paste this in ~/.conkyrc .conkyrc --------------------------------------------------------------------------------- # THIS CONFIG RELIES ON 2 SCRIPTS, CPUSPEED AND CPUTEMP # YOUR SYSTEM MAY NOT REQUIRE THEM, REPLACE AS DESIRED # This is the number of times Conky will update before quitting. # Set to zero to run forever. total_run_times 0 # maintain spacing between certain elements use_spacer yes # set to yes if you want conky to be forked in the background background yes use_xft yes # Xft font when Xft is enabled xftfont Sans-8 #xftfont Andale Mono-9 #xftfont Clean-8 #xftfont cubicfive10:pixelsize=8 #xftfont squaredance10:pixelsize=14 #xftfont swf!t_v02:pixelsize=10 # Text alpha when using Xft xftalpha 1 mail_spool $MAIL # Update interval in seconds update_interval 1.0 # Create own window instead of using desktop (required in nautilus) own_window yes own_window_type override own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager own_window_transparent yes maximum_width 200 # Use double buffering (reduces flicker, may not work for everyone) double_buffer yes # Minimum size of text area minimum_size 200 5 # Draw shades? draw_shades no # Draw outlines? draw_outline no # amplifies text # Draw borders around text draw_borders no # Stippled borders? stippled_borders 5 # border margins border_margin 9 # border width border_width 1 # Default colors and also border colours default_color white default_shade_color 7b7b7b default_outline_color white # Heading colour color0 ffffff # Label colour color1 b1eaff # Graph outline color2 ffffff # Graph colour one color3 ffffff # Graph colour two color4 ffffff color5 ffffff # Top colour one color6 b1eaff # Top colour two color7 ffffff # Top colour three color8 ffffff # Top colour four color9 ffffff # Text alignment, other possible values are commented # Values:top_left|top_right bottom_left|bottom_right alignment bottom_left # Gap between borders of screen and text gap_x 5 gap_y 5 # Subtract file system buffers from used memory? no_buffers yes # set to yes if you want all text to be in uppercase uppercase no # stuff after 'TEXT' will be formatted on screen TEXT ${color1}Date: $color${alignr}${exec date +"%a, %d %b, %H:%m"} ${color1}Uptime: $color${alignr}${uptime} ${color1}Load: $color${alignr}${loadavg 1} ${loadavg 2} ${loadavg 3} ${if_running banshee-1} ${color0}${font impact:bold size=20}MUSIC$font ${color1}Artist: $color${alignr}${execi 10 banshee-1 --no-present --hide-field --query-artist} ${color1}Title: $color${alignr}${execi 10 banshee-1 --no-present --hide-field --query-title} ${color1}Album: $color${alignr}${execi 10 banshee-1 --no-present --hide-field --query-album} ${color0}${execibar 10 echo $(($(banshee-1 --no-present --hide-field --query-position) / $(banshee-1 --no-present --hide-field --query-duration) * 100))} ${endif} ${color0}${font impact:bold size=20}PROCESSES$font ${color1}CPU: $color$cpu% ${alignr}${acpitemp}°C ${color1}${cpugraph 20,200 ffffff ffffff} ${color6}${top name 1}${alignr}${top cpu 1}% ${color7}${top name 2}${alignr}${top cpu 2}% ${color8}${top name 3}${alignr}${top cpu 3}% ${color0}${font impact:bold size=20}MEMORY$font ${color1}RAM: $color${alignr}$memperc% ${color2}${membar 3,200}${color} ${color1}Swap: $color${alignr}$swapperc% ${color2}${swapbar 3,200}${color} ${alignr}$swap/$swapmax ${color0}${font impact:bold size=20}FILESYSTEM$font$color ${color1}Root: $color${alignr}${fs_free_perc /}% ${color2}${fs_bar 3,200 /} ${color1}Home: $color${alignr}${fs_free_perc /home}% ${color2}${fs_bar 3,200 /home} ${color0}${font impact:bold size=20}NETWORK$font$color ${color1}Name: $color${alignr}${wireless_essid eth1} ${color1}Bitrate: $color${alignr}${wireless_bitrate eth1} ${color1}Quality: $color${wireless_link_qual_perc eth1} ${color2}${wireless_link_bar 3,200 eth1} ${color1}Down: $color${downspeed eth1}KiB/s ${color1}${alignr}Up:$color${upspeed eth1}KiB/s ${color1}${downspeedgraph eth1 20,99 ffffff ffffff} ${upspeedgraph eth1 20,99 ffffff ffffff}
Please don't post (or at least attach) the conky configuration files. They're unrelated to the bug at hand.
This bug is more general than just Conky. Consider the following steps. 0. Set Nautilus to open Banshee for Audio CDs. 1. Have Banshee open (optionally playing). 2. Insert an Audio CD. 3. A second instance runs. My completely untested guess is that this would generally affect any way Banshee is run, including the --query-* case mentioned above.
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.