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

* Added $if_mpd_playing patch (thanks tarpman)

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1267 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Brenden Matthews 2008-10-08 11:44:27 +00:00
parent 1ab4b8ec51
commit 4be537a020
9 changed files with 117 additions and 77 deletions

View File

@ -270,6 +270,7 @@ roiban adi <adiroiban at users dot sourceforge dot net>
Ryan Tandy <tarpman at users dot sourceforge dot net> Ryan Tandy <tarpman at users dot sourceforge dot net>
fs_type patch fs_type patch
if_mpd_playing patch
Rui Paulo <rpaulo at netbsd-pt dot org> Rui Paulo <rpaulo at netbsd-pt dot org>
NetBSD support NetBSD support

View File

@ -2,6 +2,7 @@
2008-10-08 2008-10-08
* Applied OpenBSD patches * Applied OpenBSD patches
* Added $if_mpd_playing patch (thanks tarpman)
2008-09-24 2008-09-24
* Introduced (buggy) support for IMAP IDLE * Introduced (buggy) support for IMAP IDLE

7
README
View File

@ -1230,6 +1230,11 @@ conky(1) conky(1)
name, depending on whats available name, depending on whats available
1mif_mpd_playing0m
if mpd is playing or paused, display everything between
$if_mpd_playing and the matching $endif
1mnameserver (index)0m 1mnameserver (index)0m
Print a nameserver from /etc/resolv.conf. Index starts at and Print a nameserver from /etc/resolv.conf. Index starts at and
defaults to 0. defaults to 0.
@ -1718,4 +1723,4 @@ conky(1) conky(1)
2008-09-28 conky(1) 2008-10-08 conky(1)

View File

@ -5,7 +5,7 @@
\\$2 \(la\\$1\(ra\\$3 \\$2 \(la\\$1\(ra\\$3
.. ..
.if \n(.g .mso www.tmac .if \n(.g .mso www.tmac
.TH conky 1 2008-09-28 "" "" .TH conky 1 2008-10-08 "" ""
.SH NAME .SH NAME
conky \- A system monitor for X originally based on the torsmo code, but more kickass. It just keeps on given'er. Yeah. conky \- A system monitor for X originally based on the torsmo code, but more kickass. It just keeps on given'er. Yeah.
.SH SYNOPSIS .SH SYNOPSIS
@ -1048,6 +1048,10 @@ Prints the file name of the current MPD song
\fB\*(T<\fBmpd_smart\fR\*(T>\fR \*(T<\fB(max length)\fR\*(T> \fB\*(T<\fBmpd_smart\fR\*(T>\fR \*(T<\fB(max length)\fR\*(T>
Prints the song name in either the form "artist - title" or file name, depending on whats available Prints the song name in either the form "artist - title" or file name, depending on whats available
.TP
\fB\*(T<\fBif_mpd_playing\fR\*(T>\fR
if mpd is playing or paused, display everything between $if_mpd_playing and the matching $endif
.TP .TP
\fB\*(T<\fBnameserver\fR\*(T>\fR \*(T<\fB(index)\fR\*(T> \fB\*(T<\fBnameserver\fR\*(T>\fR \*(T<\fB(index)\fR\*(T>
Print a nameserver from /etc/resolv.conf. Index starts at and defaults to 0. Print a nameserver from /etc/resolv.conf. Index starts at and defaults to 0.

View File

@ -16,7 +16,7 @@
<firstname>Brenden</firstname> <firstname>Brenden</firstname>
<surname>Matthews</surname> <surname>Matthews</surname>
</author> </author>
<date>2008-09-28</date> <date>2008-10-08</date>
</refentryinfo> </refentryinfo>
<refmeta> <refmeta>

View File

@ -1572,6 +1572,15 @@
<para></para></listitem> <para></para></listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>
<command><option>if_mpd_playing</option></command>
</term>
<listitem>
if mpd is playing or paused, display everything between $if_mpd_playing and the matching $endif
<para></para></listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term> <term>
<command><option>nameserver</option></command> <command><option>nameserver</option></command>

View File

@ -1317,6 +1317,7 @@ enum text_object_type {
OBJ_mpd_file, OBJ_mpd_file,
OBJ_mpd_percent, OBJ_mpd_percent,
OBJ_mpd_smart, OBJ_mpd_smart,
OBJ_if_mpd_playing,
#endif #endif
#ifdef MOC #ifdef MOC
OBJ_moc_state, OBJ_moc_state,
@ -2537,6 +2538,7 @@ static void free_text_objects(struct text_object_list *text_object_list, char fu
case OBJ_mpd_file: case OBJ_mpd_file:
case OBJ_mpd_percent: case OBJ_mpd_percent:
case OBJ_mpd_smart: case OBJ_mpd_smart:
case OBJ_if_mpd_playing:
if (full) { if (full) {
free_mpd_vars(&info.mpd); free_mpd_vars(&info.mpd);
} }
@ -3992,6 +3994,13 @@ static struct text_object *construct_text_object(const char *s,
} else { } else {
obj->data.i = 0; obj->data.i = 0;
} }
END OBJ_THREAD(if_mpd_playing, INFO_MPD)
if (blockdepth >= MAX_IF_BLOCK_DEPTH) {
CRIT_ERR("MAX_IF_BLOCK_DEPTH exceeded");
}
blockstart[blockdepth] = object_count;
obj->data.ifblock.pos = object_count + 2;
blockdepth++;
#endif /* MPD */ #endif /* MPD */
#ifdef MOC #ifdef MOC
END OBJ_THREAD(moc_state, INFO_MOC) END OBJ_THREAD(moc_state, INFO_MOC)
@ -5948,6 +5957,14 @@ static void generate_text_internal(char *p, int p_max_size,
*p = 0; *p = 0;
} }
} }
OBJ(if_mpd_playing) {
if (cur->mpd.is_playing) {
if_jumped = 0;
} else {
i = obj->data.ifblock.pos;
if_jumped = 1;
}
}
#endif #endif
#ifdef MOC #ifdef MOC

View File

@ -113,6 +113,7 @@ void clear_mpd_stats(struct mpd_s *mpd)
*mpd->repeat = 0; *mpd->repeat = 0;
*mpd->track = 0; *mpd->track = 0;
*mpd->status = 0; *mpd->status = 0;
mpd->is_playing = 0;
mpd->bitrate = 0; mpd->bitrate = 0;
mpd->progress = 0; mpd->progress = 0;
mpd->elapsed = 0; mpd->elapsed = 0;
@ -208,6 +209,7 @@ void *update_mpd(void *arg)
} }
if (status->state == MPD_STATUS_STATE_PLAY if (status->state == MPD_STATUS_STATE_PLAY
|| status->state == MPD_STATUS_STATE_PAUSE) { || status->state == MPD_STATUS_STATE_PAUSE) {
mpd->is_playing = 1;
mpd->bitrate = status->bitRate; mpd->bitrate = status->bitRate;
mpd->progress = (float) status->elapsedTime / mpd->progress = (float) status->elapsedTime /
status->totalTime; status->totalTime;

View File

@ -14,6 +14,7 @@ struct mpd_s {
char *track; char *track;
char *name; char *name;
char *file; char *file;
int is_playing;
int volume; int volume;
unsigned int port; unsigned int port;
char host[128]; char host[128];