Subject: FVWM: Fvwm Playlist Menu

From: Antoine Marmignon <[email-masked]>
Date: Fri, 7 May 2004 18:55:44 +0200

I've been using mpd (http://www.musicpd.org/) for quite time and I've
created fvwm menus to control it, using fvwm-menu-directory to add files to
the playlists.

I'd like to know how it would actually possible to create a dynamic menu
showing the content of the current playlist.

The command 'mpc playlist' outputs the playlist like this:
# mpc playlist
#1) Artist - Song 1
#2) Artist - Song 2
#3) Artist - Song 3
#4) Artist - Song 4

It is possible to redirect the output of the 'mpc playlist' command to a
file then use the Read command but i'd like to make it more simple (using a
PipeRead)
-- 
Antoine Marmignon
<[email-masked]>
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Tavis Ormandy <[email-masked]>
Date: Fri, 07 May 2004 19:04:35 +0100

--On Friday, May 07, 2004 18:55:44 +0200 Antoine Marmignon
<[email-masked]> wrote:
> file then use the Read command but i'd like to make it more simple (using
> a PipeRead)

DestroyFunc PlayListMenu
AddToFunc PlayListMenu
+ I AddToMenu PlayList
+ I DynamicPopDownAction DestroyMenu Playlist
+ I PipeRead "mpc playlist | sed -e 's/\\(^.*$\\)/+ %menupixmap.png%\"\\1\"
Exec foobar/'"

then just use this function as your MissingSubmenuFunction, and add a Popup
Playlist to your menu. (havn't actually tested it, i dont use mpc, but
should work :)

-- 
-------------------------------------
[email-masked] | finger me for my gpg key.
-------------------------------------------------------

---

From: ".newmind" <[email-masked]>
Date: Fri, 07 May 2004 21:30:31 +0200

> file then use the Read command but i'd like to make it more simple  

i played a little bit with perl and xmmsctrl:
<code>
#!/usr/bin/perl
print 'DestroyMenu MenuXmms
AddToMenu MenuXmms
';

@playlist =`xmmsctrl playlist`;

#del first 8
$pos = `xmmsctrl getpos`;
if ($pos < 5) {$pos=6;}

for ($i=$pos-10;$i<=$pos+10;$i++) {

$tmp=substr($playlist[$i-1],4,100);
$tmo=chomp($tmp);
if ($i == $pos)  {$tmp=".: $tmp :.";}
print "+  \"$tmp\"    exec exec xmmsctrl track $i\n";
}
</code>

i know it's ugly, but hey, it works (kind of)

---

From: Antoine Marmignon <[email-masked]>
Date: Mon, 10 May 2004 00:53:56 +0200

> + I PipeRead "mpc playlist | sed -e 's/\\(^.*$\\)/+

Thanks, there's just a little typo: line 4 should read
+ I + DynamicPopDownAction DestroyMenu Playlist