def log(self, s): if self.FDlog != None: self.FDlog.write("%s %s\n" % (time.strftime("%d/%m/%Y %H:%M:%S"), s)) else: crossepg.log_add(str(s))
def main(): # log_add() print to stdout a text message crossepg.log_add("---- START EXAMPLE TEST SCRIPT ----") # get installation dir instdir = crossepg.epgdb_get_installroot() if instdir == False: crossepg.log_add("ERROR: cannot find CrossEPG installation directory") sys.exit(1) crossepg.log_add("Installation dir : %s" % instdir) # get dbroot path dbroot = crossepg.epgdb_get_dbroot() if dbroot == False: crossepg.log_add("ERROR: cannot find CrossEPG database directory") sys.exit(1) crossepg.log_add("Database dir : %s" % dbroot) # open CrossEPG internal database if crossepg.epgdb_open(dbroot): crossepg.log_add("EPGDB opened successfully (root = %s)" % dbroot) else: crossepg.log_add("Error opening EPGDB") crossepg.epgdb_close() sys.exit(1) crossepg.log_add("Closing EPGDB") crossepg.epgdb_close() delta_timezone = scriptlib.delta_utc() crossepg.log_add("GMT vs. LocalTime difference (in seconds): %d" % delta_timezone) delta_daylight = scriptlib.delta_dst() crossepg.log_add("DayLight Saving (DST) difference now: %d" % delta_daylight) crossepg.log_add("---- END EXAMPLE TEST SCRIPT ----")
def log(self, s): crossepg.log_add(str(s))
def log(self,s): crossepg.log_add(str(s))
def log(self,s): if self.FDlog != None : self.FDlog.write("%s %s\n" % (time.strftime("%d/%m/%Y %H:%M:%S"), s) ) else: crossepg.log_add(str(s))
def main(): # log_add() print to stdout a text message crossepg.log_add("---- START EXAMPLE TEST SCRIPT ----") # get installation dir instdir = crossepg.epgdb_get_installroot() if instdir == False: crossepg.log_add("ERROR: cannot find CrossEPG installation directory") sys.exit(1) crossepg.log_add("Installation dir : %s" % instdir) # get dbroot path dbroot = crossepg.epgdb_get_dbroot() if dbroot == False: crossepg.log_add("ERROR: cannot find CrossEPG database directory") sys.exit(1) crossepg.log_add("Database dir : %s" % dbroot) # open CrossEPG internal database if crossepg.epgdb_open(dbroot): crossepg.log_add("EPGDB opened successfully (root = %s)" % dbroot); else: crossepg.log_add("Error opening EPGDB"); crossepg.epgdb_close(); sys.exit(1) crossepg.log_add("Closing EPGDB"); crossepg.epgdb_close(); delta_timezone = scriptlib.delta_utc() crossepg.log_add("GMT vs. LocalTime difference (in seconds): %d" % delta_timezone) delta_daylight = scriptlib.delta_dst() crossepg.log_add("DayLight Saving (DST) difference now: %d" % delta_daylight) crossepg.log_add("---- END EXAMPLE TEST SCRIPT ----")