1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-26 04:17:33 +00:00

fixup mpd stuff

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@936 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Brenden Matthews 2007-08-31 03:37:32 +00:00
parent 12baf6c0b4
commit c16e2a66fe

View File

@ -62,6 +62,7 @@ void clear_mpd_stats(struct information *current_info)
*current_info->mpd.random=0; *current_info->mpd.random=0;
*current_info->mpd.repeat=0; *current_info->mpd.repeat=0;
*current_info->mpd.track=0; *current_info->mpd.track=0;
*current_info->mpd.status=0;
current_info->mpd.bitrate = 0; current_info->mpd.bitrate = 0;
current_info->mpd.progress = 0; current_info->mpd.progress = 0;
current_info->mpd.elapsed = 0; current_info->mpd.elapsed = 0;
@ -70,9 +71,9 @@ void clear_mpd_stats(struct information *current_info)
void *update_mpd(void) void *update_mpd(void)
{ {
struct information *current_info = &info;
while (1) { while (1) {
struct information *current_info = &info; if (!current_info->conn) {
if (current_info->conn == NULL) {
current_info->conn = mpd_newConnection(current_info->mpd.host, current_info->mpd.port, 10); current_info->conn = mpd_newConnection(current_info->mpd.host, current_info->mpd.port, 10);
} }
if (strlen(current_info->mpd.password) > 1) { if (strlen(current_info->mpd.password) > 1) {
@ -81,10 +82,7 @@ void *update_mpd(void)
mpd_finishCommand(current_info->conn); mpd_finishCommand(current_info->conn);
} }
// This makes sure everything we need is malloc'ed and clear if (current_info->conn->error || current_info->conn == NULL) {
clear_mpd_stats(current_info);
if (current_info->conn->error) {
//ERR("%MPD error: s\n", current_info->conn->errorStr); //ERR("%MPD error: s\n", current_info->conn->errorStr);
mpd_closeConnection(current_info->conn); mpd_closeConnection(current_info->conn);
current_info->conn = 0; current_info->conn = 0;
@ -236,10 +234,10 @@ void *update_mpd(void)
continue; continue;
} }
mpd_freeStatus(status); mpd_freeStatus(status);
if (current_info->conn) { /* if (current_info->conn) {
mpd_closeConnection(current_info->conn); mpd_closeConnection(current_info->conn);
current_info->conn = 0; current_info->conn = 0;
} }*/
if (timed_thread_test(mpd_timed_thread)) timed_thread_exit(mpd_timed_thread); if (timed_thread_test(mpd_timed_thread)) timed_thread_exit(mpd_timed_thread);
continue; continue;
} }