-import time
-#from time import datetime
-from Tools import Directories, Notifications, ASCIItranslit
-
-from Components.config import config
-import timer
-import xml.etree.cElementTree
-
from enigma import eEPGCache, getBestPlayableServiceReference, \
eServiceReference, iRecordableService, quitMainloop
-from Screens.MessageBox import MessageBox
+from Components.config import config
+from Components.UsageConfig import defaultMoviePath
from Components.TimerSanityCheck import TimerSanityCheck
-import NavigationInstance
+from Screens.MessageBox import MessageBox
import Screens.Standby
-
-from time import localtime
-
+from Tools import Directories, Notifications, ASCIItranslit
from Tools.XMLTools import stringToXML
+
+import timer
+import xml.etree.cElementTree
+import NavigationInstance
from ServiceReference import ServiceReference
+from time import localtime, strftime, ctime, time
from bisect import insort
# ok, for descriptions etc we have:
recordings = NavigationInstance.instance.getRecordings()
if not recordings: # no more recordings exist
rec_time = NavigationInstance.instance.RecordTimer.getNextRecordingTime()
- if rec_time > 0 and (rec_time - time.time()) < 360:
- print "another recording starts in", rec_time - time.time(), "seconds... do not shutdown yet"
+ if rec_time > 0 and (rec_time - time()) < 360:
+ print "another recording starts in", rec_time - time(), "seconds... do not shutdown yet"
else:
print "no starting records in the next 360 seconds... immediate shutdown"
RecordTimerEntry.shutdown() # immediate shutdown
timer.TimerEntry.__init__(self, int(begin), int(end))
if checkOldTimers == True:
- if self.begin < time.time() - 1209600:
- self.begin = int(time.time())
+ if self.begin < time() - 1209600:
+ self.begin = int(time())
if self.end < self.begin:
self.end = self.begin
self.resetState()
def log(self, code, msg):
- self.log_entries.append((int(time.time()), code, msg))
+ self.log_entries.append((int(time()), code, msg))
print "[TIMER]", msg
def calculateFilename(self):
service_name = self.service_ref.getServiceName()
- begin_date = time.strftime("%Y%m%d %H%M", time.localtime(self.begin))
+ begin_date = strftime("%Y%m%d %H%M", localtime(self.begin))
print "begin_date: ", begin_date
print "service_name: ", service_name
if config.recording.ascii_filenames.value:
filename = ASCIItranslit.legacyEncode(filename)
- if self.dirname and not Directories.fileExists(self.dirname, 'w'):
- self.dirnameHadToFallback = True
- self.Filename = Directories.getRecordingFilename(filename, None)
+ if not self.dirname or not Directories.fileExists(self.dirname, 'w'):
+ if self.dirname:
+ self.dirnameHadToFallback = True
+ dirname = defaultMoviePath()
else:
- self.Filename = Directories.getRecordingFilename(filename, self.dirname)
+ dirname = self.dirname
+ self.Filename = Directories.getRecordingFilename(filename, dirname)
self.log(0, "Filename calculated as: '%s'" % self.Filename)
#begin_date + " - " + service_name + description)
# we must calc nur start time before stopRecordService call because in Screens/Standby.py TryQuitMainloop tries to get
# the next start time in evEnd event handler...
self.do_backoff()
- self.start_prepare = time.time() + self.backoff
+ self.start_prepare = time() + self.backoff
NavigationInstance.instance.stopRecordService(self.record_service)
self.record_service = None
# because another recording at the same time on another service can try to record the same event
# i.e. cable / sat.. then the second recording needs an own extension... when we create the file
# here than calculateFilename is happy
- open(self.Filename + ".ts", "w").close()
+ if not self.justplay:
+ open(self.Filename + ".ts", "w").close()
# fine. it worked, resources are allocated.
self.next_activation = self.begin
self.backoff = 0
self.log(13, "start record returned %d" % record_res)
self.do_backoff()
# retry
- self.begin = time.time() + self.backoff
+ self.begin = time() + self.backoff
return False
return True
if not self.autoincrease:
return False
if entry is None:
- new_end = int(time.time()) + self.autoincreasetime
+ new_end = int(time()) + self.autoincreasetime
else:
new_end = entry.begin -30
del simulTimerList
new_end -= 30 # 30 Sekunden Prepare-Zeit lassen
del dummyentry
- if new_end <= time.time():
+ if new_end <= time():
return False
self.end = new_end
return True
self.backoff = 0
if int(old_prepare) != int(self.start_prepare):
- self.log(15, "record time changed, start prepare is now: %s" % time.ctime(self.start_prepare))
+ self.log(15, "record time changed, start prepare is now: %s" % ctime(self.start_prepare))
def gotRecordEvent(self, record, event):
# TODO: this is not working (never true), please fix. (comparing two swig wrapped ePtrs)
file.close()
def getNextZapTime(self):
- now = time.time()
+ now = time()
for timer in self.timer_list:
if not timer.justplay or timer.begin < now:
continue
return -1
def getNextRecordingTime(self):
- now = time.time()
+ now = time()
for timer in self.timer_list:
next_act = timer.getNextActivation()
if timer.justplay or next_act < now:
return -1
def isNextRecordAfterEventActionAuto(self):
- now = time.time()
+ now = time()
t = None
for timer in self.timer_list:
if timer.justplay or timer.begin < now:
chktimecmp_end = chktimecmp + (duration / 60)
time = localtime(x.begin)
for y in (0, 1, 2, 3, 4, 5, 6):
- if x.repeated & (2 ** y) and (x.begin <= begin or begin <= x.begin <= end):
+ if x.repeated & (1 << y) and (x.begin <= begin or begin <= x.begin <= end):
timecmp = y * 1440 + time.tm_hour * 60 + time.tm_min
if timecmp <= chktimecmp < (timecmp + ((x.end - x.begin) / 60)):
time_match = ((timecmp + ((x.end - x.begin) / 60)) - chktimecmp) * 60