mirror of
https://github.com/fHDHR/fHDHR_NextPVR.git
synced 2025-12-06 08:56:57 -05:00
Update Zap2it
This commit is contained in:
parent
eb55403bee
commit
105e1a34a5
@ -12,19 +12,19 @@ class zap2itEPG():
|
|||||||
|
|
||||||
self.channels = channels
|
self.channels = channels
|
||||||
|
|
||||||
self.postalcode = self.fhdhr.config.dict["zap2it"]["postalcode"]
|
@property
|
||||||
|
def postalcode(self):
|
||||||
def get_location(self):
|
if self.fhdhr.config.dict["zap2it"]["postalcode"]:
|
||||||
self.fhdhr.logger.warning("Zap2it postalcode not set, attempting to retrieve.")
|
return self.fhdhr.config.dict["zap2it"]["postalcode"]
|
||||||
if not self.postalcode:
|
|
||||||
try:
|
try:
|
||||||
postalcode_url = 'http://ipinfo.io/json'
|
postalcode_url = 'http://ipinfo.io/json'
|
||||||
postalcode_req = self.fhdhr.web.session.get(postalcode_url)
|
postalcode_req = self.fhdhr.web.session.get(postalcode_url)
|
||||||
data = postalcode_req.json()
|
data = postalcode_req.json()
|
||||||
self.postalcode = data["postal"]
|
postalcode = data["postal"]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise EPGSetupError("Unable to automatically optain zap2it postalcode: " + str(e))
|
raise EPGSetupError("Unable to automatically optain postalcode: " + str(e))
|
||||||
return self.postalcode
|
postalcode = None
|
||||||
|
return postalcode
|
||||||
|
|
||||||
def update_epg(self):
|
def update_epg(self):
|
||||||
programguide = {}
|
programguide = {}
|
||||||
@ -119,7 +119,7 @@ class zap2itEPG():
|
|||||||
'timespan': self.fhdhr.config.dict["zap2it"]['timespan'],
|
'timespan': self.fhdhr.config.dict["zap2it"]['timespan'],
|
||||||
'timezone': self.fhdhr.config.dict["zap2it"]['timezone'],
|
'timezone': self.fhdhr.config.dict["zap2it"]['timezone'],
|
||||||
'userId': self.fhdhr.config.dict["zap2it"]['userid'],
|
'userId': self.fhdhr.config.dict["zap2it"]['userid'],
|
||||||
'postalCode': str(self.postalcode or self.get_location()),
|
'postalCode': str(self.postalcode),
|
||||||
'lineupId': '%s-%s-DEFAULT' % (self.fhdhr.config.dict["zap2it"]['country'], self.fhdhr.config.dict["zap2it"]['device']),
|
'lineupId': '%s-%s-DEFAULT' % (self.fhdhr.config.dict["zap2it"]['country'], self.fhdhr.config.dict["zap2it"]['device']),
|
||||||
'time': i_time,
|
'time': i_time,
|
||||||
'Activity_ID': 1,
|
'Activity_ID': 1,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user