This commit is contained in:
deathbybandaid 2020-12-06 09:25:14 -05:00
parent e2256ecd1b
commit 1bc5b65ca4
2 changed files with 16 additions and 3 deletions

View File

@ -65,6 +65,16 @@
"value": false,
"config_file": true,
"config_web": true
},
"geoID":{
"value": "none",
"config_file": true,
"config_web": false
},
"geoLST":{
"value": "none",
"config_file": true,
"config_web": false
}
}
}

View File

@ -28,17 +28,20 @@ class OriginService():
return True
def getID(self):
if self.fhdhr.config.dict["main"]["origin"]["geoID"] and self.fhdhr.config.dict["main"]["origin"]["geoLST"]:
geoID = self.fhdhr.config.dict["main"]["origin"]["geoID"]
geoLST = self.fhdhr.config.dict["main"]["origin"]["geoLST"]
return geoID, geoLST
try:
url_headers = {'User-Agent': 'Mozilla/5.0'}
pagereq = self.fhdhr.web.session.get(self.base_url, headers=url_headers).text
results = json.loads(re.findall('__JOBS_REHYDRATE_STATE__=(.+?);</script>', (pagereq), flags=re.DOTALL)[0])
geoID, geoLST = results["jobs"]["1"]["data"]["geoId"], results["jobs"]["1"]["data"]["channelListId"]
except Exception as e:
self.fhdhr.logger.warning("XUMO Setup Failed %s" % e)
self.fhdhr.logger.warning("XUMO Setup Failed: %s" % e)
return None, None
print(geoID + " " + geoLST)
return geoID, geoLST
def get_status_dict(self):