Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
From: Henrik Enberg <henrik+news@enberg.org>
Subject: Re: Gnus elisp source for Now-Playing
Date: Tue, 25 Nov 2003 04:13:28 +0100	[thread overview]
Message-ID: <87isl9m97r.fsf@enberg.org> (raw)
In-Reply-To: <m3n0all1z4.fsf@home.tcob1.net>

sean@tcob1.net (Sean Rima) writes:

> Some where on the web I found and lost a segment of text that allowed
> for adding a X-XMMS-NOW-PLAYING header but I cannot find it. If
> anyone has something similar please share it,Please :)

put this in ~/.gnus:

(defun xmms-now-playing ()
  (let ((track (shell-command-to-string "xmms-now-playing")))
    (unless (string-equal "" track)
      (save-excursion
	(goto-char (point-min))
	(re-search-forward "^--text follows this line--")
	(forward-line 0)
	(insert "X-Now-Playing: " track "\n")))))

(add-hook 'message-setup-hook 'xmms-now-playing)

you also need the below C program. put it in a directory on $PATH when
you've compiled it.  Also, this requires the XMMS development headers to
be installed.  Use "apt-get install xmms-dev" if you're on on Debian.

---- xmms-now-playing.c ----

/* compile with:  
 gcc -O2 -Wall `xmms-config --cflags --libs` -o xmms-now-playing xmms-now-playing.c
 */

#include <xmmsctrl.h>
#include <glib.h>

int
main (void)
{
  int n = -1;

  if ((n = xmms_remote_get_playlist_pos (0)) > -1)
    {
      char *title;

      if ((title = xmms_remote_get_playlist_title (0, n)))
	{
	  g_print ("%s", title);
	  g_free (title);
	}
    }
  return 0;
}


       reply	other threads:[~2003-11-25  3:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <m3n0all1z4.fsf@home.tcob1.net>
2003-11-25  3:13 ` Henrik Enberg [this message]
     [not found]   ` <m3ptfgivl9.fsf@toyland.sauerland.de>
2003-11-25 19:23     ` Henrik Enberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87isl9m97r.fsf@enberg.org \
    --to=henrik+news@enberg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).