Solved Issue - Unable to add PVR Timer using PVR.AddTimer

  Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Millencolin007 Offline
Fan
Posts: 548
Joined: Mar 2012
Reputation: 16
Location: Switzerland
Post: #1
I tried out the new function to add PVR Timers but wasn't able to add a new timer. I don't know if it is a bug or if I am doing something wrong.

First I retrieving a list of broadcasts
Code:
http://127.0.0.1:8080/jsonrpc?request={"jsonrpc":"2.0","method":"PVR.GetBroadcasts","params":{"channelid":11,"limits":{"end":3,"start":0}},"id":29}

Which returns some broadcasts
Code:
{
    "broadcasts": [
        {
            "broadcastid": 217163,
            "label": "La meilleure boulangerie de France"
        },
        {
            "broadcastid": 217165,
            "label": "Chasseurs d'appart'"
        },
        {
            "broadcastid": 217167,
            "label": "Meteo"
        }
    ],
    "limits": {
        "end": 3,
        "start": 0,
        "total": 61
    }
}

Then I tried to add a timer using a broadcast id
Code:
http://127.0.0.1:8080/jsonrpc?request={"jsonrpc":"2.0","method":"PVR.AddTimer","params":{"broadcastid":217163},"id":33}

It returns an error message
Code:
{
    "code": -32602,
    "message": "Invalid params."
}

I tested using Kodi 17.0-BETA3 from the Ubuntu ppa and as PVR backend I am using tvheadend.
(This post was last modified: 2017-01-24 22:37 by Millencolin007.)
find quote
Millencolin007 Offline
Fan
Posts: 548
Joined: Mar 2012
Reputation: 16
Location: Switzerland
Post: #2
It is still not possible to add a PVR Timer in the latest release candidate.

I had a short look at the code and could see the following in CPVROperations::AddTimer

The function tries to retrieve the broadcast using the broadcastid however it fails to return the correct entry
Code:
CFileItemPtr broadcast = CPVROperations::GetBroadcastFromBroadcastid(parameterObject["broadcastid"].asUnsignedInteger());

In GetBroadcastFromBroadcastid a EpgSearchFilter is created which is then used to retrieve the entry. Note that only the broadcastid is set in the filter
Code:
EpgSearchFilter filter;
  filter.Reset();
  filter.m_iUniqueBroadcastId = broadcastid;

  CFileItemList broadcasts;
  int resultSize = g_EpgContainer.GetEPGSearch(broadcasts, filter);

At some point GetEPGSearch calls EpgSearchFilter::FilterEntry which returns false for all epg entries since genre, duration etc... have not been set in the filter
Code:
bool EpgSearchFilter::FilterEntry(const CEpgInfoTag &tag) const
{
  return (MatchGenre(tag) &&
      MatchBroadcastId(tag) &&
      MatchDuration(tag) &&
      MatchStartAndEndTimes(tag) &&
      MatchSearchTerm(tag)) &&
      (!tag.HasPVRChannel() ||
       (MatchChannelType(tag) &&
        MatchChannelNumber(tag) &&
        MatchChannelGroup(tag) &&
        (!m_bFTAOnly || !tag.ChannelTag()->IsEncrypted())));
}
find quote
joethefox Offline
Team-Kodi Member
Posts: 1,815
Joined: Nov 2010
Reputation: 55
Post: #3
thanks to @ksooo a PR that fixes the issue is on the road Smile

leia: https://github.com/xbmc/xbmc/pull/11506
krypton: https://github.com/xbmc/xbmc/pull/11507
(This post was last modified: 2017-01-21 15:16 by joethefox.)
find quote
Millencolin007 Offline
Fan
Posts: 548
Joined: Mar 2012
Reputation: 16
Location: Switzerland
Post: #4
Thanks for the info. I was able to add a new timer using most recent nightly build Smile
find quote
popy Offline
Senior Member
Posts: 216
Joined: Nov 2008
Reputation: 1
Post: #5
Hey guys,.is there a json call to just add a timer for the current running live stream?

wants to add an "alexa, tell kodi to record current show" utterance to my custom skill :-)

thx
pOpY
find quote
popy Offline
Senior Member
Posts: 216
Joined: Nov 2008
Reputation: 1
Post: #6
I had success on getting broadcast ids but cant add timer.

This is what i did:

request:

Code:
[host]:[port]/jsonrpc?request={"jsonrpc": "2.0", "method": "Player.GetActivePlayers", "id": 20 }

answer:

Code:
{"id":20,"jsonrpc":"2.0","result":[{"playerid":1,"type":"video"}]}

ok we got player id and type -> match to type "video" and us playerid for the next request:

Code:
[host]:[port]/jsonrpc?request={"jsonrpc": "2.0", "method": "Player.GetItem", "params": {"playerid" : 1,"properties":["title", "album", "artist", "season", "episode", "showtitle", "tvshowid", "description"]}, "id": 21 }

answer:

Code:
{"id":21,"jsonrpc":"2.0","result":{"item":{"id":21,"label":"ORF eins HD","title":"IBU Biathlon WM 2017 Hochfilzen: 15km Massenstart Herren","type":"channel"}}}

match the type to channel and id is the channel id for the next request:

Code:
[host]:[port]/jsonrpc?request={"jsonrpc":"2.0","method":"PVR.GetBroadcasts","params":{"channelid":21,"limits":{"end":3,"start":0}},"id":22}

we now got the broadcasts ids:

Code:
{"id":22,"jsonrpc":"2.0","result":{"broadcasts":[{"broadcastid":176977534,"label":"IBU Biathlon WM 2017 Hochfilzen: 4x7,5km Herren Staffel"},{"broadcastid":176977535,"label":"IBU Biathlon WM 2017 Hochfilzen: 4x7,5km Herren Staffel"},{"broadcastid":176977536,"label":"New Girl"}],"limits":{"end":3,"start":0,"total":615}}}

First question, why there are returend three? which one is the current running?
Now ill want to add a timer with the first id:

Code:
    [host]:[port]/jsonrpc?request={"jsonrpc":"2.0","method":"PVR.AddTimer","params":{"broadcastid":176977534},"id":23}

But sadly answer is:

Code:
{"error":{"code":-32100,"message":"Failed to execute method."},"id":23,"jsonrpc":"2.0"}

In the kodi log there is the following entry, regardless of which broadcast id ill throw at it:
Code:
15:01:05.844 T:8388   ERROR: PVR::CPVRTimerInfoTag::CreateFromEpg - end time is in the past

Any hints what i am doing wrong?

PS: using Kodi v17 final

pOpY
(This post was last modified: 2017-02-19 16:04 by popy.)
find quote
popy Offline
Senior Member
Posts: 216
Joined: Nov 2008
Reputation: 1
Post: #7
ok got it Angel
It much easier with the "PVR.Record" method.

pOpY
find quote