mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-01-13 11:15:27 +00:00
mpd fixes
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@527 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
parent
6a649e98d2
commit
b123e01d42
@ -1,5 +1,8 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
|
2006-02-12
|
||||||
|
* Conky 1.4.0 released
|
||||||
|
|
||||||
2006-01-27
|
2006-01-27
|
||||||
* Cleaned up texeci code
|
* Cleaned up texeci code
|
||||||
|
|
||||||
|
36
src/mpd.c
36
src/mpd.c
@ -8,9 +8,9 @@
|
|||||||
void update_mpd()
|
void update_mpd()
|
||||||
{
|
{
|
||||||
struct information *current_info = &info;
|
struct information *current_info = &info;
|
||||||
current_info->conn =
|
if (current_info->conn == NULL) {
|
||||||
mpd_newConnection(current_info->mpd.host,
|
current_info->conn = mpd_newConnection(current_info->mpd.host, current_info->mpd.port, 10);
|
||||||
current_info->mpd.port, 10);
|
}
|
||||||
if (strlen(current_info->mpd.password) > 1) {
|
if (strlen(current_info->mpd.password) > 1) {
|
||||||
mpd_sendPasswordCommand(current_info->conn,
|
mpd_sendPasswordCommand(current_info->conn,
|
||||||
current_info->mpd.password);
|
current_info->mpd.password);
|
||||||
@ -19,6 +19,7 @@ void update_mpd()
|
|||||||
if (current_info->conn->error) {
|
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;
|
||||||
if (current_info->mpd.artist == NULL)
|
if (current_info->mpd.artist == NULL)
|
||||||
current_info->mpd.artist =
|
current_info->mpd.artist =
|
||||||
malloc(TEXT_BUFFER_SIZE);
|
malloc(TEXT_BUFFER_SIZE);
|
||||||
@ -57,15 +58,7 @@ void update_mpd()
|
|||||||
TEXT_BUFFER_SIZE - 1);
|
TEXT_BUFFER_SIZE - 1);
|
||||||
strncpy(current_info->mpd.track, "Unknown",
|
strncpy(current_info->mpd.track, "Unknown",
|
||||||
TEXT_BUFFER_SIZE - 1);
|
TEXT_BUFFER_SIZE - 1);
|
||||||
if (strlen(current_info->conn->errorStr) > 1) {
|
strncpy(current_info->mpd.status, "MPD not responding", TEXT_BUFFER_SIZE - 1);
|
||||||
strncpy(current_info->mpd.status,
|
|
||||||
current_info->conn->errorStr,
|
|
||||||
TEXT_BUFFER_SIZE - 1);
|
|
||||||
} else {
|
|
||||||
strncpy(current_info->mpd.status,
|
|
||||||
"MPD not responding",
|
|
||||||
TEXT_BUFFER_SIZE - 1);
|
|
||||||
}
|
|
||||||
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;
|
||||||
@ -82,6 +75,7 @@ void update_mpd()
|
|||||||
if ((status = mpd_getStatus(current_info->conn)) == NULL) {
|
if ((status = mpd_getStatus(current_info->conn)) == NULL) {
|
||||||
//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;
|
||||||
if (current_info->mpd.artist == NULL)
|
if (current_info->mpd.artist == NULL)
|
||||||
current_info->mpd.artist =
|
current_info->mpd.artist =
|
||||||
malloc(TEXT_BUFFER_SIZE);
|
malloc(TEXT_BUFFER_SIZE);
|
||||||
@ -98,8 +92,7 @@ void update_mpd()
|
|||||||
if (current_info->mpd.track == NULL)
|
if (current_info->mpd.track == NULL)
|
||||||
current_info->mpd.track = malloc(TEXT_BUFFER_SIZE);
|
current_info->mpd.track = malloc(TEXT_BUFFER_SIZE);
|
||||||
if (current_info->mpd.status == NULL)
|
if (current_info->mpd.status == NULL)
|
||||||
current_info->mpd.status =
|
current_info->mpd.status = malloc(TEXT_BUFFER_SIZE);
|
||||||
malloc(TEXT_BUFFER_SIZE);
|
|
||||||
if (current_info->mpd.name == NULL)
|
if (current_info->mpd.name == NULL)
|
||||||
current_info->mpd.name = malloc(TEXT_BUFFER_SIZE);
|
current_info->mpd.name = malloc(TEXT_BUFFER_SIZE);
|
||||||
if (current_info->mpd.file == NULL)
|
if (current_info->mpd.file == NULL)
|
||||||
@ -120,15 +113,7 @@ void update_mpd()
|
|||||||
TEXT_BUFFER_SIZE - 1);
|
TEXT_BUFFER_SIZE - 1);
|
||||||
strncpy(current_info->mpd.track, "Unknown",
|
strncpy(current_info->mpd.track, "Unknown",
|
||||||
TEXT_BUFFER_SIZE - 1);
|
TEXT_BUFFER_SIZE - 1);
|
||||||
if (strlen(current_info->conn->errorStr) > 1) {
|
strncpy(current_info->mpd.status, "MPD not responding", TEXT_BUFFER_SIZE - 1);
|
||||||
strncpy(current_info->mpd.status,
|
|
||||||
current_info->conn->errorStr,
|
|
||||||
TEXT_BUFFER_SIZE - 1);
|
|
||||||
} else {
|
|
||||||
strncpy(current_info->mpd.status,
|
|
||||||
"MPD not responding",
|
|
||||||
TEXT_BUFFER_SIZE - 1);
|
|
||||||
}
|
|
||||||
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;
|
||||||
@ -277,6 +262,7 @@ void update_mpd()
|
|||||||
if (current_info->conn->error) {
|
if (current_info->conn->error) {
|
||||||
//fprintf(stderr, "%s\n", current_info->conn->errorStr);
|
//fprintf(stderr, "%s\n", current_info->conn->errorStr);
|
||||||
mpd_closeConnection(current_info->conn);
|
mpd_closeConnection(current_info->conn);
|
||||||
|
current_info->conn = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -351,6 +337,7 @@ void update_mpd()
|
|||||||
if (current_info->conn->error) {
|
if (current_info->conn->error) {
|
||||||
//fprintf(stderr, "%s\n", current_info->conn->errorStr);
|
//fprintf(stderr, "%s\n", current_info->conn->errorStr);
|
||||||
mpd_closeConnection(current_info->conn);
|
mpd_closeConnection(current_info->conn);
|
||||||
|
current_info->conn = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -358,8 +345,9 @@ void update_mpd()
|
|||||||
if (current_info->conn->error) {
|
if (current_info->conn->error) {
|
||||||
//fprintf(stderr, "%s\n", current_info->conn->errorStr);
|
//fprintf(stderr, "%s\n", current_info->conn->errorStr);
|
||||||
mpd_closeConnection(current_info->conn);
|
mpd_closeConnection(current_info->conn);
|
||||||
|
current_info->conn = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mpd_freeStatus(status);
|
mpd_freeStatus(status);
|
||||||
mpd_closeConnection(current_info->conn);
|
// mpd_closeConnection(current_info->conn);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user