Project

General

Profile

Tvheadend api change channel number and tag

Added by M Fizz almost 6 years ago

I am trying to change the tag and channel number using the api.

I know the uuid of the channel and the uuid of the tag that i want to add to the channel. Channel UUID is found using the channel/grid and tag found using channeltag/grid

How do i use this to add a tag and change the channel number.

I believe I have to use idnode/save, but whilst the docs are really good the formatting required for the idnode is missing.


Replies (5)

RE: Tvheadend api change channel number and tag - Added by Joe User almost 6 years ago

Using the uuid of the channel, you can use the following to get the current information of the channel:

curl -q 'http://admin:pass@tvheadend:9981/api/idnode/load?uuid=cde30897ab8a6fd04ebc9aa9e01bfb1c'

Or I use the following for nice output:

curl -q 'http://admin:pass@tvheadend:9981/api/idnode/load?uuid=cde30897ab8a6fd04ebc9aa9e01bfb1c' | jq . | less

You can change the "value" of an "id".

So, using the uuids of the tags and channel, create a file with the info you want to change:
data.conf

node=[{"tags":["5528b04deba7ea8eb48e8232529e591e","ecf664a95fbed4df8d9736339f96826d"],"uuid":"cde30897ab8a6fd04ebc9aa9e01bfb1c"}]

Then something like this will update the tags:
curl -q --data @data.conf 'http://admin:pass@tvheadend:9981/api/idnode/save'

You can change the channel number in the same way, or to do both at the same time for a particular channel (uuid), you could change the conf file to something like:

node=[{"tags":["5528b04deba7ea8eb48e8232529e591e","ecf664a95fbed4df8d9736339f96826d"],"number":"222222","uuid":"cde30897ab8a6fd04ebc9aa9e01bfb1c"}]

Note: it appears that you have to "replace" the entire id/value instead of being able to just "add" to the existing. So for your tags, you would find out the existing list, then add the one you want and send them ALL.

Make sure you have backups before testing and also beware that "bad" data can crash tvheadend...

RE: Tvheadend api change channel number and tag - Added by M Fizz almost 6 years ago

thank you

worked after a lot of messing around with the syntax of curl and jq, finally got it working. This should go into the wiki, at least the "node" part at least, same way as conf.

RE: Tvheadend api change channel number and tag - Added by Dave Pickles almost 6 years ago

Joe Miller: thanks for the explanation; I've updated the API wiki.

RE: Tvheadend api change channel number and tag - Added by M Fizz almost 6 years ago

Joe User wrote:

Using the uuid of the channel, you can use the following to get the current information of the channel:
[...]

I am sturggling with delete node. I am trying pass json of multiple uuid but it returns with an "empty reply from server.

Have tried

{"uuid":["x","y","z","a"]}
[{"uuid":"x"},{"uuid":"y"},{"uuid":"z"},{"uuid":"a"}]
delete?uuid=x&y&z&a

This one above works, but it only deletes 1 record.

RE: Tvheadend api change channel number and tag - Added by Joe User almost 6 years ago

I can't test now, but probably need

delete?uuid=["x","y","z","a"]

    (1-5/5)