OSDN Git Service

simplize some src.
authorgn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Sat, 22 Aug 2009 09:42:05 +0000 (09:42 +0000)
committergn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Sat, 22 Aug 2009 09:42:05 +0000 (09:42 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/rec10@124 4e526526-5e11-4fc0-8910-f8fd03428081

rec10/trunk/src/chdata.py
rec10/trunk/src/dbMySQL.py
rec10/trunk/src/dbSQLite.py
rec10/trunk/src/epgdb.py
rec10/trunk/src/timerec.py
rec10/trunk/src/ts2x264.py
rec10/trunk/src/ts2xvid.py
rec10/trunk/src/tv2avi.py

index ed8cb93..87bc2ed 100644 (file)
@@ -24,8 +24,6 @@ def chadd(bctype, ontv, chtxt, ch, csch, station, station_name):#すべて文字
     ustaname=unicode(station_name)
     rec10d.rec10db.add_chdata(ubct,uontv,uchtxt,uch,ucsch,ustation,ustaname,u"2009-04-01 00:00:00")
     
-#db.commit
-
 #チャンネルの設定
 #chadd('放送種別','ontvコード(ontvのサイトなどで調べられる)','略称(何でもよい)','チャンネル(物理チャンネル)','CS放送の場合の内訳','iEPGデジタルのstation','iEPGのstation')
 #iEPGDigitalはテレビ王国のサイトでiEPGはサイトによってまちまちのようなので自分の使うサイトに即したものにしてください
index a3dc998..244287e 100644 (file)
@@ -222,24 +222,8 @@ class DB_MySQL:
         db[1].executemany('INSERT IGNORE INTO tv (bctype,channel,start,stop,title,exp) values(%s,%s,%s,%s,%s,%s)', tvlists)
         #db.commit()
         self.close_db(db)
-    def select_by_title_tv(self,title):
-        db=self.connect_db()
-        ret=[]
-        dbr=db[1].execute("SELECT channel,title,start,stop FROM tv WHERE title LIKE \"%"+titletxt+"%\"")
-        dbl=db[1].fetchall()
-        self.close_db(db)
-        if dbr>0:
-            for ch, title, start, stop in dbl:
-                btime=start.replace(" +0900","")
-                btime=btime[0:4]+"-"+btime[4:6]+"-"+btime[6:8]+" "+btime[8:10]+":"+btime[10:12]+":00"
-                etime=stop.replace(" +0900","")
-                etime=etime[0:4]+"-"+etime[4:6]+"-"+etime[6:8]+" "+etime[8:10]+":"+etime[10:12]+":00"
-                try:
-                    chtxt=chdb.ontvsearch(ch)['chtxt']
-                except:
-                    chtxt="Unknown"
-                ret.append(chtxt+","+title.encode('utf-8')+","+btime+","+etime)
-        return ret
+        
+
     def select_by_time_ngram_tv(self,btime,etime,chtxt):
         db=self.connect_db()
         dbexe="SELECT chdata.chtxt,title,start,stop FROM tv INNER JOIN chdata WHERE chdata.ontv=tv.channel AND start >= %s AND start <= %s AND chdata.chtxt=%s"
@@ -278,4 +262,22 @@ class DB_MySQL:
         dbl=dbb.select_all_rectime()
         for db in dbl:
             self.add_rectime(db['type'],db['chtxt'],db['title'],db['btime'],db['etime'],db['deltatime'],db['deltaday'],db['opt'])
-        
\ No newline at end of file
+
+"""    def select_by_title_tv(self,title):
+        db=self.connect_db()
+        ret=[]
+        dbr=db[1].execute("SELECT channel,title,start,stop FROM tv WHERE title LIKE \"%"+titletxt+"%\"")
+        dbl=db[1].fetchall()
+        self.close_db(db)
+        if dbr>0:
+            for ch, title, start, stop in dbl:
+                btime=start.replace(" +0900","")
+                btime=btime[0:4]+"-"+btime[4:6]+"-"+btime[6:8]+" "+btime[8:10]+":"+btime[10:12]+":00"
+                etime=stop.replace(" +0900","")
+                etime=etime[0:4]+"-"+etime[4:6]+"-"+etime[6:8]+" "+etime[8:10]+":"+etime[10:12]+":00"
+                try:
+                    chtxt=chdb.ontvsearch(ch)['chtxt']
+                except:
+                    chtxt="Unknown"
+                ret.append(chtxt+","+title.encode('utf-8')+","+btime+","+etime)
+        return ret"""
\ No newline at end of file
index 2d0ec15..1773e5d 100644 (file)
@@ -183,21 +183,6 @@ class DB_SQLite:
         db.executemany('INSERT OR IGNORE INTO tv (bctype,channel,start,stop,title,exp) values (?,?,?,?,?,?)', tvlists)
         db.commit()
         self.close_db(db)
-    def select_by_title_tv(self,title):
-        db=self.connect_db(480)
-        ret=[]
-        for ch, title, start, stop in db.execute("SELECT channel,title,start,stop FROM tv WHERE title LIKE \"%"+titletxt+"%\""):
-            btime=start.replace(" +0900","")
-            btime=btime[0:4]+"-"+btime[4:6]+"-"+btime[6:8]+" "+btime[8:10]+":"+btime[10:12]+":00"
-            etime=stop.replace(" +0900","")
-            etime=etime[0:4]+"-"+etime[4:6]+"-"+etime[6:8]+" "+etime[8:10]+":"+etime[10:12]+":00"
-            try:
-                chtxt=chdb.ontvsearch(ch)['chtxt']
-            except:
-                chtxt="Unknown"
-            ret.append(chtxt+","+title.encode('utf-8')+","+btime+","+etime)
-        self.close_db(db)
-        return ret
     def select_by_time_ngram_tv(self,btime,etime,chtxt):
         db=self.connect_db(480)
         dbexe="SELECT chdata.chtxt,title,start,stop FROM tv INNER JOIN chdata WHERE chdata.ontv=tv.channel AND start >= ? AND start <= ? AND chdata.chtxt=?"
@@ -230,3 +215,19 @@ class DB_SQLite:
         db.executemany('INSERT OR IGNORE INTO ch values (?,?,?)', chlists)
         db.commit()
         self.close_db(db)
+"""    def select_by_title_tv(self,title):
+        db=self.connect_db(480)
+        ret=[]
+        for ch, title, start, stop in db.execute("SELECT channel,title,start,stop FROM tv WHERE title LIKE \"%"+titletxt+"%\""):
+            btime=start.replace(" +0900","")
+            btime=btime[0:4]+"-"+btime[4:6]+"-"+btime[6:8]+" "+btime[8:10]+":"+btime[10:12]+":00"
+            etime=stop.replace(" +0900","")
+            etime=etime[0:4]+"-"+etime[4:6]+"-"+etime[6:8]+" "+etime[8:10]+":"+etime[10:12]+":00"
+            try:
+                chtxt=chdb.ontvsearch(ch)['chtxt']
+            except:
+                chtxt="Unknown"
+            ret.append(chtxt+","+title.encode('utf-8')+","+btime+","+etime)
+        self.close_db(db)
+        return ret
+"""
\ No newline at end of file
index be00a3c..9aad83f 100644 (file)
@@ -68,8 +68,8 @@ def updateall():
     updatebc("cs1")
     updatebc("cs2")
     updatebc("bs")
-def search(titletxt):
-    return rec10d.rec10db.select_by_title_tv(titletxt)
+#def search(titletxt):
+##   return rec10d.rec10db.select_by_title_tv(titletxt)
 def searchtime2(titletxt,timet,deltatime,chtxt):
     time=datetime.datetime.strptime(timet,"%Y-%m-%d %H:%M:%S")
     ret=[]
index 4d02640..b9e5a6d 100644 (file)
@@ -30,7 +30,6 @@ def task():
     if inum+status.getBSCSRecording()+status.getTERecording() < 2:
         update=chdb.update()
         #print "番組表更新処理"
-        
         if len(update)>0 and status.getEPGUpdating()==0:
             status.setEPGUpdating(1)
             print "番組表を更新"
index 107d767..3bf693b 100644 (file)
@@ -15,12 +15,9 @@ def ts2x264(pin,pout,opts):#sizeは"HD"か"SD"
     """
     isAnime=0
     size="SD"
-    isDualsep=0
     if re.search("a",opts):
         isAnime=1
         #print "isAnime"
-    if re.search("X",opts):
-        isDualsep=1
     dualpass=0
     if re.search("2",opts):
         dualpass=1
@@ -51,13 +48,6 @@ def ts2x264(pin,pout,opts):#sizeは"HD"か"SD"
     else:
         encvf=encvf+"scale=1280:720,harddup"
         bitrate="bitrate="+tv2avi.Bitrate_HD
-    if isDualsep==1:
-        #pas="mencoder \'"+pin+"\' -quiet -novideo -aid 2 -dumpaudio -dumpfile \'"+pin+"sepaudio"+"\'"
-        #pas="mplayer -aid 2 -dumpaudio -dumpfile \'"+pin+"sepaudio"+"\'"+" \'"+pin+"\'"
-        #print pas
-        #os.system(pas)
-        #commands.getoutput(pas)
-        encvf=encvf+" -aid 1 -audiofile \'"+pin+"addaudio.wav"
     if dualpass==1:
         pas1exe="mencoder \'"+pin+"\' -quiet -ovc x264 "+encvf+" -x264encopts "+bitrate+":threads=auto:pass=1:turbo=2 -passlogfile \'"+pin+".log\' "+"-oac mp3lame -lameopts cbr:br=128 -o /dev/null"
         pas2exe="mencoder \'"+pin+"\' -quiet -ovc x264 "+encvf+" -x264encopts "+bitrate+":threads=auto:pass=2 -passlogfile \'"+pin+".log\' "+"-oac mp3lame -lameopts cbr:br=128 -o \'"+pout+"\'"
index 0a9a2fd..37ad146 100644 (file)
@@ -47,7 +47,6 @@ def ts2xvid(pin,pout,opts):#sizeは"HD"か"SD"
     else:
         encvf=encvf+"scale=1280:720,harddup"
         bitrate="bitrate="+tv2avi.Bitrate_HD
-
     if dualpass==1:
         pas1exe="mencoder \'"+pin+"\' -ovc xvid "+encvf+" -xvidencopts "+bitrate+":threads=2:pass=1:turbo -passlogfile \'"+pin+".log\' "+"-oac mp3lame -lameopts cbr:br=128 -o /dev/null"
         pas2exe="mencoder \'"+pin+"\' -ovc xvid "+encvf+" -xvidencopts "+bitrate+":threads=2:pass=2 -passlogfile \'"+pin+".log\' "+"-oac mp3lame -lameopts cbr:br=128 -o \'"+pout+"\'"
index 004cfdf..283984b 100644 (file)
@@ -13,7 +13,6 @@ import re
 import ts2x264
 import ts2xvid
 import tv2ts
-import recdb
 import commands
 global Bitrate_HD
 global Bitrate_FHD
@@ -263,11 +262,8 @@ def dualaudio2sep(pin,pout,delay):
     exe = wine+' ' + bontsdemux + " -i \"" + bonpin + "\" -delay "+delay+" -nd -sound 1 -o \"" + bonpout + "\" -start -quit"
     #print exe
     exe = xvfb+' -a ' + exe
-    #exe = 'xvfb-run -a -e xvfberror.txt ' + exe
-    #exe='export Display=:2&&'+exe
     print exe
     commands.getoutput(exe)
-    #os.system(exe)
     ffpin=pin.replace(".ts","")
     ffpin1 = pin.replace("ts", "wav")
     ffpin2 = pin.replace("ts", "m2v")