def open_db(self): # get where CrossEPG save data (dbroot) dbroot = crossepg.epgdb_get_dbroot() # open CrossEPG database if not crossepg.epgdb_open(dbroot): print("ERROR opening CrossEPG database") sys.exit(1) # load database structures (index, ....) crossepg.epgdb_load()
def __init__(self, fname=''): # get where CrossEPG save data (dbroot) and use it for opening crossepg.log dbroot = crossepg.epgdb_get_dbroot() if dbroot != False: if fname != '': self.FDlog = open(dbroot + '/' + fname, 'w') else: crossepg.log_open(dbroot) else: print "[scriptlib] WARNING: cannot open crossepg dbroot. Log not initialized !!"
def __init__(self, fname=''): # get where CrossEPG save data (dbroot) and use it for opening crossepg.log dbroot = crossepg.epgdb_get_dbroot() if dbroot != False: if fname != '' : self.FDlog = open(dbroot+'/'+fname,'w') else : crossepg.log_open(dbroot) else: print "[scriptlib] WARNING: cannot open crossepg dbroot. Log not initialized !!"
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 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 ----")
time.sleep(3) # **************************************************************************************************************************** # MAIN CODE: SCRIPT START HERE SCRIPT_DIR = 'scripts/rai/' # get CrossEPG installation dir. crossepg_instroot = crossepg.epgdb_get_installroot() if crossepg_instroot == False: sys.exit(1) scriptlocation = os.path.join(crossepg_instroot , SCRIPT_DIR) # get where CrossEPG save data (dbroot) and use it as script cache repository crossepg_dbroot = crossepg.epgdb_get_dbroot() if crossepg_dbroot == False: sys.exit(1) # initialize script class script_class = main(scriptlocation , crossepg_dbroot) # download data and cache them script_class.download_and_cache() # read cached data and inject into CrossEPG database script_class.process_cache()
crossdb.close_db() self.log("Copied %d events" % total_events) self.log("--- END ---") # **************************************************************************************************************************** # MAIN CODE: SCRIPT START HERE SCRIPT_DIR = 'scripts/alias/' # get CrossEPG installation dir. crossepg_instroot = crossepg.epgdb_get_installroot() if crossepg_instroot == False: sys.exit(1) scriptlocation = os.path.join(crossepg_instroot , SCRIPT_DIR) # get where CrossEPG save data (dbroot) and use it as script cache repository crossepg_dbroot = crossepg.epgdb_get_dbroot() if crossepg_dbroot == False: sys.exit(1) # initialize script class script_class = main(scriptlocation , crossepg_dbroot) # copy epg script_class.do_epg_alias()
def __init__(self): # get where CrossEPG save data (dbroot) and use it for opening crossepg.log dbroot = crossepg.epgdb_get_dbroot() if dbroot == True: crossepg.log_open(dbroot)