peterw;474070 Wrote: > Gordon, I'm working on improvements to KidsPlay to allow escaping " and > ;. There should be a key routine like &getCommands($client,$macroString) > that returns an array of command arrays. Each command array would have > $client or undef in the first (last?) spot and the rest would be CLI > args parsed out as appropriate. Good point about recognizing MAC > addresses: I'll update KidsPlay to not require the terminal ":" if the > first word is a MAC address, so "00:04:20:11:22:33" and > "00:04:20:11:22:33:" as the first word would mean the same thing. An array of arrays, or, how about simple loop processing? This is how I'm presently doing it:
Code: -------------------- my @commands = split('&&', $command ); foreach my $cmd (@commands) { # parse the command my ($client, $arrayRef) = Slim::Control::Stdio::string_to_array($cmd); if (!defined $arrayRef) { next; } $res = Slim::Control::Request::executeRequest($client, $arrayRef); } -------------------- I'm not regex savvy enough to know offhand what the proper arg for split would be that would mean: ';' is a token, but not '\;'. But I'm sure there is one. A new version of string_to_array could be written easily enough that could do all your command parsing, carving out clients from aliases, mac addresses, keywords, etc. In the case of multiple clients, $client could become an array ref. I can't confidently say that I know the CLI well enough that I can foresee all the syntax needs here. And my approach to writing perl code is pretty heavy handed. There's probably a more elegant way of going about this. -- gharris999 ------------------------------------------------------------------------ gharris999's Profile: http://forums.slimdevices.com/member.php?userid=115 View this thread: http://forums.slimdevices.com/showthread.php?t=48521 _______________________________________________ plugins mailing list plugins@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/plugins