X-Git-Url: http://git.osdn.net/view?p=rec10%2Frec10-git.git;a=blobdiff_plain;f=rec10%2Ftrunk%2Fsrc%2Frecdblist.py;h=0626b50d355f812d9858368d8890b072e3ec94e8;hp=9686f82c2c6040ea468210bbd5ec2574299cffdb;hb=30119b9d0ee2d1bffa80c4dbaa3349b361850bc6;hpb=1b31d3555a1dfc849d21b83941c467db426342c8 diff --git a/rec10/trunk/src/recdblist.py b/rec10/trunk/src/recdblist.py index 9686f82..0626b50 100644 --- a/rec10/trunk/src/recdblist.py +++ b/rec10/trunk/src/recdblist.py @@ -76,7 +76,7 @@ REC_BAYES_SUGGEST ="bayes_suggest" global BONTSDEMUX_DELAY BONTSDEMUX_DELAY="0" -version = 100 +version = 102 version_str="0.9.10" global verbose_level_now @@ -88,6 +88,13 @@ try: except: log_level_now=900 verbose_level_now=400 + +os.environ['LANG'] = "ja_JP.UTF-8" +my_env = os.environ +my_env['LANG'] = "ja_JP.UTF-8" + +def getEnv(): + return my_env def printutf8(unicode,verbose_level=500): if verbose_level_now > verbose_level: try: @@ -95,7 +102,7 @@ def printutf8(unicode,verbose_level=500): print str except Exception, inst: recdblist.addCommonlogEX("Error", "printutf8(recdblist.py)", str(type(inst)), str(inst)+traceback.format_exc(),log_level=200) -def printuft8ex(unicode,verbose_level=500,log_level=500): +def printutf8ex(unicode,verbose_level=500,log_level=500): str=unicode.encode('utf-8') if verbose_level_now > verbose_level: print str @@ -106,12 +113,21 @@ def printuft8ex(unicode,verbose_level=500,log_level=500): f=open(logfname,mode) f.write(str+"\n") f.close() +def printutf8_Important(unicode): + printutf8ex(unicode,100,100) +def printutf8_Normal(unicode): + printutf8ex(unicode,300,300) +def printutf8_Detailed(unicode): + printutf8ex(unicode,600,600) def addCommonlogEX(type,place,inst,txt,verbose_level=500,log_level=500): - lt=datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")+u":" + lt=unicode(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))+u":" if txt=="": lt=lt+u"["+type+u"] "+place+u" "+inst else: - lt=lt+u"["+type+u"] "+place+u" "+inst+u"\n"+txt + try: + lt=lt+u"["+type+u"] "+place+u" "+inst+u"\n"+txt + except: + print [type,place,inst,txt] lt=lt.encode('utf-8') logfname="/var/log/rec10" mode="a" @@ -140,7 +156,10 @@ def addCommandSelfLog(tspath,command): f=open(logpath,'a') else: f=open(logpath,'w') - f.write(command+"\n\n") + tc=command+u"\n\n" + tc=unicode(tc) + f.write(tc.encode("utf-8")) + #f.write(tc.encode('utf-8','ignore')) f.close() def getLogTitle(tspath): logo=tspath @@ -183,7 +202,6 @@ def addLog(tspath,txt,log_title,maxtextlength=1500): def addLogAll(tspath,txt,log_title,logpath): logo=logpath f=open(logo,'a') - s=len(txt) stxt=txt txtw= datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") txtw=txtw+"\n####"+log_title+"####\n"+stxt