[vitunes] Re: sending commands to running vitunes

  • From: Ryan Flannery <ryan.flannery@xxxxxxxxx>
  • To: vitunes@xxxxxxxxxxxxx
  • Date: Sat, 19 Feb 2011 15:26:23 -0500

Hi Kilian,

On Thu, Feb 17, 2011 at 6:56 PM, kilian <kilian.klimek@xxxxxxxxxxxxxx> wrote:
> Hello,
>
> I just implemented a nice new feature to send commands to vitunes from
> the command line.

Nice!  I've been wanting something like this for a while.

> With -c it's possible to send a command to a running vitunes instance.
> The :pl, or :playlist, command lets you jump to a playlist by name. So,
> if you have vitunes running in some terminal, you can execute:
>
>    vitunes -c 'pl Cool_Playlist' -c 'media_play'
>
> to start listening to Cool_Playlist. There is no sugar for the commands
> at the moment (you'll have to use the keybindings or command names used
> by vitunes internally).

Sounds good.

> One note about how commands are executed, when send to vitunes via the
> -c switch: it will first try to find a keybinding and if that fails just
> execute it as a command.
>
> Since the patch got a little larger I pushed it to repo.or.cz (branch:
> socket). Diff view here:
> http://repo.or.cz/w/vitunes.git/commitdiff/f3bb39d26eb5378aa58c199c8fbd8fef46e6ea2a
>
> Feedback welcome!

I've just glanced at the diff, and have the following:

1. +10 Internets for the value of VITUNES_RUNNING

2. I frequently have multiple instance of vitunes running at once, and
would like to keep this ability.  I don't want it to complicate
matters with the socket though... that is, I think it would be OK for
now to just have the 'first' instance of vitunes create a socket, and
subsequent instances, finding that the socket already exists, do not
create one.  Not ideal, but for now, I think it's acceptable.

3. Perhaps move the additional stuff in the main event-loop into a
different function (handle_socket_commands()?), just to keep the size
of that down.


I really like the idea... I've been wanting the ability to "echo ..."
> vitunes for a while :)

Cheers,
-Ryan

Other related posts: