Features request

First of all i really like moc.
I'm switching from musicpd cause it can only play file indexed in his own database.

I use the cmdline interface.
#1 I' can't find a way to know the state of controls (shuffle,repeat,autonext).
I think it could be added in the info option (mocp -i).
in file interface.c in function interface_cmdline_file_info with something like this:

curr_file.state = get_state ();

printf("State: ");
if (curr_file.state == STATE_STOP) printf("STOP");
else if (curr_file.state == STATE_PLAY) printf("PLAY");
else if (curr_file.state == STATE_PAUSE) printf("PAUSE");

char* opts [] = { "Shuffle", "Repeat", "AutoNext" } ;
for ( i = 0; i < 3; ++i)
{
send_int_to_srv (CMD_GET_OPTION);
send_str_to_srv (opts);
if ( get_data_int () )
printf(" - %s", opts);
}
printf("\n");

if (curr_file.state != STATE_STOP)
{

....

So, for example, instead of
State: PLAY
i get
State: PLAY - Shuffle - Autonext

#2 I can't connect to server from a different user.
user1:/$mocp -M commondir -S
user2:/$mocp -M commondir -p

don't work cause only user1 has write permission on the created socket file.
I added:
umask(0);
at the beginning of the program in main.c and it works, but there should be a smarter solution.

#3 I ripped my cd collection and often i would like to play directly a track without using next/prev commands. So it would be nice if in play option (mocp -p) would be possible to select which track to play (es. mocp -p 4).

Thanks!
Fulvio Benini

Your propositions for -i and -p seem simple, I think I'll do that.

About socket: MOC wasn't created as a "multiuser" server, not even talking about security, there could be problems with such configuration, it was never tested.

--
Damian Pietras - MOC developer

Thanks a lot!

You can do this by creating a user/group for moc, call them moc. Make sure that all users using moc have the same MOCDir defined in .moc/config, that they have read/write access to that directory, and that they are members of the group moc. Run the server as the user moc, group moc, then 'chmod g+rw pid socket*'. Now whenever anyone runs the moc client, they will control the same server. This is similar operationally to the way Fulvio did it, but doesn't make me worry as much about privilege escalation as his method.

We use one computer this way in my office to play music off of, so my office mate and I don't have to swap around cabling and can control the music from our laptops wirelessly.

Hi,

I was also looking to get the state of repeat by commandline. It's still not possible, right?

BR
Markus

Yes, it is still not possible to get it (and I have to admit I hadn't picked up on this request when I picked up MOC maintenance).

I'm not sure I like the approach presented above, though, as I am wary that changing the existing output of %state might break some scripts living out there. Also, the toggles mentioned are unrelated to any audio MOC may be currently playing (or not).

I would probably want to go for a new format specifier of %toggles (unless anyone has a better name) which gives output looking like this:

Toggles: Shuffle Repeat Autonext

(with the relevant word being omitted if toggled off).

Let me know if anyone wants STEREO and NET available as they are related to the currently playing audio and probably deserve format specifiers of their own.

So, those are my initial thoughts. Feel free to comment.

I agree that changing existing state-strings would break scripts, including mine. ;)
Your approach sounds marvellous. "Toggles" seems intuitive, although help-texts call those thingies "Controls".

Do we have functionality to show toggles? If so, how can I get it. Thank's for your job

As is so often the case with these things, I started coding it up and found there was even more work which was required. I do plan to have that work done before MOC 2.6-beta1 however.