mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-25 12:10:03 +00:00
fix clearing issue with mpd
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@944 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
parent
6c052dae9b
commit
0ae51e37ee
@ -233,7 +233,7 @@ void update_stuff()
|
||||
#ifdef MPD
|
||||
if (NEED(INFO_MPD)) {
|
||||
if (!mpd_timed_thread) {
|
||||
clear_mpd_stats(&info);
|
||||
init_mpd_stats(&info);
|
||||
mpd_timed_thread = timed_thread_create((void*)update_mpd, (void*) NULL, update_interval * 1000000);
|
||||
if (!mpd_timed_thread) {
|
||||
ERR("Failed to create MPD timed thread");
|
||||
|
@ -619,7 +619,7 @@ char *get_apm_battery_time(void);
|
||||
|
||||
/* in mpd.c */
|
||||
#ifdef MPD
|
||||
extern void clear_mpd_stats(struct information *current_info);
|
||||
extern void init_mpd_stats(struct information *current_info);
|
||||
void *update_mpd(void);
|
||||
extern timed_thread *mpd_timed_thread;
|
||||
#endif /* MPD */
|
||||
|
11
src/mpd.c
11
src/mpd.c
@ -32,8 +32,9 @@
|
||||
#include "libmpdclient.h"
|
||||
|
||||
timed_thread *mpd_timed_thread = NULL;
|
||||
void clear_mpd_stats(struct information *current_info);
|
||||
|
||||
void clear_mpd_stats(struct information *current_info)
|
||||
void init_mpd_stats(struct information *current_info)
|
||||
{
|
||||
if (current_info->mpd.artist == NULL)
|
||||
current_info->mpd.artist = malloc(TEXT_BUFFER_SIZE);
|
||||
@ -53,7 +54,11 @@ void clear_mpd_stats(struct information *current_info)
|
||||
current_info->mpd.name = malloc(TEXT_BUFFER_SIZE);
|
||||
if (current_info->mpd.file == NULL)
|
||||
current_info->mpd.file = malloc(TEXT_BUFFER_SIZE);
|
||||
clear_mpd_stats(current_info);
|
||||
}
|
||||
|
||||
void clear_mpd_stats(struct information *current_info)
|
||||
{
|
||||
*current_info->mpd.name=0;
|
||||
*current_info->mpd.file=0;
|
||||
*current_info->mpd.artist=0;
|
||||
@ -81,6 +86,9 @@ void *update_mpd(void)
|
||||
current_info->mpd.password);
|
||||
mpd_finishCommand(current_info->conn);
|
||||
}
|
||||
|
||||
timed_thread_lock(mpd_timed_thread);
|
||||
clear_mpd_stats(current_info);
|
||||
|
||||
if (current_info->conn->error || current_info->conn == NULL) {
|
||||
//ERR("%MPD error: s\n", current_info->conn->errorStr);
|
||||
@ -92,7 +100,6 @@ void *update_mpd(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
timed_thread_lock(mpd_timed_thread);
|
||||
mpd_Status *status;
|
||||
mpd_InfoEntity *entity;
|
||||
mpd_sendStatusCommand(current_info->conn);
|
||||
|
Loading…
Reference in New Issue
Block a user