1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-25 12:10:03 +00:00

add mpd_date function that shows date for current track (sf.net #3440445)

patch submitted by Andrey Tikhonov
This commit is contained in:
Pavel Labath 2012-01-29 21:06:01 +01:00
parent 00c9687c21
commit d884152376
6 changed files with 21 additions and 0 deletions

View File

@ -2276,6 +2276,15 @@
<listitem>Bitrate of current song <listitem>Bitrate of current song
<para /></listitem> <para /></listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>
<command>
<option>mpd_date</option>
</command>
</term>
<listitem>Date of current song
<para /></listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term> <term>
<command> <command>

View File

@ -1932,6 +1932,8 @@ void generate_text_internal(char *p, int p_max_size,
print_mpd_artist(obj, p, p_max_size); print_mpd_artist(obj, p, p_max_size);
OBJ(mpd_album) OBJ(mpd_album)
print_mpd_album(obj, p, p_max_size); print_mpd_album(obj, p, p_max_size);
OBJ(mpd_date)
print_mpd_date(obj, p, p_max_size);
OBJ(mpd_random) OBJ(mpd_random)
print_mpd_random(obj, p, p_max_size); print_mpd_random(obj, p, p_max_size);
OBJ(mpd_repeat) OBJ(mpd_repeat)

View File

@ -925,6 +925,9 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
END OBJ(mpd_album, &update_mpd) END OBJ(mpd_album, &update_mpd)
mpd_set_maxlen(mpd_album); mpd_set_maxlen(mpd_album);
init_mpd(); init_mpd();
END OBJ(mpd_date, &update_mpd)
mpd_set_maxlen(mpd_date);
init_mpd();
END OBJ(mpd_vol, &update_mpd) init_mpd(); END OBJ(mpd_vol, &update_mpd) init_mpd();
END OBJ(mpd_bitrate, &update_mpd) init_mpd(); END OBJ(mpd_bitrate, &update_mpd) init_mpd();
END OBJ(mpd_status, &update_mpd) init_mpd(); END OBJ(mpd_status, &update_mpd) init_mpd();
@ -1737,6 +1740,7 @@ void free_text_objects(struct text_object *root, int internal)
case OBJ_mpd_title: case OBJ_mpd_title:
case OBJ_mpd_artist: case OBJ_mpd_artist:
case OBJ_mpd_album: case OBJ_mpd_album:
case OBJ_mpd_date:
case OBJ_mpd_random: case OBJ_mpd_random:
case OBJ_mpd_repeat: case OBJ_mpd_repeat:
case OBJ_mpd_vol: case OBJ_mpd_vol:

View File

@ -95,6 +95,7 @@ static void clear_mpd(void)
xfree(mpd_info.title); xfree(mpd_info.title);
xfree(mpd_info.artist); xfree(mpd_info.artist);
xfree(mpd_info.album); xfree(mpd_info.album);
xfree(mpd_info.date);
/* do not free() the const char *status! */ /* do not free() the const char *status! */
/* do not free() the const char *random! */ /* do not free() the const char *random! */
/* do not free() the const char *repeat! */ /* do not free() the const char *repeat! */
@ -273,6 +274,7 @@ static void *update_mpd_thread(void *arg)
SONGSET(artist); SONGSET(artist);
SONGSET(album); SONGSET(album);
SONGSET(title); SONGSET(title);
SONGSET(date);
SONGSET(track); SONGSET(track);
SONGSET(name); SONGSET(name);
SONGSET(file); SONGSET(file);
@ -403,6 +405,7 @@ void print_mpd_##name(struct text_object *obj, char *p, int p_max_size) \
MPD_PRINT_GENERATOR(title, "%s") MPD_PRINT_GENERATOR(title, "%s")
MPD_PRINT_GENERATOR(artist, "%s") MPD_PRINT_GENERATOR(artist, "%s")
MPD_PRINT_GENERATOR(album, "%s") MPD_PRINT_GENERATOR(album, "%s")
MPD_PRINT_GENERATOR(date, "%s")
MPD_PRINT_GENERATOR(random, "%s") MPD_PRINT_GENERATOR(random, "%s")
MPD_PRINT_GENERATOR(repeat, "%s") MPD_PRINT_GENERATOR(repeat, "%s")
MPD_PRINT_GENERATOR(track, "%s") MPD_PRINT_GENERATOR(track, "%s")

View File

@ -7,6 +7,7 @@ struct mpd_s {
char *title; char *title;
char *artist; char *artist;
char *album; char *album;
char *date;
const char *status; const char *status;
const char *random; const char *random;
const char *repeat; const char *repeat;
@ -41,6 +42,7 @@ void print_mpd_smart(struct text_object *, char *, int);
void print_mpd_title(struct text_object *, char *, int); void print_mpd_title(struct text_object *, char *, int);
void print_mpd_artist(struct text_object *, char *, int); void print_mpd_artist(struct text_object *, char *, int);
void print_mpd_album(struct text_object *, char *, int); void print_mpd_album(struct text_object *, char *, int);
void print_mpd_date(struct text_object *, char *, int);
void print_mpd_random(struct text_object *, char *, int); void print_mpd_random(struct text_object *, char *, int);
void print_mpd_repeat(struct text_object *, char *, int); void print_mpd_repeat(struct text_object *, char *, int);
void print_mpd_track(struct text_object *, char *, int); void print_mpd_track(struct text_object *, char *, int);

View File

@ -327,6 +327,7 @@ enum text_object_type {
OBJ_mpd_title, OBJ_mpd_title,
OBJ_mpd_artist, OBJ_mpd_artist,
OBJ_mpd_album, OBJ_mpd_album,
OBJ_mpd_date,
OBJ_mpd_random, OBJ_mpd_random,
OBJ_mpd_repeat, OBJ_mpd_repeat,
OBJ_mpd_vol, OBJ_mpd_vol,