Quantcast
Channel: Linux Device Hacking - Displays
Viewing all articles
Browse latest Browse all 91

LCD4Linux MPD Date patch (no replies)

$
0
0
Hi folks,

I've been playing a little with LCD4Linux and MPD and was disappointed to see the date of a song couldn't be extracted with the last official revision of the plugin.

I've patched it to add this possibility.

Here's the diff for anyone wishing to add this functionnality too:
--- plugin_mpd.c        2011-07-27 02:53:04.000000000 +0000
+++ plugin_mpd.c        2014-08-08 21:03:18.974863042 +0000
@@ -1,5 +1,5 @@
-/* $Id$
- * $URL$
+/* $Id: plugin_mpd.c 1150 2011-07-27 02:53:04Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_mpd.c $
  *
  * mpd informations v0.82
  *
@@ -576,6 +576,19 @@
        SetResult(&result, R_STRING, "");
 }

+static void getDate(RESULT * result)
+{
+    const char *value = NULL;
+    mpd_update();
+    if (currentSong != NULL) {
+       value = mpd_song_get_tag(currentSong, MPD_TAG_DATE, 0);
+    }
+    if (value)
+       SetResult(&result, R_STRING, charset_from_utf8(value));
+    else
+       SetResult(&result, R_STRING, "");
+}
+
 static void getFilename(RESULT * result)
 {
     const char *value = NULL;
@@ -881,6 +894,7 @@
     AddFunction("mpd::artist", 0, getArtist);
     AddFunction("mpd::title", 0, getTitle);
     AddFunction("mpd::album", 0, getAlbum);
+    AddFunction("mpd::date", 0, getDate);
     AddFunction("mpd::file", 0, getFilename);
     AddFunction("mpd::totalTimeSec", 0, totalTimeSec);
     AddFunction("mpd::elapsedTimeSec", 0, elapsedTimeSec);

You'll also find attached screen captures for a 320x240 LCD screen and the lcd4linux.conf used to generate them.

Greetz

Viewing all articles
Browse latest Browse all 91

Latest Images

Trending Articles



Latest Images