OSDN Git Service

make DVB driver usable.
authorgn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Mon, 9 Jan 2012 02:34:33 +0000 (02:34 +0000)
committergn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Mon, 9 Jan 2012 02:34:33 +0000 (02:34 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/rec10@891 4e526526-5e11-4fc0-8910-f8fd03428081

12 files changed:
rec10/trunk/src/configreader.py
rec10/trunk/src/configwriter.py
rec10/trunk/src/install.py
rec10/trunk/src/install.sh
rec10/trunk/src/readme.txt
rec10/trunk/src/rec10.conf
rec10/trunk/src/recdblist.py
rec10/trunk/src/recording_earth_pt1.py [new file with mode: 0644]
rec10/trunk/src/scan_ch.py
rec10/trunk/src/tester.py
rec10/trunk/src/timerec.py
rec10/trunk/src/tv2ts.py

index cf1eee5..b838c75 100644 (file)
@@ -28,3 +28,6 @@ def getConfEnv(string):
 def getConfLog(string):\r
     global confp\r
     return confp.get('log', string)\r
+def getConfDVB(string):\r
+    global confp\r
+    return confp.get('dvb',string)\r
index aa67867..f7c88b6 100644 (file)
@@ -22,6 +22,9 @@ def setTempConfDB(option,value):
 def setTempConfEnv(option,value):\r
     global confp\r
     return confp.set('env',option,value)\r
+def setTempConfDVB(option,value):\r
+    global confp\r
+    return confp.set('dvb',option,value)\r
 def writeTempConf():\r
     global confp\r
     f=open(confpath,"w")\r
index c2c9135..fb440a3 100644 (file)
@@ -77,7 +77,7 @@ def move():
     path = str(os.path.dirname(os.path.abspath(__file__)))\r
     printutf8(u"rec10 ver "+recdblist.version_str+" installer.")\r
     printutf8(u"rec10のインストールを開始します。")\r
-    maxn=13\r
+    maxn=16\r
     configwriter.setTempConfPath(u"wine", getLocalPath(u"wine"))\r
     configwriter.setTempConfPath(u"recpt1", getLocalPath(u"recpt1",exit=0))\r
     #configwriter.setpath(u"x264", getLocalPath(u"x264"))\r
@@ -116,14 +116,44 @@ def move():
     printutf8(u"パスワードを設定してください(3/"+str(maxn)+")")\r
     mysql_passwd=getConf(useB,"/etc/rec10.conf","db","mysql_passwd","mysql_passwd : ")\r
     configwriter.setTempConfDB("mysql_passwd", mysql_passwd)\r
+    printutf8(u"BS/CSの設定に入ります")\r
+    printutf8(u"BS/CS(110度CS,スカパーe2)を受信しますか(4/"+str(maxn)+")")\r
+    useBSCS=raw_input("[Y/n]:")\r
+    if useBSCS=="N" or useBSCS=="n" or useBSCS=="no" or useBSCS=="NO":\r
+        useBSCS="0"\r
+    else:\r
+        useBSCS="1"\r
+    printutf8(u"ドライバの設定に入ります")\r
+    printutf8(u"DTV版のドライバを使用しますか(earth_pt1など。chardev版を使う場合はNo)(5/"+str(maxn)+")")\r
+    useDVB=raw_input("[y/N]:")\r
+    if useDVB=="Y" or useDVB=="y" or useDVB=="yes" or useDVB=="YES":\r
+        useDVB="1"\r
+    else:\r
+        useDVB="0"\r
+    configwriter.setTempConfDVB("useDVB", useDVB)\r
+    if useDVB=="1":\r
+        printutf8(u"DVBの設定に入ります")\r
+        printutf8(u"DVBAdapterの場所を設定して下さい")\r
+        printutf8(u"/dev/dvb/adapterなどdvr0の上のフォルダ(番号の前まで)を指定して下さい。")\r
+        getConf(useB,"/etc/rec10.conf","dvb","DVBadapter","/dev/dvb/adapter")\r
+        printutf8(u"地デジを受信可能なアダプタ番号を入力して下さい(1,3のように','で区切って下さい)")\r
+        getConf(useB,"/etc/rec10.conf","dvb","DVBTE","1,3")\r
+        if useBSCS=="1":\r
+            printutf8(u"BS/CSを受信可能なアダプタ番号を入力して下さい(0,2のように','で区切って下さい)")\r
+            getConf(useB,"/etc/rec10.conf","dvb","DVBBSCS","0,2")\r
+        else:\r
+            configwriter.setTempConfDVB("DVBBSCS","")\r
     printutf8(u"同時録画可能数の設定に入ります")\r
-    printutf8(u"TE(地デジ)録画可能数(PT*だと2 白Friioだと1)(4/"+str(maxn)+")")\r
+    printutf8(u"TE(地デジ)録画可能数(PT*だと2 白Friioだと1)(6/"+str(maxn)+")")\r
     te_max=str(int(getConf(useB,"/etc/rec10.conf","env","te_max","te_max : ")))\r
     configwriter.setTempConfEnv("te_max", te_max)\r
-    printutf8(u"BS/CS110録画可能数(PT*だと2 黒Friioだと1)(5/"+str(maxn)+")")\r
-    bscs_max=str(int(getConf(useB,"/etc/rec10.conf","env","bscs_max","bscs_max : ")))\r
-    configwriter.setTempConfEnv("bscs_max", bscs_max)\r
-    printutf8(u"同時エンコード最大数を設定してください(6/"+str(maxn)+")")\r
+    if useBSCS=="1":\r
+        printutf8(u"BS/CS110録画可能数(PT*だと2 黒Friioだと1)(7/"+str(maxn)+")")\r
+        bscs_max=str(int(getConf(useB,"/etc/rec10.conf","env","bscs_max","bscs_max : ")))\r
+        configwriter.setTempConfEnv("bscs_max", bscs_max)\r
+    else:\r
+        configwriter.setTempConfEnv("bscs_max", "0")\r
+    printutf8(u"同時エンコード最大数を設定してください(8/"+str(maxn)+")")\r
     printutf8(u"CPUのコア数が目安です")\r
     enc_max=raw_input("[2]:")\r
     if enc_max=="":\r
@@ -132,7 +162,7 @@ def move():
         enc_max=str(int(enc_max))\r
     configwriter.setTempConfEnv("enc_max", enc_max)\r
     printutf8(u"二カ国語放送/5.1ch放送の音声変換の設定です。\nNeroAACエンコーダーを使用しますか?(NeroAACEncを別途入手してtstoolsに入れてください。))")\r
-    printutf8(u"入手先:http://www.nero.com/jpn/technologies-aac-codec.html\n (7/"+str(maxn)+")")\r
+    printutf8(u"入手先:http://www.nero.com/jpn/technologies-aac-codec.html\n (9/"+str(maxn)+")")\r
     audioenc=raw_input("[y/N]:  ")\r
     if audioenc=="y" or audioenc=="Y":\r
         configwriter.setTempConfPath("useNeroAAC", "1")\r
@@ -148,30 +178,30 @@ def move():
         aacpath="/usr/local/bin/neroAacEnc"\r
         configwriter.setTempConfPath("NeroAAC",aacpath)\r
         printutf8(u"lameを使用します。")\r
-    printutf8(u"x264のパスを指定してください(7/"+str(maxn)+")")\r
+    printutf8(u"x264のパスを指定してください(10/"+str(maxn)+")")\r
     x264path=getConf(useB,"/etc/rec10.conf","path","x264","x264 path : ")\r
     if x264path.replace(" ","")=="" or not os.path.isfile(x264path):\r
         x264path=getLocalPath(u"x264")\r
     configwriter.setTempConfPath("x264",x264path)\r
-    printutf8(u"保存する画質を教えてください(8/"+str(maxn)+")")\r
+    printutf8(u"保存する画質を教えてください(11/"+str(maxn)+")")\r
     printutf8(u"x264のcrfの値です。標準だと30分で800MBほどになります")\r
     crf=getConf(useB,"/etc/rec10.conf","env","crf","[24] : ")\r
     if crf.replace(" ","")=="":\r
         crf="24"\r
     configwriter.setTempConfEnv("crf", crf)\r
-    printutf8(u"アニメーションを保存する画質を教えてください(9/"+str(maxn)+")")\r
+    printutf8(u"アニメーションを保存する画質を教えてください(12/"+str(maxn)+")")\r
     printutf8(u"x264のcrfの値です。標準だと30分で800MBほどになります")\r
     a_crf=getConf(useB,"/etc/rec10.conf","env","animation_crf","[20] : ")\r
     if a_crf.replace(" ","")=="":\r
         a_crf="20"\r
     configwriter.setTempConfEnv("animation_crf", a_crf)\r
-    printutf8(u"x264の圧縮率を設定してください(10/"+str(maxn)+")")\r
+    printutf8(u"x264の圧縮率を設定してください(13/"+str(maxn)+")")\r
     printutf8(u"x264のpresetの値です。標準だとmedium、小さければ小さいほど高圧縮になります")\r
     preset=getConf(useB,"/etc/rec10.conf","env","x264_preset","[4] : ")\r
     if preset.replace(" ","")=="":\r
         preset="4"\r
     configwriter.setTempConfEnv("x264_preset", preset)\r
-    printutf8(u"保存するコンテナの設定(11/"+str(maxn)+")")\r
+    printutf8(u"保存するコンテナの設定(14/"+str(maxn)+")")\r
     printutf8(u"MP4を標準にしますか(もしくはMKVが使えます)")\r
     useMP4=raw_input("[Y/n]:")\r
     if useMP4=="N" or useMP4 == "n" :\r
@@ -179,7 +209,7 @@ def move():
     else:\r
         useMP4="1"\r
     configwriter.setTempConfEnv("make_mp4", useMP4)\r
-    printutf8(u"TSファイルの自動削除(12/"+str(maxn)+")")\r
+    printutf8(u"TSファイルの自動削除(15/"+str(maxn)+")")\r
     printutf8(u"中間体のtsファイルを削除しますか")\r
     printutf8(u"(削除するとやり直しができないため残しておくことを推奨します。)")\r
     removeTS=raw_input("[y/N]:")\r
@@ -188,7 +218,7 @@ def move():
     else:\r
         removeTS="0"\r
     configwriter.setTempConfEnv("remove_ts", removeTS)\r
-    printutf8(u"自機識別オプション(13/"+str(maxn)+")")\r
+    printutf8(u"自機識別オプション(16/"+str(maxn)+")")\r
     printutf8(u"本rec10の識別名を入力してください")\r
     printutf8(u"複数台のrec10を運用する場合に効果的です。空白でもかまいません。")\r
     printutf8(u"例 kobe01")\r
index 79cac21..1b117d9 100644 (file)
@@ -13,5 +13,5 @@ elif type -P python2.5 > /dev/null
 then export LANG="ja_JP.UTF-8" && python2.5 ./install.py
 elif type -P python25 > /dev/null
 then export LANG="ja_JP.UTF-8" && python25 ./install.py
-
+fi
 mv Makefile.base Makefile
index bb6aac2..f3852f7 100644 (file)
@@ -1,8 +1,8 @@
 ###########################################
 #     Rec10 -Ts Recording system-         #
-#                          Ver.0.9.9.2    #
-# 2011/03/23         Yukikaze & long.inus #
-#  Copyright (C) 2009-2011 Yukikaze      #
+#                          Ver.0.9.10     #
+# 2012/01/09         Yukikaze & long.inus #
+#  Copyright (C) 2009-2012 Yukikaze      #
 ###########################################
 
 本ソフトはpythonおよびperlによって書かれた録画ツールです。
@@ -31,14 +31,18 @@ epgdump(included)
 b25(not included)
 recpt1(recfriioでもいいはずです)(not included)
 MySQLdb
+##DVB環境では
+tune(included)が追加で必要
 
 事前準備:
-ネットの情報を参考にpt1ドライバーを無効化する
-pt1などのドライバーをインストールした上(chardev版)で、recpt1などのソフトを導入、
-b25をインストールしておいてください。
-*注意
-11年10月01日からのBS新チャンネル対応のためには、10/02現在ではrecpt1にパッチを当てる必要があります。
-rec10同梱版のepgrecはts解析によってチャンネルデータを得るように改変してあるので
+DVB版に対応したため、直下の対策は必要有りません。
+
+#ネットの情報を参考にpt1ドライバーを無効化する
+#pt1などのドライバーをインストールした上(chardev版)で、recpt1などのソフトを導入、
+#b25をインストールしておいてください。
+#*注意
+#11年10月01日からのBS新チャンネル対応のためには、10/02現在ではrecpt1にパッチを当てる必要があります。
+rec10同梱版のepgdumpはts解析によってチャンネルデータを得るように改変してあるので
 変更は不要です。
 
 1:install.shを実行
@@ -66,7 +70,7 @@ Makefile.PLを実行します。
 実行した後にrectool.plをhttpの公開ディレクトリ(wwwフォルダなど)に置いてください。
 
 ちなみに
-エンコードの設定を変えたい場合はts2x264を参照してください
+エンコードの設定を変えたい場合はts2x264.pyを参照してください
 
 
 チャンネルの設定を変えた場合はを編集した後に
@@ -100,7 +104,7 @@ rec10オプション一覧
 
 
 [History]
-11/XX/XX 0.9.10
+12/XX/XX 0.9.10
 add Bluray compatible option("B")
 ステレオ音声時のBonTsDemux仕様オプション追加("b")
 lameの実行パスチェックを実装
@@ -112,6 +116,7 @@ logoのインポートに対応
 ArchLinuxサポートのための細かな変更
 新BSチャンネル対応
 lavf有効x264でのエラーに対応
+DVB版のドライバに対応
 
 11/02/02 0.9.9
 BonTsDemuxを最新版へ(nogui化によりXvfbが不要)
index 9c5e493..f9f7047 100644 (file)
@@ -1,5 +1,4 @@
 [path]
-recpt1 = /usr/local/bin/recpt1
 wine = /usr/bin/wine
 x264 = /usr/bin/x264
 mencoder = /usr/bin/mencoder
@@ -11,6 +10,8 @@ java = /usr/bin/java
 #recpathは録画先のフォルダを指定
 recpath = /path of /recording
 
+recpt1 = /usr/local/bin/recpt1
+
 #録画終了後に動画を置いておくフォルダを指定するとrectool.plでリスト化できます。
 recorded = 
 
@@ -39,6 +40,13 @@ b25 = /usr/local/bin/b25
 
 useNeroAAC = 0
 NeroAAC = /usr/local/bin/neroAacEnc
+
+[dvb]
+useDVB = 0
+DVBtune = /usr/local/share/rec10/tstools/tune
+DVBadapter = /dev/dvb/adapter
+DVBTE = 1,3
+DVBBSCS = 0,2
 [db]
 db = MySQL
 mysql_dbname=rec10
@@ -67,4 +75,4 @@ remove_ts = 0
 bluray = 1
 [log]
 verbose_level = 400#デーモンとして使う場合は変更する必要はありません。
-log_level = 400#
\ No newline at end of file
+log_level = 900#
\ No newline at end of file
index 1b60dc9..a95e557 100644 (file)
@@ -95,7 +95,7 @@ def printutf8(unicode,verbose_level=500):
             print str\r
         except Exception, inst:\r
             recdblist.addCommonlogEX("Error", "printutf8(recdblist.py)", str(type(inst)), str(inst)+traceback.format_exc(),log_level=200)\r
-def printuft8ex(unicode,verbose_level=500,log_level=500):\r
+def printutf8ex(unicode,verbose_level=500,log_level=500):\r
     str=unicode.encode('utf-8')\r
     if verbose_level_now > verbose_level:\r
         print str\r
@@ -106,6 +106,12 @@ def printuft8ex(unicode,verbose_level=500,log_level=500):
             f=open(logfname,mode)\r
             f.write(str+"\n")\r
             f.close()\r
+def printutf8_Important(unicode):\r
+    printutf8ex(unicode,100,100)\r
+def printutf8_Normal(unicode):\r
+    printutf8ex(unicode,300,300)\r
+def printutf8_Detailed(unicode):\r
+    printutf8ex(unicode,600,600)\r
 def addCommonlogEX(type,place,inst,txt,verbose_level=500,log_level=500):\r
     lt=unicode(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))+u":"\r
     if txt=="":\r
