From 5dcbb183454d2d96e0f4ba721657185c82435a43 Mon Sep 17 00:00:00 2001 From: Brenden Matthews Date: Tue, 26 Jul 2005 05:22:23 +0000 Subject: [PATCH] small mpd code update git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@18 7f574dfc-610e-0410-a909-a81674777703 --- conky.1 | 2 +- mpd.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/conky.1 b/conky.1 index ce3058e2..95bc948f 100644 --- a/conky.1 +++ b/conky.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.33. -.TH CONKY "1" "July 2005" "Conky 1.2 compiled Jul 24 2005" "User Commands" +.TH CONKY "1" "July 2005" "Conky 1.2 compiled Jul 25 2005" "User Commands" .SH NAME Conky .SH SYNOPSIS diff --git a/mpd.c b/mpd.c index 2f83714f..d03d7988 100644 --- a/mpd.c +++ b/mpd.c @@ -14,6 +14,16 @@ void update_mpd() if (current_info->conn->error) { //fprintf(stderr, "%s\n", current_info->conn->errorStr); mpd_closeConnection(current_info->conn); + if(current_info->mpd.artist == NULL) + current_info->mpd.artist = malloc(TEXT_BUFFER_SIZE); + if(current_info->mpd.album == NULL) + current_info->mpd.album = malloc(TEXT_BUFFER_SIZE); + if(current_info->mpd.title == NULL) + current_info->mpd.title = malloc(TEXT_BUFFER_SIZE); + strcpy(current_info->mpd.artist, "Unknown"); + strcpy(current_info->mpd.album, "Unknown"); + strcpy(current_info->mpd.title, "Unknown"); + current_info->mpd.status = "MPD not responding"; return; } @@ -26,6 +36,16 @@ void update_mpd() if ((status = mpd_getStatus(current_info->conn)) == NULL) { //fprintf(stderr, "%s\n", current_info->conn->errorStr); mpd_closeConnection(current_info->conn); + if(current_info->mpd.artist == NULL) + current_info->mpd.artist = malloc(TEXT_BUFFER_SIZE); + if(current_info->mpd.album == NULL) + current_info->mpd.album = malloc(TEXT_BUFFER_SIZE); + if(current_info->mpd.title == NULL) + current_info->mpd.title = malloc(TEXT_BUFFER_SIZE); + strcpy(current_info->mpd.artist, "Unknown"); + strcpy(current_info->mpd.album, "Unknown"); + strcpy(current_info->mpd.title, "Unknown"); + current_info->mpd.status = "MPD not responding"; return; } current_info->mpd.volume = status->volume;