Project

General

Profile

CLI client: From the command line

Added by Narcis Garcia about 2 years ago

Is there any tool or any way I can send commands to TVHeadend service?
For example, I want to query current status (straming, recording, clients connected, etc.)


Replies (2)

RE: CLI client: From the command line - Added by Narcis Garcia about 2 years ago

Okay, I see that, for example, this command shows available channels list (first JSON, second 2D table):

curl --digest -u "user:password" "http://HOST:9981/api/channel/list" 
echo $(curl --digest -u "user:password" "http://HOST:9981/api/channel/list" | jq 'flatten(1)' | sed -e 's|{.*}||g') | tr '{' '\n' | cut -f 4,8 -d '"' | tr '"' '\t'

this command shows current serving streams; channels being watched (first JSON, second 2D table):

curl --digest -u "user:password" "http://HOST:9981/api/status/subscriptions" 
echo $(curl --digest -u "user:password" "http://HOST:9981/api/status/subscriptions" | jq 'flatten(1)' | tr -s '\t' ' ' | sed -e 's|{.*}||g' -e 's|^ ||g' -e 's|": |"|' -e 's|,$||' -e 's|\[$||' -e 's|\]$||') | tr '{}' '\n' | sed -e 's| "|"|g' -e 's|" |"|g' | cut -f 3,5,7,10,14,18,22,26,30,34,37,40,43,45,47,49 -d '"' | grep -e '"' | tr '"' '\t'

and this command shows current CPU load, recordings and channels being watched (XML)

curl --digest -u "user:password" "http://HOST:9981/status.xml" 

    (1-2/2)