test
This commit is contained in:
parent
18d5c120e4
commit
aa3ced07d1
@ -59,26 +59,32 @@ class OriginEPG():
|
|||||||
elif c["origin_id"] in ["snick-est", "snick-pst"]:
|
elif c["origin_id"] in ["snick-est", "snick-pst"]:
|
||||||
schedule_name = "Snickelodeon"
|
schedule_name = "Snickelodeon"
|
||||||
schedulename_quote = urllib.parse.quote("%s EST" % schedule_name)
|
schedulename_quote = urllib.parse.quote("%s EST" % schedule_name)
|
||||||
|
epgguide = []
|
||||||
for datestring in datestrings:
|
for datestring in datestrings:
|
||||||
schedule_url = ("%s?scheduleName=%s"
|
schedule_url = ("%s?scheduleName=%s"
|
||||||
"&dateString=%s"
|
"&dateString=%s"
|
||||||
"&count=150" %
|
"&count=150" %
|
||||||
(self.media_url, schedulename_quote, datestring))
|
(self.media_url, schedulename_quote, datestring))
|
||||||
epgguide = self.get_cached(epgname, todaydate, schedule_url)
|
epgguide.extend(self.get_cached(epgname, todaydate, schedule_url))
|
||||||
|
|
||||||
progindex = 0
|
progindex = 0
|
||||||
for program_dict in epgguide:
|
for program_dict in epgguide:
|
||||||
|
|
||||||
epgguide[progindex + 1]
|
try:
|
||||||
|
nextprog_dict = epgguide[progindex + 1]
|
||||||
|
except IndexError:
|
||||||
|
nextprog_dict = None
|
||||||
|
if nextprog_dict:
|
||||||
|
|
||||||
|
timedict = self.get_prog_timedict(program_dict["startDate"], nextprog_dict["startDate"])
|
||||||
|
|
||||||
"""
|
|
||||||
clean_prog_dict = {
|
clean_prog_dict = {
|
||||||
"time_start": timestamp['time_start'],
|
"time_start": timedict['time_start'],
|
||||||
"time_end": timestamp['time_end'],
|
"time_end": timedict['time_end'],
|
||||||
"duration_minutes": 60,
|
"duration_minutes": timedict["duration"],
|
||||||
"thumbnail": ("/api/images?method=generate&type=content&message=%s" % (str(c["origin_id"]) + "_" + str(timestamp['time_start']).split(" ")[0])),
|
"thumbnail": program_dict["info"]["image"],
|
||||||
"title": "Unavailable",
|
"title": program_dict["info"]["fullname"],
|
||||||
"sub-title": "Unavailable",
|
"sub-title": program_dict["name"],
|
||||||
"description": "Unavailable",
|
"description": "Unavailable",
|
||||||
"rating": "N/A",
|
"rating": "N/A",
|
||||||
"episodetitle": None,
|
"episodetitle": None,
|
||||||
@ -87,10 +93,10 @@ class OriginEPG():
|
|||||||
"seasonnumber": None,
|
"seasonnumber": None,
|
||||||
"episodenumber": None,
|
"episodenumber": None,
|
||||||
"isnew": False,
|
"isnew": False,
|
||||||
"id": str(c["origin_id"]) + "_" + str(timestamp['time_start']).split(" ")[0],
|
"id": str(c["origin_id"]) + "_" + str(timedict['time_start']).split(" ")[0],
|
||||||
}
|
}
|
||||||
programguide[str(c["number"])]["listing"].append(clean_prog_dict)
|
programguide[str(c["number"])]["listing"].append(clean_prog_dict)
|
||||||
"""
|
|
||||||
progindex += 1
|
progindex += 1
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@ -118,6 +124,23 @@ class OriginEPG():
|
|||||||
|
|
||||||
return programguide
|
return programguide
|
||||||
|
|
||||||
|
def xmltimestamp_toonami(self, inputtime):
|
||||||
|
xmltime = inputtime.replace('Z', '+00:00')
|
||||||
|
xmltime = datetime.datetime.fromisoformat(xmltime)
|
||||||
|
xmltime = xmltime.strftime('%Y%m%d%H%M%S %z')
|
||||||
|
return xmltime
|
||||||
|
|
||||||
|
def get_prog_timedict(self, starttime, endtime):
|
||||||
|
"2020-12-05T00:01:00.098Z"
|
||||||
|
"2020-11-22T00:00:00.000Z"
|
||||||
|
print(self.xmltimestamp_toonami(starttime))
|
||||||
|
timedict = {
|
||||||
|
"time_start": None,
|
||||||
|
"time_end": None,
|
||||||
|
"duration": None
|
||||||
|
}
|
||||||
|
return timedict
|
||||||
|
|
||||||
def get_cached(self, jsonid, cache_key, url):
|
def get_cached(self, jsonid, cache_key, url):
|
||||||
cacheitem = self.fhdhr.db.get_cacheitem_value(jsonid + "_" + str(cache_key), "offline_cache", "origin")
|
cacheitem = self.fhdhr.db.get_cacheitem_value(jsonid + "_" + str(cache_key), "offline_cache", "origin")
|
||||||
if cacheitem:
|
if cacheitem:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user