OSDN Git Service

change function name.
[rec10/rec10-git.git] / rec10 / trunk / src / epgdb.py
index bc23f54..d42160a 100644 (file)
@@ -17,40 +17,35 @@ import xml2db_dom
 import configreader
 import recdblist
 path = str(os.path.dirname(os.path.abspath(__file__))) + "/"
-tmppath = configreader.getpath("tmp")+"/"
+tmppath = configreader.getPathSetting("tmp")+"/"
 if tmppath=="/":
     tmppath=path
 def update(chtxt):
     recdblist.printutf8(chtxt)
     tnow = datetime.datetime.now()
     try:
-        lastup = datetime.datetime.strptime(chdb.chtxtsearch(chtxt)[0]['update'], "%Y-%m-%d %H:%M:%S")
+        lastup = datetime.datetime.strptime(chdb.searchFromCHtxt(chtxt)[0]['update'], "%Y-%m-%d %H:%M:%S")
     except:
         lastup = datetime.datetime.strptime("2009-04-01 00:00:00", "%Y-%m-%d %H:%M:%S")
     dt = tnow-lastup
     dt = dt.days * 24 * 60 + dt.seconds
     if dt > 2 * 60 * 60:
-        ts2epg.write(os.path.join(tmppath, chtxt + "epgdata.xml"), chdb.chtxtsearch(chtxt)['ch'])
-        xml2db_dom.xml2db_dom(os.path.join(tmppath, chtxt + "epgdata.xml"), chdb.chtxtsearch(chtxt)['bctype'])
-def updatebc(bctype):
-    bctypel = chdb.bctypesearch(bctype)
+        ts2epg.write(os.path.join(tmppath, chtxt + "epgdata.xml"), chdb.getChCSchFromCHtxt(chtxt)['ch'])
+        xml2db_dom.xml2db_dom(os.path.join(tmppath, chtxt + "epgdata.xml"), chdb.searchFromCHtxt(chtxt)['bctype'])
+def updateForBctype(bctype):
+    bctypel = chdb.searchFromBctype(bctype)
     #print bctype
     try:
-        ts2epg.write(tmppath + bctype + "epgdata.xml", chdb.bctypesearch(bctype)['ch'])
+        ts2epg.write(tmppath + bctype + "epgdata.xml", chdb.searchFromBctype(bctype)['ch'])
         xml2db_dom.xml2db_dom(tmppath + bctype + "epgdata.xml", bctype)
         shutil.copyfile(tmppath + bctype + "epgdata.xml", tmppath + bctype + "epgdata.bak.xml")
         time.sleep(5)
         rec10d.rec10db.update_by_bctype_epg_ch(bctype)
     except Exception, inst:
-        recdblist.Commonlogex("Error","updatebc(epgdb.py)", str(type(inst)), str(inst)+"\n"+traceback.format_exc(),log_level=200)
+        recdblist.addCommonlogEX("Error","updatebc(epgdb.py)", str(type(inst)), str(inst)+"\n"+traceback.format_exc(),log_level=200)
         xml2db_dom.xml2db_dom(tmppath + bctype + "epgdata.bak.xml", bctype)
         rec10d.rec10db.update_status_by_bctype_epg_ch(bctype, "2")
-def updatebc_bak(bctype):
-    """
-    update epg data by .bak file
-    """
-    xml2db_dom.xml2db_dom(tmppath + bctype + "epgdata.bak.xml", bctype)
-def searchtime2(titletxt, timet, deltatime, chtxt):
+def searchTime(titletxt, timet, deltatime, chtxt):
     time = datetime.datetime.strptime(timet, "%Y-%m-%d %H:%M:%S")
     ret = []
     deltatime = int(deltatime)
@@ -87,7 +82,7 @@ def searchtime2(titletxt, timet, deltatime, chtxt):
     ret = one
     #print ret
     return ret
-def searchtime_auto(keytxt, timet, deltatime):
+def searchTimeAuto(keytxt, timet, deltatime):
     time = datetime.datetime.strptime(timet, "%Y-%m-%d %H:%M:%S")
     ret = []
     deltatime = int(deltatime)
@@ -102,7 +97,7 @@ def searchtime_auto(keytxt, timet, deltatime):
         etime = etime[0:4] + "-" + etime[4:6] + "-" + etime[6:8] + " " + etime[8:10] + ":" + etime[10:12] + ":00"
         ret.append([chtxtt, title, btime, etime,exp,longexp,category])
     return ret
-def count_schedule(btime,etime):
+def countSchedule(btime,etime):
     """
     return rec num (int return[0]:TE /int return[1]:BS/CS)
     """
@@ -144,7 +139,7 @@ def count_schedule(btime,etime):
             retcount[1] = ret1[1]
     return retcount
 
-def search_schedule(btime,etime):
+def searchSchedule(btime,etime):
     """
     return rec num (int return[0]:TE /int return[1]:BS/CS)
     """
@@ -184,7 +179,7 @@ def search_schedule(btime,etime):
     ret = list(set(ret))
     return ret
 
-def count_epgschedule(epgbtime,epgetime):
+def countEpgSchedule(epgbtime,epgetime):
     """
     return rec num (int return[0]:TE /int return[1]:BS/CS)
     """
@@ -226,7 +221,7 @@ def count_epgschedule(epgbtime,epgetime):
         if retcount[1] < ret1[1]:
             retcount[1] = ret1[1]
     return retcount
-def search_epgschedule(epgbtime,epgetime):
+def searchEpgSchedule(epgbtime,epgetime):
     """
     return rec num (int return[0]:TE /int return[1]:BS/CS)
     """