OSDN Git Service

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

rec10/trunk/src/recording_earth_pt1.py

index efedd5a..f2ea3ba 100644 (file)
@@ -1,3 +1,4 @@
+import os.path
 #!/usr/bin/python
 # coding: UTF-8
 # Rec10 TS Recording Tools
@@ -17,6 +18,7 @@ import recdblist
 #BS1,BS3...BS23 BS放送
 #CS2,CS4...CS24 CS放送
 
+tmppath = configreader.getConfPath("tmp")+"/"
 def channel2freq(channel):##freqを返す
     freq=""
     if channel[0:2].upper() != "CS" and channel[0:2].upper() != "BS":
@@ -69,21 +71,26 @@ def getActiveAdapter(channel):
         if rt==1:
             return str(i)
 def record(channel,tsid,out,timelength,decode=1):
+    if not os.path.exists(tmppath+u"rec.sh"):
+        ft=open(tmppath+u"rec.sh")
+        ft.write(u"#!/bin/bash\n/bin/cat $1 > $2")
+        ft.close()
+        os.system(u"chmod +x "+tmppath+u"rec.sh")
     adapt=getActiveAdapter(channel)
     my_env=recdblist.getEnv()
     if adapt!=None:
         f=open(out,"w")
         tunecmd=configreader.getConfDVB("DVBtune")+u" "+adapt+u" "+channel2freq(channel)+u" "+tsid
-        reccmd=u"/bin/cat \""+configreader.getConfDVB("DVBadapter")+adapt+"/dvr0\" > \""+out+"\""
+        reccmd=u"/bin/cat \""+configreader.getConfDVB("DVBadapter")+adapt+u"/dvr0\" > \""+out+u"\""
         if decode==1:
-            reccmd=configreader.getConfPath("b25")+u" -v 0 \""+configreader.getConfDVB("DVBadapter")+adapt+"/dvr0\" \""+out+"\""
+            reccmd=configreader.getConfPath("b25")+u" -v 0 \""+configreader.getConfDVB("DVBadapter")+adapt+u"/dvr0\" \""+out+"\""
         recdblist.addLog(out, tunecmd+"\n"+reccmd, "record(DVB)",100)
         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,env=my_env,bufsize=-1)
         else:
-            p2=subprocess.Popen(["/bin/cat","\""+configreader.getConfDVB("DVBadapter")+adapt+"/dvr0\""],stdout=f,preexec_fn=os.setsid,env=my_env,bufsize=-1)
+            p2=subprocess.Popen([tmppath+u"rec.sh",configreader.getConfDVB("DVBadapter")+adapt+"/dvr0",out],preexec_fn=os.setsid,env=my_env,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)