@@ -189,7 +195,6 @@ def addLog(tspath,txt,log_title,maxtextlength=1500):
 def addLogAll(tspath,txt,log_title,logpath):\r
     logo=logpath\r
     f=open(logo,'a')\r
-    s=len(txt)\r
     stxt=txt\r
     txtw= datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")\r
     txtw=txtw+"\n####"+log_title+"####\n"+stxt\r
diff --git a/rec10/trunk/src/recording_earth_pt1.py b/rec10/trunk/src/recording_earth_pt1.py
new file mode 100644 (file)
index 0000000..f6081c9
--- /dev/null
@@ -0,0 +1,99 @@
+#!/usr/bin/python
+# coding: UTF-8
+# Rec10 TS Recording Tools
+# Copyright (C) 2009-2012 Yukikaze
+
+import sys
+import subprocess
+import time
+import os
+import signal
+
+import configreader
+import recdblist
+#
+#CHの定義は
+#1-64 地デジ
+#BS1,BS3...BS23 BS放送
+#CS2,CS4...CS24 CS放送
+
+def channel2freq(channel):##freqを返す
+    freq=""
+    if channel[0:2].upper() != "CS" and channel[0:2].upper() != "BS":
+        ch=int(channel)
+        if ch<65:#TE 13ch 473_142857
+            freq=str(473+(ch-13)*6)+u"142857"
+    elif channel[0:2].upper() == "CS":#CS2,CS4,CS6...CS24
+        ch=int(channel.upper().replace("CS",""))
+        #freq = 12291000 + (CH_IDX - 2) * 40000 / 2 - 10678000;
+        freq=str((ch-2)*40000/2+1613000)
+    elif channel[0:2].upper() == "BS":#BS1,BS3,BS5...BS23
+        ch=int(channel.upper().replace("BS",""))
+        freq=str((ch-1)*38360/2+1049480)
+    return freq
+def testTune(adapter,channel):
+    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)
+    time.sleep(0.2)
+    try:
+        os.kill(p1.pid,signal.SIGKILL)
+    except:
+        ""
+    if p1.communicate()[1].find("busy")>-1:
+        try:
+            p1.wait()
+        except:
+            ""
+        return 0
+    else:
+        try:
+            p1.wait()
+        except:
+            ""
+        return 1
+def getAdapter(channel):
+    chl=[]
+    if channel[0:2].upper()=="BS" or channel[0:2].upper()=="CS":
+        chl=configreader.getConfDVB("DVBBSCS").split(",")
+    elif int(channel)<65:
+        chl=configreader.getConfDVB("DVBTE").split(",")
+    chlr=[]
+    for i in chl:
+        chlr.append(int(i))
+    return chlr
+def getActiveAdapter(channel):
+    for i in getAdapter(channel):
+        rt=testTune(str(i),channel)
+        if rt==1:
+            return str(i)
+def record(channel,tsid,out,timelength,decode=1):
+    adapt=getActiveAdapter(channel)
+    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])
+        time.sleep(0.2)
+        if decode==1:
+            p2=subprocess.Popen([configreader.getConfPath("b25"),u"-v 0",configreader.getConfDVB("DVBadapter")+adapt+"/dvr0",out],preexec_fn=os.setsid,bufsize=-1)
+        else:
+            p2=subprocess.Popen(reccmd,shell=True,preexec_fn=os.setsid,bufsize=-1)
+        time.sleep(float(timelength))
+        os.killpg(p2.pid,signal.SIGKILL)
+        p2.wait()
+        os.kill(p1.pid,signal.SIGKILL)
+        p1.wait()
+    else:
+        recdblist.printutf8ex(u"tuner busy",100,100)
+        #f.close()
+def useDVB():
+    try:
+        if int(configreader.getConfDVB("useDVB").replace(" ",""))==1:
+            return 1
+        else:
+            return 0
+    except:
+        return 0
\ No newline at end of file
index 377c19b..7130452 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 # coding: UTF-8
 # Rec10 TS Recording Tools
