mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-25 20:11:11 +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:
parent
1ab4b8ec51
commit
4be537a020
1
AUTHORS
1
AUTHORS
@ -270,6 +270,7 @@ roiban adi <adiroiban at users dot sourceforge dot net>
|
||||
|
||||
Ryan Tandy <tarpman at users dot sourceforge dot net>
|
||||
fs_type patch
|
||||
if_mpd_playing patch
|
||||
|
||||
Rui Paulo <rpaulo at netbsd-pt dot org>
|
||||
NetBSD support
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
2008-10-08
|
||||
* Applied OpenBSD patches
|
||||
* Added $if_mpd_playing patch (thanks tarpman)
|
||||
|
||||
2008-09-24
|
||||
* Introduced (buggy) support for IMAP IDLE
|
||||
|
7
README
7
README
@ -1230,6 +1230,11 @@ conky(1) conky(1)
|
||||
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
|
||||
Print a nameserver from /etc/resolv.conf. Index starts at and
|
||||
defaults to 0.
|
||||
@ -1718,4 +1723,4 @@ conky(1) conky(1)
|
||||
|
||||
|
||||
|
||||
2008-09-28 conky(1)
|
||||
2008-10-08 conky(1)
|
||||
|
@ -5,7 +5,7 @@
|
||||
\\$2 \(la\\$1\(ra\\$3
|
||||
..
|
||||
.if \n(.g .mso www.tmac
|
||||
.TH conky 1 2008-09-28 "" ""
|
||||
.TH conky 1 2008-10-08 "" ""
|
||||
.SH NAME
|
||||
conky \- A system monitor for X originally based on the torsmo code, but more kickass. It just keeps on given'er. Yeah.
|
||||
.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>
|
||||
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
|
||||
\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.
|
||||
|
@ -16,7 +16,7 @@
|
||||
<firstname>Brenden</firstname>
|
||||
<surname>Matthews</surname>
|
||||
</author>
|
||||
<date>2008-09-28</date>
|
||||
<date>2008-10-08</date>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
|
@ -1572,6 +1572,15 @@
|
||||
<para></para></listitem>
|
||||
</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>
|
||||
<term>
|
||||
<command><option>nameserver</option></command>
|
||||
|
17
src/conky.c
17
src/conky.c
@ -1317,6 +1317,7 @@ enum text_object_type {
|
||||
OBJ_mpd_file,
|
||||
OBJ_mpd_percent,
|
||||
OBJ_mpd_smart,
|
||||
OBJ_if_mpd_playing,
|
||||
#endif
|
||||
#ifdef MOC
|
||||
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_percent:
|
||||
case OBJ_mpd_smart:
|
||||
case OBJ_if_mpd_playing:
|
||||
if (full) {
|
||||
free_mpd_vars(&info.mpd);
|
||||
}
|
||||
@ -3992,6 +3994,13 @@ static struct text_object *construct_text_object(const char *s,
|
||||
} else {
|
||||
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 */
|
||||
#ifdef 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;
|
||||
}
|
||||
}
|
||||
OBJ(if_mpd_playing) {
|
||||
if (cur->mpd.is_playing) {
|
||||
if_jumped = 0;
|
||||
} else {
|
||||
i = obj->data.ifblock.pos;
|
||||
if_jumped = 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOC
|
||||
|
@ -113,6 +113,7 @@ void clear_mpd_stats(struct mpd_s *mpd)
|
||||
*mpd->repeat = 0;
|
||||
*mpd->track = 0;
|
||||
*mpd->status = 0;
|
||||
mpd->is_playing = 0;
|
||||
mpd->bitrate = 0;
|
||||
mpd->progress = 0;
|
||||
mpd->elapsed = 0;
|
||||
@ -208,6 +209,7 @@ void *update_mpd(void *arg)
|
||||
}
|
||||
if (status->state == MPD_STATUS_STATE_PLAY
|
||||
|| status->state == MPD_STATUS_STATE_PAUSE) {
|
||||
mpd->is_playing = 1;
|
||||
mpd->bitrate = status->bitRate;
|
||||
mpd->progress = (float) status->elapsedTime /
|
||||
status->totalTime;
|
||||
|
Loading…
Reference in New Issue
Block a user