Linux How to get a specific response (title only) from a JSONRPC call for a PVR channel
#1
Exclamation 
Hello,

I need help to get specific information from return a code. I am using the code below with JSON-RPC but return is too long and I just need only one result of the return.

When i use this command :  
Code:
http://192.168.1.12:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "PVR.GetChannelDetails", "params": {"channelid": 2178, "properties" :["broadcastnow"]},"id": 1}]

I get this return:
Code:
 {"id":1,"jsonrpc":"2.0","result":{"channeldetails":{"broadcastnow":{"broadcastid":4077,"cast":"Duygu Çetinkaya,Okan Karacan,Paşhan Yılmazel,Ozan Güler","channeluid":250530198,"director":"Kamil Çetin","endtime":"2021-11-20 00:30:00","episodename":"","episodenum":0,"episodepart":0,"filenameandpath":"pvr://guide/2202/2021-11-19 22:30:00.epg","firstaired":"1970-01-01","genre":["Film"],"hasrecording":false,"hastimer":false,"hastimerrule":false,"imdbnumber":"","isactive":true,"isseries":false,"originaltitle":"","parentalrating":0,"plot":"Tür: Film\nYönetmen: Kamil Çetin\nOyuncular: Duygu Çetinkaya, Okan Karacan, Paşhan Yılmazel, Ozan Güler\nYapım Yeri: TR\n\nÖzlem Dersanesi’nin öğrencileri dersaneler arası müzik yarışmasının finali için Antalya’da bir otele yerleşmişlerdir. Kendileri adına yarışacak olan Ali’nin aniden hastalanmasıyla hiç de akıllarında olmayan otel çalışanı Zeynep’i kendi adlarına yarışmaya hazırlarlar. İlk görüşte Zeynep’e aşık olan Ali, arkadaşlarıyla birlikte Zeynep’in hayatındaki bilinmeyen gerçekleri öğrenerek onun için hayati bir önem taşıyan sorunu çözmek için kolları sıvar. Bu arada karşı dershanenin öğrencileri de yarışmayı kazanmak için her şeyi yapmaya hazırdır.","plotoutline":"","progress":4296,"progresspercentage":59.66666793823242,"rating":0,"recording":"","runtime":120,"serieslink":"","starttime":"2021-11-19 22:30:00","title":"Çılgın Dersane 3","wasactive":false,"writer":"","year":0},"channelid":2178,"label":"TR:FOX UHD"}}} 

In this return, I just need "title" information. how can I manage/use/edit or what code should I use to get this "title" info?

thanks in advance!
Reply
#2
I've specified the thread title a bit more, the initial one was pretty vague.
Reply
#3
Thank you. Is there anyone you know to help with this issue in the forum?
Reply
#4
If you want to lookup title in the json string (ie "title":"Çılgın Dersane 3") using for example python use something like this:

python:
import json

# assign http output to variable 'result'
result =  {"id":1,"jsonrpc":"2.0", ....... "title":"Çılgın Dersane 3","wasactive":false,"writer":"","year":0},"channelid":2178,"label":"TR:FOX UHD"}}} 

# parse 'result' to joson
js = json.loads(result)

# get 'title'
title = js["title"])

# print title
print("Title: " + title)
Reply
#5
Thank you for your quick answer. But I have solved the issue in another way.


The request sent with this code:

Code:
http://192.168.1.2:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "Player.GetItem", "params": { "properties": ["title", "album", "artist", "season", "episode", "duration", "showtitle", "tvshowid", "thumbnail", "file", "fanart", "streamdetails"], "playerid": 1 }, "id": "VideoGetItem"}]

The answer is refined with this code in Node.js (Use change node, choose Set option)

Code:
payload.result.item.title

By this way, I am able to get only title information. Thanks for everyone!
Reply

Logout Mark Read Team Forum Stats Members Help
How to get a specific response (title only) from a JSONRPC call for a PVR channel0