-# Copyright (C) 2009-2011 Yukikaze
+# Copyright (C) 2009-2012 Yukikaze
 import os
 import os.path
 import time
@@ -19,62 +19,68 @@ if not os.path.exists(tmppath):
     os.mkdir(tmppath)
 tssplitterp =configreader.getConfPath("java")+" -jar "+configreader.getConfPath("jTsSplitter")
 def searchCh():
-    rec10d.rec10db.change_installed_in_status(2)
-    #地上デジタル
-    for i in xrange(13,52):#62
-        recdblist.printuft8ex(u"チャンネルスキャン:地上デジタル CH "+str(i), 200, 200)
-        if checkTs(str(i))>0:
-            addCh(str(i),u"te"+str(i),str(i))
-    time.sleep(1)
-    #BSデジタル
-    recdblist.printuft8ex(u"チャンネルスキャン:BSデジタル ", 200, 200)
-    for i in xrange(100,299):#240
-        recdblist.printuft8ex(u"チャンネルスキャン:BSデジタル CH "+str(i), 200, 200)
-        if checkTs(str(i))>0:
-            addCh(str(i),u"bs","BS")
-    time.sleep(1)
-    #スカパーe2!
-    #http://www5e.biglobe.ne.jp/~kazu_f/digital-sat/trapon-nsat110.html
-    #
-    #CS1ネットワーク
-    if checkTs("CS2")>0:
-        recdblist.printuft8ex(u"チャンネルスキャン:CSSデジタル CH:CS2 ", 200, 200)
-        addCh("CS2","cs1","CS")
-    if checkTs("CS8")>0:
-        recdblist.printuft8ex(u"チャンネルスキャン:CSSデジタル CH:CS8", 200, 200)
-        addCh("CS8","cs1","CS")
-    if checkTs("CS10")>0:
-        recdblist.printuft8ex(u"チャンネルスキャン:CSSデジタル CH:CS10", 200, 200)
-        addCh("CS10","cs1","CS")
-    #CS2ネットワーク
-    if checkTs("CS4")>0:
-        recdblist.printuft8ex(u"チャンネルスキャン:CSSデジタル CH:CS4", 200, 200)
-        addCh("CS4","cs2","CS")
-    if checkTs("CS6")>0:
-        recdblist.printuft8ex(u"チャンネルスキャン:CSSデジタル CH:CS6", 200, 200)
-        addCh("CS6","cs2","CS")
-    if checkTs("CS12")>0:
-        recdblist.printuft8ex(u"チャンネルスキャン:CSSデジタル CH:CS12", 200, 200)
-        addCh("CS12","cs2","CS")
-    if checkTs("CS14")>0:
-        recdblist.printuft8ex(u"チャンネルスキャン:CSSデジタル CH:CS14", 200, 200)
-        addCh("CS14","cs2","CS")
-    if checkTs("CS16")>0:
-        recdblist.printuft8ex(u"チャンネルスキャン:CSSデジタル CH:CS16", 200, 200)
-        addCh("CS16","cs2","CS")
-    if checkTs("CS18")>0:
-        recdblist.printuft8ex(u"チャンネルスキャン:CSSデジタル CH:CS18", 200, 200)
-        addCh("CS18","cs2","CS")
-    if checkTs("CS20")>0:
-        recdblist.printuft8ex(u"チャンネルスキャン:CSSデジタル CH:CS20", 200, 200)
-        addCh("CS20","cs2","CS")
-    if checkTs("CS22")>0:
-        recdblist.printuft8ex(u"チャンネルスキャン:CSSデジタル CH:CS22", 200, 200)
-        addCh("CS22","cs2","CS")
-    if checkTs("CS24")>0:
-        recdblist.printuft8ex(u"チャンネルスキャン:CSSデジタル CH:CS24", 200, 200)
-        addCh("CS24","cs2","CS")
-    rec10d.rec10db.change_installed_in_status(100)
+    if rec10d.rec10db.select_installed_in_status()<2:
+        rec10d.rec10db.change_installed_in_status(2)
+        #地上デジタル
+        for i in xrange(13,52):#62
+            recdblist.printutf8ex(u"チャンネルスキャン:地上デジタル CH "+str(i), 200, 200)
+            if checkTs(str(i))>0:
+                addCh(str(i),u"te"+str(i),str(i))
+        time.sleep(1)
+        #BSデジタル
+        recdblist.printutf8ex(u"チャンネルスキャン:BSデジタル ", 200, 200)
+        for i in xrange(100,299):#240
+            recdblist.printutf8ex(u"チャンネルスキャン:BSデジタル CH "+str(i), 200, 200)
+            if checkTs(str(i))>0:
+                addCh(str(i),u"bs","BS")
+        for i2 in xrange(0,11):
+            chi=u"BS"+str(2*i2+1)
+            recdblist.printutf8ex(u"チャンネルスキャン:BSデジタル CH "+chi, 200, 200)
+            if chechTs(chi)>0:
+                addCh(str(chi),u"bs","BS")
+        time.sleep(1)
+        #スカパーe2!
+        #http://www5e.biglobe.ne.jp/~kazu_f/digital-sat/trapon-nsat110.html
+        #
+        #CS1ネットワーク
+        if checkTs("CS2")>0:
+            recdblist.printutf8ex(u"チャンネルスキャン:CSSデジタル CH:CS2 ", 200, 200)
+            addCh("CS2","cs1","CS")
+        if checkTs("CS8")>0:
+            recdblist.printutf8ex(u"チャンネルスキャン:CSSデジタル CH:CS8", 200, 200)
+            addCh("CS8","cs1","CS")
+        if checkTs("CS10")>0:
+            recdblist.printutf8ex(u"チャンネルスキャン:CSSデジタル CH:CS10", 200, 200)
+            addCh("CS10","cs1","CS")
+        #CS2ネットワーク
+        if checkTs("CS4")>0:
+            recdblist.printutf8ex(u"チャンネルスキャン:CSSデジタル CH:CS4", 200, 200)
+            addCh("CS4","cs2","CS")
+        if checkTs("CS6")>0:
+            recdblist.printutf8ex(u"チャンネルスキャン:CSSデジタル CH:CS6", 200, 200)
+            addCh("CS6","cs2","CS")
+        if checkTs("CS12")>0:
+            recdblist.printutf8ex(u"チャンネルスキャン:CSSデジタル CH:CS12", 200, 200)
+            addCh("CS12","cs2","CS")
+        if checkTs("CS14")>0:
+            recdblist.printutf8ex(u"チャンネルスキャン:CSSデジタル CH:CS14", 200, 200)
+            addCh("CS14","cs2","CS")
+        if checkTs("CS16")>0:
+            recdblist.printutf8ex(u"チャンネルスキャン:CSSデジタル CH:CS16", 200, 200)
+            addCh("CS16","cs2","CS")
+        if checkTs("CS18")>0:
+            recdblist.printutf8ex(u"チャンネルスキャン:CSSデジタル CH:CS18", 200, 200)
+            addCh("CS18","cs2","CS")
+        if checkTs("CS20")>0:
+            recdblist.printutf8ex(u"チャンネルスキャン:CSSデジタル CH:CS20", 200, 200)
+            addCh("CS20","cs2","CS")
+        if checkTs("CS22")>0:
+            recdblist.printutf8ex(u"チャンネルスキャン:CSSデジタル CH:CS22", 200, 200)
+            addCh("CS22","cs2","CS")
+        if checkTs("CS24")>0:
+            recdblist.printutf8ex(u"チャンネルスキャン:CSSデジタル CH:CS24", 200, 200)
+            addCh("CS24","cs2","CS")
+        rec10d.rec10db.change_installed_in_status(100)
 def checkTs(ch):
     tv2ts.tv2b25ts(os.path.join(tmppath,"ch_"+str(ch)+".ts"), ch, "1")
     if os.path.exists(os.path.join(tmppath,"ch_"+str(ch)+".ts")):
