Ok, so rather than posting code to the list and looking like a fool
again, I thought I'd ask if some modifications are wanted.

I had two other usability modifications for mpc. I like to add music to my playlist album-at-a-time, so I'll do something like:

    mpc add Ji<tab>J<tab>*<enter>

If I'm in my music directory, this adds The Jimi Hendrix Experience "Are You Experienced" album to my playlist. If I'm anywhere else, mpc reports:

    error: directory or file not found

Because when bash doesn't get any matches with a glob, it just passes
the string in bare to the program, so mpc add is sending
"Jimi_Hendrix/Jimi_Hendrix-Are_You_Experienced-*" to the server, and the
server doesn't parse globs, and the string doesn't exist as a file.

There are a few possible solutions to this:
 ‧ add globbing to 'mpc add', this would be pretty straight forward, but
   it wouldn't be network aware, and would break when the server is on
   a different machine.  This is probably a bad idea.

 ‧ write a wrapper script to mpc that checks for the add command and cds
   to the top of my music directory first.  This breaks in a networked
   environment (which means when I replace my aging stereo with a beagle
   board+wifi card+amplifier running mpd, I'll be back to where I am
   now, much like the add globbing to mpc add, above).

 ‧ add globbing to mpd.  This will be network transparent, but would
   probably only be used by the mpc client.

 ‧ have 'mpc add' grab the same list-all output from the server as
   'mpc tab' does, dump it to a tmpfile, and then run each command line
   arg over the tmpfile as a regex, keeping the matches, so

        mpc add Jimi_Hendrix/Jimi_Hendrix-Are_You_Experienced-.*

   would cause mpc add to select the "Are You Experienced" album from my
   song list.

Option four keeps the feature inside mpc instead of bloating mpd with
something that is only likely to be used by mpc, and works in a network
aware manner.  Any thoughts?  Any other possible (possibly better)
implementation ideas?  (I am volunteering to write the code at the end
of the discussion.)

Also, when I type

    mpc add <tab><tab>

the completer (via the mpc tab command) returns the entire contents of
my music directory (some 1300+ files right now, and that's a modest
music collection).  This makes the "print out possible completions"
feature of bash all but unusable.  My base music directory has 63
entries in it, so just returning completions to the next directory makes things work well again. I added a quick sed script to filter the completions only to the next directory. Because it still uses 'mpc tab', the bash completer script is still network transparent. Anyone intereseted?

Jeff
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to