Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerSelwyn committed Apr 22, 2020
2 parents 3a638dd + 2a3c2b8 commit 5ee91a9
Show file tree
Hide file tree
Showing 7 changed files with 114 additions and 37 deletions.
1 change: 1 addition & 0 deletions pyskyqremote/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Initialise."""
5 changes: 5 additions & 0 deletions pyskyqremote/channel.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
"""Structure of a standard EPG prorgramme."""


class Programme:
"""SkyQ Programme Class."""

def __init__(
self, programmeuuid, starttime, endtime, title, season, episode, imageUrl
):
"""Programme structure for SkyQ."""
self.progammeuuid = programmeuuid
self.starttime = starttime
self.endtime = endtime
Expand Down
1 change: 1 addition & 0 deletions pyskyqremote/country/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Initialise."""
14 changes: 12 additions & 2 deletions pyskyqremote/country/remote_it.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Italy specific code."""
from datetime import datetime
import logging
import requests
Expand All @@ -18,7 +19,10 @@


class SkyQCountry:
"""Italy specific SkyQ."""

def __init__(self, host):
"""Initialise Italy remote."""
self.channel_image_url = CHANNEL_IMAGE_URL
self.pvr_image_url = PVR_IMAGE_URL
self.epgData = None
Expand All @@ -30,6 +34,7 @@ def __init__(self, host):
self._getChannels()

def getEpgData(self, sid, channelno, epgDate):
"""Get EPG data for Italy."""
queryDateFrom = epgDate.strftime("%Y-%m-%dT00:00:00Z")
queryDateTo = epgDate.strftime("%Y-%m-%dT23:59:59Z")

Expand Down Expand Up @@ -57,9 +62,14 @@ def getEpgData(self, sid, channelno, epgDate):
return None

self.epgData = []
for p in epgData:
epgDataLen = len(epgData) - 1
for index, p in enumerate(epgData):
starttime = datetime.strptime(p["starttime"], "%Y-%m-%dT%H:%M:%SZ")
endtime = datetime.strptime(p["endtime"], "%Y-%m-%dT%H:%M:%SZ")
if index < epgDataLen:
endtimeStr = epgData[index + 1]["starttime"]
else:
endtimeStr = p["endtime"]
endtime = datetime.strptime(endtimeStr, "%Y-%m-%dT%H:%M:%SZ")
title = p["eventTitle"]
season = None
if "seasonNumber" in p["content"]:
Expand Down
5 changes: 5 additions & 0 deletions pyskyqremote/country/remote_uk.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""UK specific code."""
from datetime import datetime
import logging
import requests
Expand All @@ -15,7 +16,10 @@


class SkyQCountry:
"""UK specific SkyQ."""

def __init__(self, host):
"""Initialise UK remote."""
self.channel_image_url = CHANNEL_IMAGE_URL
self.pvr_image_url = PVR_IMAGE_URL
self.epgData = None
Expand All @@ -24,6 +28,7 @@ def __init__(self, host):
self._host = host

def getEpgData(self, sid, channelno, epgDate):
"""Get EPG data for UK."""
epgDateStr = epgDate.strftime("%Y%m%d")
epgUrl = SCHEDULE_URL.format(sid, epgDateStr)
epgData = None
Expand Down
Loading

0 comments on commit 5ee91a9

Please sign in to comment.