mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-17 10:35:10 +00:00
small mpd code update
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@18 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
parent
94d0c146e6
commit
5dcbb18345
2
conky.1
2
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
|
||||
|
20
mpd.c
20
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;
|
||||
|
Loading…
Reference in New Issue
Block a user