How to get current live program title
#1
Hello,

I am able to get programe title with this code:

Code:
http://192.168.1.12:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "PVR.GetChannelDetails", "params": {"channelid": 2177, "properties" :["broadcastnow"]},"id": 1}]

but in this code I get too many parameters like here:

Code:
{"id":1,"jsonrpc":"2.0","result":{"channeldetails":{"broadcastnow":{"broadcastid":4686,"cast":"İlhan Şen,Burcu Özberk,Burak Yörük,Meli̇sa Döngel,Günay Karacaoğlu","channeluid":250530198,"director":"","endtime":"2021-11-12 21:00:00","episodename":"","episodenum":0,"episodepart":0,"filenameandpath":"pvr://guide/2178/2021-11-12 17:00:00.epg","firstaired":"1970-01-01","genre":["Romantik Komedi"],"hasrecording":false,"hastimer":false,"hastimerrule":false,"imdbnumber":"","isactive":true,"isseries":false,"originaltitle":"","parentalrating":0,"plot":"Tür: Romantik Komedi\nOyuncular: İlhan Şen, Burcu Özberk, Burak Yörük, Meli̇sa Döngel, Günay Karacaoğlu\nYapım Yılı: 2021\n","plotoutline":"","progress":4786,"progresspercentage":33.23611068725586,"rating":0,"recording":"","runtime":240,"serieslink":"","starttime":"2021-11-12 17:00:00","title":"Aşk Mantık İnti̇kam","wasactive":false,"writer":"","year":2021},"channelid":2177,"label":"TR:FOX UHD"}}}]

I just want to get title. How can I change this code to get only title?:
Code:
http://192.168.1.12:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "PVR.GetChannelDetails", "params": {"channelid": 2177, "properties" :["broadcastnow"]},"id": 1}]
Reply
#2
It might depend on the OS you use. AFAICS, you can't get the title via API request as there's no property for it. On linux you can use jq to get the matching section. I took your json-output above and put it into a file. I just left out the last ] which seems to be wrong in that case.

on linux I just can do the follwing: cat <filename> | jq . and then I get the following: https://termbin.com/77lk

You see, the output looks way cleaner. From that point you are able to use "jq" more and filter what you need. Just look at the indents:
cat filename | jq .result.channeldetails.broadcastnow.title
The first indent is "result", the 2nd is "channeldetails", the 3rd is "broadcastnow" and all the below are on the same level. So you simply have to pick the one you need, which is "title" in your case.

Which gets me: "Aşk Mantık İnti̇kam"

But as said, it might depend on which OS is in use and if that helps to solve your problem.
Reply
#3
(2021-12-24, 15:30)DaVu Wrote: It might depend on the OS you use. AFAICS, you can't get the title via API request as there's no property for it. On linux you can use jq to get the matching section. I took your json-output above and put it into a file. I just left out the last ] which seems to be wrong in that case.

on linux I just can do the follwing: cat <filename> | jq . and then I get the following: https://termbin.com/77lk

You see, the output looks way cleaner. From that point you are able to use "jq" more and filter what you need. Just look at the indents:
cat filename | jq .result.channeldetails.broadcastnow.title
The first indent is "result", the 2nd is "channeldetails", the 3rd is "broadcastnow" and all the below are on the same level. So you simply have to pick the one you need, which is "title" in your case.

Which gets me: "Aşk Mantık İnti̇kam"

But as said, it might depend on which OS is in use and if that helps to solve your problem.

Thank you very much @DaVu I have figured out!
Reply

Logout Mark Read Team Forum Stats Members Help
How to get current live program title0