I am using since a while X-streamity and modified thing to be more to my liking and extend the capabilities of it.
Thanks to Kiddac for creating X-streamity and it very structured to finding stuff is not that difficult.
My latest modification is able to keep watching live while having started a instant recording of same live channel. Even if you have chosen for .m3u8 instead of .ts as output extension. What it does, when a instant recording is started while you watch the same channel, the current stream is terminated on start of the recording and new stream is started matching the way a recording is made.
This way you keep watching live while the recording is made in background. You can change/stop the recording through the menu button and go to timers.
Also what is added is the actual end time of the transmission so the recording will stop when the transmission is over. If no end time is found the the default recording duration will be one hour.
def IPTVstartInstantRecording(self, limitEvent=True):
from . import record
begin = int(time.time())
end = begin + 3600
# if now-next is available, take the starttime of next as endtime for current
if (glob.currentepglist[glob.currentchannellistindex][5]): ####
endstring = (glob.currentepglist[glob.currentchannellistindex][5])
shortend_dt = datetime.strptime(endstring, "%H:%M")
end = int(time.mktime(shortend_dt.timetuple())) ####
#self.session.open(MessageBox, _("Switched live view, to streaming type 1 to match the recording being made!"), MessageBox.TYPE_INFO, timeout=5)
if glob.currentepglist[glob.currentchannellistindex][3]:
name = glob.currentepglist[glob.currentchannellistindex][3]
else:
name = glob.currentchannellist[glob.currentchannellistindex][0]
self.name = NoSave(ConfigText(default=name, fixed_size=False))
self.date = time.time()
self.starttime = NoSave(ConfigClock(default=begin))
self.endtime = NoSave(ConfigClock(default=end))
self.session.openWithCallback(self.RecordDateInputClosed, record.RecordDateInput, self.name, self.date, self.starttime, self.endtime, True)
def RecordDateInputClosed(self, ret=None):
if ret:
begin = ret[1]
end = ret[2]
name = ret[3]
#### for instant recording .m3u8 extension should to be .ts
streamurl = self.streamurl.replace(".m3u8", ".ts") #### create a local non class variable
description = glob.currentepglist[glob.currentchannellistindex][4]
eventid = int(self.streamurl.rpartition("/")[-1].partition(".")[0])
#serviceref = eServiceReference(1, 0, self.streamurl)
serviceref = eServiceReference(1, 0, streamurl)
#### keep playing live when the livestream is not streamtype 1
if self.servicetype != "1":
self.session.nav.stopService()
self.playStream("1", streamurl, self.direct_source)
self.session.open(MessageBox, _("Live view is probably stopped, allowing it to be recorded. \r\n Please do not change channel or use reconnect! \r\n Pressing menu allows to change or stop the started recording."), MessageBox.TYPE_INFO, timeout=9)
if isinstance(serviceref, eServiceReference):
serviceref = ServiceReference(serviceref)
recording = RecordTimerEntry(serviceref, begin, end, name, description, eventid, dirname=str(cfg.downloadlocation.getValue()))
recording.dontSave = True
instantRecordActive = True #### allows to instant record without interupption
simulTimerList = self.session.nav.RecordTimer.record(recording)
if simulTimerList is None: # no conflict
recording.autoincrease = False
self.session.open(MessageBox, _("Recording Timer Set."), MessageBox.TYPE_INFO, timeout=5)
else:
self.session.open(MessageBox, _("Recording Failed."), MessageBox.TYPE_WARNING)
return
else:
return
Display More
The toggle and I shorted it now so that it won't change the servicetype
def streamTypeFailed(self, data=None):
if instantRecordActive == False: #### allow instant recording run uninterupted
if str(self.servicetype) == "1":
self.servicetype = "4097"
elif str(self.servicetype) == "4097":
self.servicetype = "1"
self.streamcheck = 2
self.playStream(self.servicetype, self.streamurl, self.direct_source)
instantRecordActive = False