@@ -87,13 +93,14 @@ def addCh(ch,bctype,chtxthead):
     for lstr in prglist[0]:
         #print [bctype,chtxthead+"_"+lstr, ch, lstr]
         try:
-            if ch.find("bs")>-1:
-                if int(lstr)<300:
+            if int(lstr)<10000:
+                if ch.find("bs")>-1:
+                    if int(lstr)<300:
+                        tnow=datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
+                        rec10d.rec10db.add_epg_ch(bctype,chtxthead+"_"+lstr, ch, lstr, u"2010-01-01 00:00:00", u"2010-01-01 00:00:00",tnow)
+                else:
                     tnow=datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
                     rec10d.rec10db.add_epg_ch(bctype,chtxthead+"_"+lstr, ch, lstr, u"2010-01-01 00:00:00", u"2010-01-01 00:00:00",tnow)
-            else:
-                tnow=datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
-                rec10d.rec10db.add_epg_ch(bctype,chtxthead+"_"+lstr, ch, lstr, u"2010-01-01 00:00:00", u"2010-01-01 00:00:00",tnow)
         except Exception, inst:
             recdblist.addCommonlogEX("Warning", "addCh (scan_ch.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
     checkB25Purchased(ch, prglist[1])
@@ -107,7 +114,7 @@ def getTsProgNum(ch,tspath):
     pin=tspath
     pout=os.path.join(tmppath,"chscan.txt")
     chopt="-ch"
-    if ch.find("CS")>-1:
+    if ch.find("CS")>-1 or ch.find("BS"):
         chopt="-cs"
     elif int(ch)>99:
         chopt="-bs"
index e9012ca..5ac0eee 100644 (file)
@@ -2,19 +2,20 @@
 # coding: UTF-8
 # Rec10 TS Recording Tools
 # Copyright (C) 2009-2011 Yukikaze
-#import sys
-import epgdb
-import tv2ts
+import sys
+#import epgdb
+#import tv2ts
 import os
-import time
-import tv2avi
-import tv2mkv
-import checker
-import guess
-import auto_process
-import install
+#import time
+#import tv2avi
+#import tv2mkv
+#import checker
+#import guess
+#import auto_process
+#import install
 #import datetime
-import rec10d
+#import rec10d
+
 #import os
 #import time
 #import n_gram
@@ -35,12 +36,13 @@ import rec10d
 #import guess
 #import zenhan
 #import auto_process
-import chdb
-import epgdb
-import datetime
-import tv2mp4
-import ts2x264
-import recque
+#import chdb
+##import epgdb
+#import datetime
+#import tv2mp4
+#import ts2x264
+#import recque
+import recording_earth_pt1
 path = str(os.path.dirname(os.path.abspath(__file__))) + "/"
 recpath = "/home/ftpusr/ftp-tmp/Recording/"
 ftpusr = "/home/ftpusr/ftp-tmp"
@@ -50,6 +52,14 @@ if __name__ == "__main__":
     #recque.searchRecQue(recpath)
     #print chdb.updateLogo()
     #epgdb.updateLogo_bc("bs")
-    print ts2x264.getX264CoreVersion()
-    auto_process.killDeadEncode(recpath)
+    #print ts2x264.getX264CoreVersion()
+    #auto_process.killDeadEncode(recpath)
+    print "12"
+    print recording_earth_pt1.channel2freq("12")
+    print "BS2"
+    print recording_earth_pt1.channel2freq("BS2")
+    print "CS6"
+    print recording_earth_pt1.channel2freq("CS6")
+    recording_earth_pt1.getActiveAdapter("1")
+    recording_earth_pt1.record("13", "0", "/home/yukikaze/dvb/rec10test.ts", "10")
     ""
index af5cd3c..18c403a 100644 (file)
@@ -43,7 +43,7 @@ def task():
             scan_ch.searchCh()
             rec10d.rec10db.change_installed_in_status(100)
         elif rec10d.rec10db.select_installed_in_status()==2:
-            recdblist.printuft8ex("Exit because CH scanning.", 200, 200)
+            recdblist.printutf8ex("Exit because CH scanning.", 200, 200)
             sys.exit(0)
     except Exception, inst:
         recdblist.addCommonlogEX("Error", "install_check(timerec.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
index 8f706f4..52a2c00 100644 (file)
@@ -12,6 +12,7 @@ import traceback
 import configreader
 import status
 import recdblist
+import recording_earth_pt1
 mypath = str(os.path.dirname(os.path.abspath(__file__))) + "/"
 def tv2tsmix(pout, ch, time,getlog=0):
     tv2b25ts(pout + ".b25", ch, time)
@@ -70,22 +71,36 @@ def b252ts(pout, ch, csch):
         tch="0"
     tsmix2ts(pout + ".tsmix", pout, tch)
 def tv2b25ts(pout, ch, time):
-    exe = configreader.getConfPath('recpt1')
-    if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
-        status.changeBSCSRecording(1)
-    else:
-        status.changeTERecording(1)
-    try:
-        doexe = exe + ' ' + ch + ' ' + time + ' \'' + pout + '\''
-        recdblist.printutf8(doexe)
-        recdblist.addLog(pout, doexe, u"recpt1ログ-コマンド")
-        recdblist.addLog(pout, unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8'), u"recpt1ログ-詳細")
-    except Exception, inst:
-        recdblist.addCommonlogEX(u"Error",u"tv2b25ts(tv2ts.py)", str(type(inst)),str(inst))
-    if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
-        status.changeBSCSRecording(-1)
-    else:
-        status.changeTERecording(-1)
+    if recording_earth_pt1.useDVB()==0:
+        exe = configreader.getConfPath('recpt1')
+        if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
+            status.changeBSCSRecording(1)
+        else:
+            status.changeTERecording(1)
+        try:
+            doexe = exe + ' ' + ch + ' ' + time + ' \'' + pout + '\''
+            recdblist.printutf8(doexe)
+            recdblist.addLog(pout, doexe, u"recpt1ログ-コマンド")
+            recdblist.addLog(pout, unicode(commands.getoutput(doexe.encode('utf-8')),'utf-8'), u"recpt1ログ-詳細")
+        except Exception, inst:
+            recdblist.addCommonlogEX(u"Error",u"tv2b25ts(tv2ts.py)", str(type(inst)),str(inst))
+        if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
+            status.changeBSCSRecording(-1)
+        else:
+            status.changeTERecording(-1)
+    elif recording_earth_pt1.useDVB()==1:
+        if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
+            status.changeBSCSRecording(1)
+        else:
+            status.changeTERecording(1)
+        try:
+            recording_earth_pt1.record(ch,"0",pout,time,0)
+        except Exception, inst:
+            recdblist.addCommonlogEX(u"Error",u"tv2b25ts(tv2ts.py)", str(type(inst)),str(inst))
+        if len(ch) > 2:#BS/CSは100とかCS??とかなので3文字以上
+            status.changeBSCSRecording(-1)
+        else:
+            status.changeTERecording(-1)
 def b252tsmix(pin, pout):
     if not (os.path.exists(pout) and os.path.getsize(pin)>os.path.getsize(pout)*0.95 and os.path.getsize(pin)<os.path.getsize(pout)*1.05):
         exe=""