From 62f8ff9be7a216c200cd59d699792628dca466d5 Mon Sep 17 00:00:00 2001 From: Philip Kovacs Date: Sun, 2 Sep 2007 04:26:08 +0000 Subject: [PATCH] mpd_interval -> music_player_interval git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@957 7f574dfc-610e-0410-a909-a81674777703 --- ChangeLog | 4 ++-- doc/config_settings.xml | 4 ++-- extras/nano/conky.nanorc | 2 +- extras/vim/syntax/conkyrc.vim | 1 + src/audacious.c | 3 ++- src/common.c | 3 ++- src/conky.c | 32 +++++++++++++------------------- src/conky.h | 2 +- 8 files changed, 24 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2b564caa..0ce63017 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,8 +2,8 @@ 2007-09-01 * Improved performance slightly - * Added 'mpd_interval' config option to specify an update interval for the - mpd thread + * Added 'music_player_interval' config option to specify an update interval for + music player threads (currently honored by mpd and audacious). * Fixed some minor memory leaks associated with SIGUSR1 2007-08-31 diff --git a/doc/config_settings.xml b/doc/config_settings.xml index 7f3a01a6..515a8313 100644 --- a/doc/config_settings.xml +++ b/doc/config_settings.xml @@ -270,9 +270,9 @@ - + - MPD thread update interval (defaults to Conky's update interval) + Music player thread update interval (defaults to Conky's update interval) diff --git a/extras/nano/conky.nanorc b/extras/nano/conky.nanorc index 03862467..1ac6297c 100644 --- a/extras/nano/conky.nanorc +++ b/extras/nano/conky.nanorc @@ -6,7 +6,7 @@ syntax "conky" "\.*conkyrc.*$" ## Configuration items -color green "\<(alignment|background|border_margin|border_width|cpu_avg_samples|default_color|default_shade_color|default_outline_color|double_buffer|draw_borders|draw_graph_borders|draw_shades|draw_outline|font|gap_x|gap_y|imap|mail_spool|max_port_monitor_connections|max_specials|max_user_text|maximum_width|minimum_size|mpd_host|mpd_port|mpd_password|net_avg_samples|no_buffers|out_to_console|override_utf8_locale|own_window|own_window_class|own_window_colour|own_window_hints|own_window_title|own_window_transparent|own_window_type|pad_percents|pop3|stippled_borders|total_run_times|update_interval|uppercase|use_spacer|use_xft|xftalpha|xftfont)\>" +color green "\<(alignment|background|border_margin|border_width|cpu_avg_samples|default_color|default_shade_color|default_outline_color|double_buffer|draw_borders|draw_graph_borders|draw_shades|draw_outline|font|gap_x|gap_y|imap|mail_spool|max_port_monitor_connections|max_specials|max_user_text|maximum_width|minimum_size|mpd_host|mpd_port|mpd_password|music_player_interval|net_avg_samples|no_buffers|out_to_console|override_utf8_locale|own_window|own_window_class|own_window_colour|own_window_hints|own_window_title|own_window_transparent|own_window_type|pad_percents|pop3|stippled_borders|total_run_times|update_interval|uppercase|use_spacer|use_xft|xftalpha|xftfont)\>" ## Variables color brightblue "\<(acpiacadapter|acpifan|acpitemp|acpitempf|addr|adt746xcpu|adt746xfan|align|alignr|apm_adapter|apm_battery_life|apm_battery_time|audacious_bar|audacious_bitrate|audacious_channels|audacious_filename|audacious_frequency|audacious_length|audacious_length_seconds|audacious_playlist_length|audacious_playlist_position|audacious_position|audacious_position_seconds|audacious_status|audacious_title|battery|battery_time|bmpx_album|bmpx_artist|bmpx_bitrate|bmpx_title|bmpx_track|bmpx_uri|buffers|cached|color|colour|cpu|cpubar|diskio|downspeed|downspeedf|else|entropy_avail|entropy_bar|entropy_poolsize|exec|execbar|execgraph|execi|execibar|execigraph|font|freq|freq_dyn|freq_dyn_g|freq_g|fs_bar|fs_free|fs_free_perc|fs_size|fs_used|goto|hddtemp|head|hr|hwmon|i2c|i8k_ac_status|i8k_bios|i8k_buttons_status|i8k_cpu_temp|i8k_cpu_tempf|i8k_left_fan_rpm|i8k_left_fan_status|i8k_right_fan_rpm|i8k_right_fan_status|i8k_serial|i8k_version|if_existing|if_running|if_mounted|kernel|linkstatus|loadavg|machine|mails|mem|membar|memmax|memperc|mpd_album|mpd_artist|mpd_bar|mpd_bitrate|mpd_elapsed|mpd_file|mpd_length|mpd_name|mpd_percent|mpd_smart|mpd_status|mpd_title|mpd_vol|new_mails|nodename|offset|outlinecolor|platform|pre_exec|processes|running_processes|shadecolor|stippled_hr|swap|swapbar|swapmax|swapperc|sysname|tab|tail|tcp_portmon|texeci|time|top|top_mem|totaldown|totalup|tztime|updates|upspeed|upspeedf|upspeedgraph|uptime|uptime_short|voffset|voltage_mv|voltage_v)\>" diff --git a/extras/vim/syntax/conkyrc.vim b/extras/vim/syntax/conkyrc.vim index e6f97948..cb820d0c 100644 --- a/extras/vim/syntax/conkyrc.vim +++ b/extras/vim/syntax/conkyrc.vim @@ -40,6 +40,7 @@ syn keyword ConkyrcSetting \ mpd_host \ mpd_password \ mpd_port + \ music_player_interval \ net_avg_samples \ no_buffers \ out_to_console diff --git a/src/audacious.c b/src/audacious.c index 330365d6..9f40516d 100644 --- a/src/audacious.c +++ b/src/audacious.c @@ -63,7 +63,8 @@ void update_audacious(void) int create_audacious_thread(void) { if (!info.audacious.p_timed_thread) - info.audacious.p_timed_thread = timed_thread_create (audacious_thread_func, NULL, 1000000); + info.audacious.p_timed_thread = + timed_thread_create (audacious_thread_func, NULL, info.music_player_interval * 1000000); if (!info.audacious.p_timed_thread || timed_thread_run (info.audacious.p_timed_thread)) return (-1); diff --git a/src/common.c b/src/common.c index 1bb7eb11..9447b426 100644 --- a/src/common.c +++ b/src/common.c @@ -234,7 +234,8 @@ void update_stuff() if (NEED(INFO_MPD)) { if (!mpd_timed_thread) { init_mpd_stats(&info); - mpd_timed_thread = timed_thread_create((void*)update_mpd, (void*) NULL, info.mpd.interval * 1000000); + mpd_timed_thread = + timed_thread_create((void*)update_mpd, (void*) NULL, info.music_player_interval * 1000000); if (!mpd_timed_thread) { ERR("Failed to create MPD timed thread"); } diff --git a/src/conky.c b/src/conky.c index 772ac260..03b2f238 100644 --- a/src/conky.c +++ b/src/conky.c @@ -1111,7 +1111,6 @@ enum text_object_type { OBJ_mpd_host, OBJ_mpd_port, OBJ_mpd_password, - OBJ_mpd_interval, OBJ_mpd_bar, OBJ_mpd_elapsed, OBJ_mpd_length, @@ -1121,6 +1120,7 @@ enum text_object_type { OBJ_mpd_percent, OBJ_mpd_smart, #endif + OBJ_music_player_interval, #ifdef XMMS2 OBJ_xmms2_artist, OBJ_xmms2_album, @@ -7065,13 +7065,13 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, b) == 0) else CONF_ERR; } - CONF("mpd_interval") { - if (value) - info.mpd.interval = strtod(value, 0); - else - CONF_ERR; - } #endif + CONF("music_player_interval") { + if (value) + info.music_player_interval = strtod(value, 0); + else + CONF_ERR; + } #ifdef __OpenBSD__ CONF("sensor_device") { if(value) @@ -7339,12 +7339,10 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, b) == 0) update_interval = strtod(value, 0); else CONF_ERR; -#ifdef MPD - if (info.mpd.interval == 0) { + if (info.music_player_interval == 0) { // default to update_interval - info.mpd.interval = update_interval; + info.music_player_interval = update_interval; } -#endif /* MPD */ } CONF("total_run_times") { if (value) @@ -7431,12 +7429,10 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, b) == 0) fclose(fp); #undef CONF_ERR -#ifdef MPD - if (info.mpd.interval == 0) { + if (info.music_player_interval == 0) { // default to update_interval - info.mpd.interval = update_interval; + info.music_player_interval = update_interval; } -#endif /* MPD */ } @@ -7641,12 +7637,10 @@ int main(int argc, char **argv) case 'u': update_interval = strtod(optarg, 0); -#ifdef MPD - if (info.mpd.interval == 0) { + if (info.music_player_interval == 0) { // default to update_interval - info.mpd.interval = update_interval; + info.music_player_interval = update_interval; } -#endif /* MPD */ break; case 'i': diff --git a/src/conky.h b/src/conky.h index b46ece0d..894d5a79 100644 --- a/src/conky.h +++ b/src/conky.h @@ -177,7 +177,6 @@ struct mpd_s { unsigned int port; char host[128]; char password[128]; - double interval; float progress; int bitrate; int length; @@ -351,6 +350,7 @@ struct information { #endif short kflags; /* kernel settings, see enum KFLAG */ struct entropy_s entropy; + double music_player_interval; }; enum {