Skip to content

Commit

Permalink
Make start/end time more accurate and break recordings class our from…
Browse files Browse the repository at this point in the history
… programmes

#11
  • Loading branch information
RogerSelwyn committed Nov 9, 2022
1 parent 527eb81 commit 3994991
Show file tree
Hide file tree
Showing 6 changed files with 202 additions and 42 deletions.
60 changes: 48 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ Will return an object with an array of events including the specified number of
'image_url':'https://images.metadata.sky.com/pd-image/57a11caf-1ebd-4c01-a40b-7fdfe5c5fad0/16-9',
'channelname':'BBC One South',
'status':'LIVE',
'pvrid':'n/a',
'eid':'E4b8-19b'
},
{
Expand All @@ -308,7 +307,6 @@ Will return an object with an array of events including the specified number of
'image_url':'https://images.metadata.sky.com/pd-image/d2d67048-673a-4ea8-8a32-3ad386e306d2/16-9',
'channelname':'BBC One South',
'status':'LIVE',
'pvrid':'n/a',
'eid':'E4b8-19b'
},
{...}
Expand Down Expand Up @@ -345,7 +343,6 @@ Will return a JSON structure with an array of events including the specified num
"image_url":"https://images.metadata.sky.com/pd-image/62ad0457-1a6a-4b45-9ef7-6e144639d734/16-9",
"channelname":"BBC One South",
"status":"LIVE",
"pvrid":"n/a",
"eid":"E4b8-19b"
}
},
Expand All @@ -361,7 +358,6 @@ Will return a JSON structure with an array of events including the specified num
"image_url":"https://images.metadata.sky.com/pd-image/a975bdeb-c19b-4de2-9557-c6d2757bdae7/16-9",
"channelname":"BBC One South"
"status":"LIVE",
"pvrid":"n/a",
"eid":"E4b8-19b"
}
},
Expand Down Expand Up @@ -400,7 +396,6 @@ Will return an object such as below:
'image_url':'https://images.metadata.sky.com/pd-image/9fbdcefe-312c-4681-b996-00637e85313a/16-9',
'channelname':'Channel 5 HD',
'status':'LIVE',
'pvrid':'n/a',
'eid':'E4b8-19b'
}
```
Expand All @@ -427,7 +422,6 @@ Will return a JSON structure such as below:
"image_url":"https://images.metadata.sky.com/pd-image/e11d9e93-0eec-4855-88f5-6ade9946d5dd/16-9",
"channelname":"BBC ONE HD",
"status":"LIVE",
"pvrid":"n/a",
"eid':"E4b8-19b"
}
}
Expand Down Expand Up @@ -458,7 +452,6 @@ Will return an object such as below:
'image_url':'https://images.metadata.sky.com/pd-image/9fbdcefe-312c-4681-b996-00637e85313a/16-9',
'channelname':'Channel 5 HD',
'status':'LIVE',
'pvrid':'n/a',
'eid':'E4b8-19b'
}
```
Expand All @@ -483,7 +476,6 @@ Will return a JSON structure such as below:
"image_url":"https://images.metadata.sky.com/pd-image/e11d9e93-0eec-4855-88f5-6ade9946d5dd/16-9",
"channelname":"BBC ONE HD",
"status":"LIVE",
"pvrid":"n/a",
"eid":"E4b8-19b"
}
}
Expand All @@ -510,8 +502,10 @@ Will return an object such as below for the number of recordings specified by li
'image_url':'https://images.metadata.sky.com/pd-image/54bfc205-c56e-4583-b03f-59c31f97f8c7/16-9',
'channelname':'E4 HD',
'status':'RECORDED',
'deletetime': '2020-09-02T20:00:59Z',
'failurereason': None,
'pvrid':'P29014192',
'eid':'E869-67b1'
'eid':'E869-67b1',
},
{
'programmeuuid':'af9ecd2c-5026-4050-9c15-37598fe26713',
Expand All @@ -523,6 +517,23 @@ Will return an object such as below for the number of recordings specified by li
'image_url':'https://images.metadata.sky.com/pd-image/af9ecd2c-5026-4050-9c15-37598fe26713/16-9',
'channelname':'Channel 5 HD',
'status':'SCHEDULED',
'deletetime': None,
'failurereason': None,
'pvrid':'P29014192',
'eid':'E869-67b1'
},
{
'programmeuuid':'575736fd-0719-4249-88cc-babd6e232bfa',
'starttime':'2020-08-02T19:58:00Z',
'endtime':'2020-08-02T21:01:59Z',
'title':'Lorraine',
'season':35,
'episode':4,
'image_url':'https://images.metadata.sky.com/pd-image/575736fd-0719-4249-88cc-babd6e232bfa/16-9',
'channelname':'ITV HD',
'status':'PART REC',
'deletetime': None,
'failurereason': 'Start Missed',
'pvrid':'P29014192',
'eid':'E869-67b1'
},
Expand All @@ -546,9 +557,9 @@ Will return an object such as below for the number of recordings specified by li
"attributes":{
},
"programmes":[
"recordings":[
{
"__type__":"__programme__",
"__type__":"__recording__",
"attributes":{
"programmeuuid":"54bfc205-c56e-4583-b03f-59c31f97f8c7",
"starttime":"2020-08-02T19:58:00Z",
Expand All @@ -559,12 +570,14 @@ Will return an object such as below for the number of recordings specified by li
"image_url":"https://images.metadata.sky.com/pd-image/54bfc205-c56e-4583-b03f-59c31f97f8c7/16-9",
"channelname":"E4 HD",
"status":"RECORDED",
"deletetime": "2020-09-02T20:00:59Z",
"failurereason": null,
"pvrid":"P29014192",
"eid":"E869-67b1"
}
},
{
"__type__":"__programme__",
"__type__":"__recording__",
"attributes":{
"programmeuuid":"af9ecd2c-5026-4050-9c15-37598fe26713",
"starttime":"null",
Expand All @@ -575,9 +588,28 @@ Will return an object such as below for the number of recordings specified by li
"image_url":"https://images.metadata.sky.com/pd-image/af9ecd2c-5026-4050-9c15-37598fe26713/16-9",
"channelname":"Channel 5 HD",
"status":"SCHEDULED",
"deletetime": null,
"failurereason": null,
"pvrid":"P29014192",
"eid":"E869-67b1"
},
{
"__type__":"__recording__",
"attributes":{
"programmeuuid":"af9ecd2c-5026-4050-9c15-37598fe26713",
"starttime":"2020-08-02T19:58:00Z",
"endtime":"2020-08-02T21:01:59Z",
"title":"Home and Away",
"season":35,
"episode":4,
"image_url":"https://images.metadata.sky.com/pd-image/af9ecd2c-5026-4050-9c15-37598fe26713/16-9",
"channelname":"Channel 5 HD",
"status":"PART REC",
"deletetime": null,
"failurereason": "Start Missed",
"pvrid":"P29014192",
"eid":"E869-67b1"
},
{...}
}
]
Expand All @@ -603,6 +635,8 @@ Will return an object such as below:
'episode':5,
'image_url':'https://images.metadata.sky.com/pd-image/ddcd727f-487f-4558-8365-7bed4fe41c87/16-9',
'status':'RECORDED',
'deletetime': None,
'failurereason': None,
'pvrid':'P29014192',
'eid':'E869-67b1'
}
Expand All @@ -628,6 +662,8 @@ Will return an object such as below:
"episode":null,
"image_url":"https://images.metadata.sky.com/pd-image/e11d9e93-0eec-4855-88f5-6ade9946d5dd/16-9",
"status":"RECORDED",
"deletetime": null,
"failurereason": null,
"pvrid":"P29014192",
"eid":"E869-67b1"
}
Expand Down
11 changes: 8 additions & 3 deletions pyskyqremote/classes/channelepg.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@

