Peter:

Would it be more 'SqueezeCenter-ish' to do this via the CLI?


Code:
--------------------
    $client->execute(['srvrpowerctrl', 'setblock', 'My reason for blocking 
msg', 'mypluginname']);
--------------------


and 


Code:
--------------------
    $client->execute(['srvrpowerctrl', 'clearblock', 'My reason for blocking 
msg', 'mypluginname']);
--------------------


If so, I have a question:

Can I return a 'blockcode' to the requester?  E.G, if, in my processing
of the CLI request, I do something like:


Code:
--------------------
    $request->addResult($blockcode);
  $request->setStatusDone();
--------------------


..is there an easy way for the requester to somehow retrieve that
value?  I've been assuming that CLI requests are processed
asynchronously, so it can't be as simple as


Code:
--------------------
    $blockcode = $client->execute(['srvrpowerctrl', 'setblock', 'My reason for 
blocking msg', 'mypluginname']);
--------------------


..but I don't really know.

Anyway, if the requester can retrieve that request result, then
unblocking becomes:


Code:
--------------------
    $client->execute(['srvrpowerctrl', 'clearblock', $blockcode, 
'mypluginname']);
--------------------

What do you think?  Is there any advantage to doing this via the CLI? 
For one thing, this allows a script running outside of SC to prevent a
shutdown.  E.G.


Code:
--------------------
    echo '00:04:20:06:29:11' srvrpowerctrl setblock 
Im_busy_now_dont_bother_me_kid viacli | nc -w 1 127.0.0.1 9090
--------------------

In that case, my plugin wouldn't require a valid blockcode to process a
clearblock request coming from 'viacli' requester.


-- 
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
[email protected]
http://lists.slimdevices.com/lists/listinfo/plugins

Reply via email to