1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-24 11:55:43 +00:00

patch 1319461

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@343 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Brenden Matthews 2005-10-11 01:37:46 +00:00
parent 36fa88a00f
commit 0c90c2a30a
5 changed files with 96 additions and 5 deletions

View File

@ -125,6 +125,9 @@ Roman Bogorodskiy <novel at clublife dot ru>
Szymon Boniecki
Reads current LC_TIME
tyir <tyir at users dot sourceforge dot net>
MPD features patch 1319461
Walt Nelson <wnelsonjr at comcast dot net>
$freq fix

View File

@ -1,5 +1,8 @@
# $Id$
2005-10-10
* More MPD objects (sf.net patch 1319461)
2005-10-07
* fixed mldonkey bug? sf.net bug 1316531

View File

@ -858,6 +858,8 @@ enum text_object_type {
OBJ_mpd_title,
OBJ_mpd_artist,
OBJ_mpd_album,
OBJ_mpd_random,
OBJ_mpd_repeat,
OBJ_mpd_vol,
OBJ_mpd_bitrate,
OBJ_mpd_status,
@ -866,6 +868,7 @@ enum text_object_type {
OBJ_mpd_bar,
OBJ_mpd_elapsed,
OBJ_mpd_length,
OBJ_mpd_track,
OBJ_mpd_percent,
#endif
};
@ -1014,6 +1017,9 @@ static void free_text_objects()
case OBJ_mpd_title:
case OBJ_mpd_artist:
case OBJ_mpd_album:
case OBJ_mpd_random:
case OBJ_mpd_repeat:
case OBJ_mpd_track:
case OBJ_mpd_status:
case OBJ_mpd_host:
#endif
@ -1699,13 +1705,17 @@ int a = stippled_borders, b = 1;
#ifdef MPD
OBJ(mpd_artist, INFO_MPD)
END OBJ(mpd_title, INFO_MPD)
END OBJ(mpd_random, INFO_MPD)
END OBJ(mpd_repeat, INFO_MPD)
END OBJ(mpd_elapsed, INFO_MPD)
END OBJ(mpd_length, INFO_MPD)
END OBJ(mpd_track, INFO_MPD)
END OBJ(mpd_percent, INFO_MPD)
END OBJ(mpd_album, INFO_MPD) END OBJ(mpd_vol,
INFO_MPD) END OBJ(mpd_bitrate,
INFO_MPD)
END OBJ(mpd_status, INFO_MPD) END OBJ(mpd_bar, INFO_MPD)
END OBJ(mpd_status, INFO_MPD)
END OBJ(mpd_bar, INFO_MPD)
(void) scan_bar(arg, &obj->data.pair.a, &obj->data.pair.b);
END
#endif
@ -2755,6 +2765,15 @@ static void generate_text()
OBJ(mpd_album) {
snprintf(p, n, "%s", cur->mpd.album);
}
OBJ(mpd_random) {
snprintf(p, n, "%s", cur->mpd.random);
}
OBJ(mpd_repeat) {
snprintf(p, n, "%s", cur->mpd.repeat);
}
OBJ(mpd_track) {
snprintf(p, n, "%s", cur->mpd.track);
}
OBJ(mpd_vol) {
snprintf(p, n, "%i", cur->mpd.volume);
}

View File

@ -96,6 +96,9 @@ struct mpd_s {
char *artist;
char *album;
char *status;
char *random;
char *repeat;
char *track;
int volume;
unsigned int port;
char host[128];

View File

@ -21,9 +21,18 @@ void update_mpd()
current_info->mpd.album = malloc(TEXT_BUFFER_SIZE);
if (current_info->mpd.title == NULL)
current_info->mpd.title = malloc(TEXT_BUFFER_SIZE);
if (current_info->mpd.random == NULL)
current_info->mpd.random = malloc(TEXT_BUFFER_SIZE);
if (current_info->mpd.repeat == NULL)
current_info->mpd.repeat = malloc(TEXT_BUFFER_SIZE);
if (current_info->mpd.track == NULL)
current_info->mpd.track = malloc(TEXT_BUFFER_SIZE);
strcpy(current_info->mpd.artist, "Unknown");
strcpy(current_info->mpd.album, "Unknown");
strcpy(current_info->mpd.title, "Unknown");
strcpy(current_info->mpd.random, "Unknown");
strcpy(current_info->mpd.repeat, "Unknown");
strcpy(current_info->mpd.track, "Unknown");
current_info->mpd.status = "MPD not responding";
current_info->mpd.bitrate = 0;
current_info->mpd.progress = 0;
@ -48,14 +57,22 @@ void update_mpd()
current_info->mpd.album = malloc(TEXT_BUFFER_SIZE);
if (current_info->mpd.title == NULL)
current_info->mpd.title = malloc(TEXT_BUFFER_SIZE);
if (current_info->mpd.random == NULL)
current_info->mpd.random = malloc(TEXT_BUFFER_SIZE);
if (current_info->mpd.track == NULL)
current_info->mpd.track = malloc(TEXT_BUFFER_SIZE);
strcpy(current_info->mpd.artist, "Unknown");
strcpy(current_info->mpd.album, "Unknown");
strcpy(current_info->mpd.title, "Unknown");
strcpy(current_info->mpd.random, "Unknown");
strcpy(current_info->mpd.repeat, "Unknown");
strcpy(current_info->mpd.track, "Unknown");
current_info->mpd.status = "MPD not responding";
current_info->mpd.bitrate = 0;
current_info->mpd.progress = 0;
current_info->mpd.elapsed = 0;
current_info->mpd.length = 0;
current_info->mpd.track = 0;
return;
}
current_info->mpd.volume = status->volume;
@ -71,6 +88,7 @@ void update_mpd()
current_info->mpd.progress = 0;
current_info->mpd.elapsed = 0;
current_info->mpd.length = 0;
current_info->mpd.track = 0;
if (current_info->mpd.artist == NULL)
current_info->mpd.artist =
malloc(TEXT_BUFFER_SIZE);
@ -78,9 +96,18 @@ void update_mpd()
current_info->mpd.album = malloc(TEXT_BUFFER_SIZE);
if (current_info->mpd.title == NULL)
current_info->mpd.title = malloc(TEXT_BUFFER_SIZE);
if (current_info->mpd.random == NULL)
current_info->mpd.random = malloc(TEXT_BUFFER_SIZE);
if (current_info->mpd.repeat == NULL)
current_info->mpd.repeat = malloc(TEXT_BUFFER_SIZE);
if (current_info->mpd.track == NULL)
current_info->mpd.track = malloc(TEXT_BUFFER_SIZE);
strcpy(current_info->mpd.artist, "Stopped");
strcpy(current_info->mpd.album, "Stopped");
strcpy(current_info->mpd.title, "Stopped");
strcpy(current_info->mpd.random, "Stopped");
strcpy(current_info->mpd.repeat, "Stopped");
strcpy(current_info->mpd.track, "Stopped");
}
if (status->state == MPD_STATUS_STATE_PAUSE) {
current_info->mpd.status = "Paused";
@ -91,6 +118,7 @@ void update_mpd()
current_info->mpd.progress = 0;
current_info->mpd.elapsed = 0;
current_info->mpd.length = 0;
current_info->mpd.track = 0;
if (current_info->mpd.artist == NULL)
current_info->mpd.artist =
malloc(TEXT_BUFFER_SIZE);
@ -98,9 +126,18 @@ void update_mpd()
current_info->mpd.album = malloc(TEXT_BUFFER_SIZE);
if (current_info->mpd.title == NULL)
current_info->mpd.title = malloc(TEXT_BUFFER_SIZE);
if (current_info->mpd.random == NULL)
current_info->mpd.random = malloc(TEXT_BUFFER_SIZE);
if (current_info->mpd.repeat == NULL)
current_info->mpd.repeat = malloc(TEXT_BUFFER_SIZE);
if (current_info->mpd.track == NULL)
current_info->mpd.track = malloc(TEXT_BUFFER_SIZE);
strcpy(current_info->mpd.artist, "Unknown");
strcpy(current_info->mpd.album, "Unknown");
strcpy(current_info->mpd.title, "Unknown");
strcpy(current_info->mpd.random, "Unknown");
strcpy(current_info->mpd.repeat, "Unknown");
strcpy(current_info->mpd.track, "Unknown");
}
if (status->state == MPD_STATUS_STATE_PLAY ||
status->state == MPD_STATUS_STATE_PAUSE) {
@ -109,7 +146,26 @@ void update_mpd()
(float) status->elapsedTime / status->totalTime;
current_info->mpd.elapsed = status->elapsedTime;
current_info->mpd.length = status->totalTime;
}
if (current_info->mpd.random == NULL)
current_info->mpd.random = malloc(TEXT_BUFFER_SIZE);
if (current_info->mpd.repeat == NULL)
current_info->mpd.repeat = malloc(TEXT_BUFFER_SIZE);
if (status->random == 0) {
strcpy(current_info->mpd.random, "Off");
} else if (status->random == 1){
strcpy(current_info->mpd.random, "On");
} else {
strcpy(current_info->mpd.random, "Unknown");
}
if (status->repeat == 0) {
strcpy(current_info->mpd.repeat, "Off");
} else if (status->repeat == 1){
strcpy(current_info->mpd.repeat, "On");
} else {
strcpy(current_info->mpd.repeat, "Unknown");
}
}
if (current_info->conn->error) {
@ -134,6 +190,8 @@ void update_mpd()
current_info->mpd.album = malloc(TEXT_BUFFER_SIZE);
if (current_info->mpd.title == NULL)
current_info->mpd.title = malloc(TEXT_BUFFER_SIZE);
if (current_info->mpd.track == NULL)
current_info->mpd.track = malloc(TEXT_BUFFER_SIZE);
if (song->artist) {
strcpy(current_info->mpd.artist, song->artist);
} else {
@ -149,6 +207,11 @@ void update_mpd()
} else {
strcpy(current_info->mpd.title, "Unknown");
}
if (song->track) {
strcpy(current_info->mpd.track, song->track);
} else {
strcpy(current_info->mpd.track, "Unknown");
}
if (entity != NULL) {
mpd_freeInfoEntity(entity);
}
@ -171,4 +234,4 @@ void update_mpd()
}
mpd_freeStatus(status);
mpd_closeConnection(current_info->conn);
}
}