OSDN Git Service

fix LANG.
authorgn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Sat, 14 Jan 2012 12:53:37 +0000 (12:53 +0000)
committergn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Sat, 14 Jan 2012 12:53:37 +0000 (12:53 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/rec10@894 4e526526-5e11-4fc0-8910-f8fd03428081

rec10/trunk/src/recdblist.py
rec10/trunk/src/recording_earth_pt1.py

index a95e557..00abe1f 100644 (file)
@@ -88,6 +88,13 @@ try:
 except:\r
     log_level_now=900\r
     verbose_level_now=400\r
+\r
+os.environ['LANG'] = "ja_JP.UTF-8"\r
+my_env = os.environ\r
+my_env['LANG'] = "ja_JP.UTF-8"\r
+\r
+def getEnv():\r
+    return my_env\r
 def printutf8(unicode,verbose_level=500):\r
     if verbose_level_now > verbose_level:\r
         try:\r
index ccd7adb..5826ff2 100644 (file)
@@ -32,9 +32,10 @@ def channel2freq(channel):##freqを返す
         freq=str((ch-1)*38360/2+1049480)
     return freq
 def testTune(adapter,channel):
+    my_env=recdblist.getEnv()
     tunecmd=configreader.getConfDVB("DVBtune")+u" "+adapter+u" "+channel2freq(channel)
     #p1=subprocess.Popen(tunecmd,shell=True)
-    p1=subprocess.Popen([configreader.getConfDVB("DVBtune"),adapter,channel2freq(channel)],stdout=subprocess.PIPE,stderr=subprocess.PIPE)
+    p1=subprocess.Popen([configreader.getConfDVB("DVBtune"),adapter,channel2freq(channel)],env=my_env,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
     time.sleep(0.2)
     try:
         os.kill(p1.pid,signal.SIGKILL)
@@ -69,18 +70,19 @@ def getActiveAdapter(channel):
             return str(i)
 def record(channel,tsid,out,timelength,decode=1):
     adapt=getActiveAdapter(channel)
+    my_env=recdblist.getEnv()
     if adapt!=None:
         tunecmd=configreader.getConfDVB("DVBtune")+u" "+adapt+u" "+channel2freq(channel)+u" "+tsid
         reccmd=u"/bin/cat \""+configreader.getConfDVB("DVBadapter")+adapt+"/dvr0\" > "+out
         if decode==1:
             reccmd=configreader.getConfPath("b25")+u" -v 0 \""+configreader.getConfDVB("DVBadapter")+adapt+"/dvr0\" \""+out+"\""
         recdblist.addLog(out, tunecmd+"\n"+reccmd, "record(DVB)",100)
-        p1=subprocess.Popen([configreader.getConfDVB("DVBtune"),adapt,channel2freq(channel),tsid])
+        p1=subprocess.Popen([configreader.getConfDVB("DVBtune"),adapt,channel2freq(channel),tsid],env=my_env)
         time.sleep(0.2)
         if decode==1:
-            p2=subprocess.Popen([configreader.getConfPath("b25"),u"-v 0",u"\""+configreader.getConfDVB("DVBadapter")+adapt+"/dvr0\"","\""+out+"\""],preexec_fn=os.setsid,bufsize=-1)
+            p2=subprocess.Popen([configreader.getConfPath("b25"),u"-v 0",u"\""+configreader.getConfDVB("DVBadapter")+adapt+"/dvr0\"","\""+out+"\""],preexec_fn=os.setsid,env=my_env,bufsize=-1)
         else:
-            p2=subprocess.Popen(reccmd,shell=True,preexec_fn=os.setsid,bufsize=-1)
+            p2=subprocess.Popen(reccmd,shell=True,preexec_fn=os.setsid,env=my_env,bufsize=-1)
         time.sleep(float(timelength))
         os.killpg(p2.pid,signal.SIGKILL)
         p2.wait()