import requests

from ..const import LIVE_IMAGE_URL, RESPONSE_OK, SCHEDULE_URL, SKY_STATUS_LIVE
from ..const import (
EPG_TIMEOUT,
LIVE_IMAGE_URL,
RESPONSE_OK,
SCHEDULE_URL,
SKY_STATUS_LIVE,
)
from .channel import ChannelInformation, build_channel_image_url
from .programme import Programme

Expand Down Expand Up @@ -118,7 +124,6 @@ def _get_data(self, sid, channel_name, epg_date):
image_url,
channel_name,
SKY_STATUS_LIVE,
"n/a",
eid,
)
programmes.add(programme)
Expand All @@ -135,7 +140,7 @@ def _get_day_epg_data(self, sid, epg_date):
"x-skyott-proposition": "SKYQ",
}
_LOGGER.debug("Channel Call - %s - %s", self._remote_config.host, epg_url)
resp = requests.get(epg_url, headers=headers)
resp = requests.get(epg_url, headers=headers, timeout=EPG_TIMEOUT)
return resp.json()["schedule"] if resp.status_code == RESPONSE_OK else None

def _get_channel_node(self, sid):
Expand Down
1 change: 0 additions & 1 deletion pyskyqremote/classes/programme.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class Programme:
repr=True,
compare=False,
)
pvrid: str = "n/a"
eid: str = "n/a"

def __hash__(self):
Expand Down
Loading

0 comments on commit 3994991

Please sign in to comment.