mirror of
https://github.com/fHDHR/fHDHR_NextPVR.git
synced 2025-12-06 16:16:58 -05:00
Add EPG debug
This commit is contained in:
parent
104806cd90
commit
dbce0b6745
@ -14,7 +14,7 @@ class fHDHR_Device():
|
||||
|
||||
self.epg = epg.EPG(settings, self.channels)
|
||||
|
||||
self.tuners = Tuners(settings)
|
||||
self.tuners = Tuners(settings, self.epg)
|
||||
|
||||
self.watch = WatchStream(settings, self.channels, self.tuners)
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import os
|
||||
import json
|
||||
import time
|
||||
import datetime
|
||||
from collections import OrderedDict
|
||||
from multiprocessing import Process
|
||||
|
||||
@ -31,6 +32,19 @@ class EPG():
|
||||
self.epgscan = Process(target=self.epgServerProcess)
|
||||
self.epgscan.start()
|
||||
|
||||
def whats_on_now(self, channel):
|
||||
epgdict = self.get_epg()
|
||||
listings = epgdict[channel]["listing"]
|
||||
for listing in listings:
|
||||
nowtime = datetime.datetime.utcnow()
|
||||
start_time = datetime.datetime.strptime(listing["time_start"], '%Y%m%d%H%M%S +0000')
|
||||
end_time = datetime.datetime.strptime(listing["time_end"], '%Y%m%d%H%M%S +0000')
|
||||
if start_time <= nowtime <= end_time:
|
||||
epgitem = epgdict[channel].copy()
|
||||
epgitem["listing"] = [listing]
|
||||
return epgitem
|
||||
return None
|
||||
|
||||
def get_epg(self):
|
||||
epgdict = None
|
||||
if os.path.isfile(self.epg_cache_file):
|
||||
|
||||
@ -6,8 +6,9 @@ from fHDHR.tools import humanized_time
|
||||
|
||||
|
||||
class Tuner():
|
||||
def __init__(self, inum):
|
||||
def __init__(self, inum, epg):
|
||||
self.number = inum
|
||||
self.epg = epg
|
||||
self.tuner_lock = threading.Lock()
|
||||
self.set_off_status()
|
||||
|
||||
@ -37,6 +38,7 @@ class Tuner():
|
||||
humanized_time(
|
||||
int((datetime.datetime.utcnow() - current_status["time_start"]).total_seconds())))
|
||||
current_status["time_start"] = str(current_status["time_start"])
|
||||
current_status["epg"] = self.epg.whats_on_now(current_status["accessed"].split("v")[-1])
|
||||
return current_status
|
||||
|
||||
def set_off_status(self):
|
||||
@ -45,12 +47,13 @@ class Tuner():
|
||||
|
||||
class Tuners():
|
||||
|
||||
def __init__(self, settings):
|
||||
def __init__(self, settings, epg):
|
||||
self.config = settings
|
||||
self.epg = epg
|
||||
self.max_tuners = int(self.config.dict["fhdhr"]["tuner_count"])
|
||||
|
||||
for i in range(1, self.max_tuners + 1):
|
||||
exec("%s = %s" % ("self.tuner_" + str(i), "Tuner(i)"))
|
||||
exec("%s = %s" % ("self.tuner_" + str(i), "Tuner(i, epg)"))
|
||||
|
||||
def tuner_grab(self, stream_args, tunernum=None):
|
||||
tunerselected = None
|
||||
|
||||
Loading…
Reference in New Issue
Block a user