OSDN Git Service

implement zip compress logging.
authorgn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Mon, 24 Jan 2011 02:21:16 +0000 (02:21 +0000)
committergn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Mon, 24 Jan 2011 02:21:16 +0000 (02:21 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/rec10@810 4e526526-5e11-4fc0-8910-f8fd03428081

rec10/trunk/src/chdb.py
rec10/trunk/src/dbMySQL.py
rec10/trunk/src/recdblist.py
rec10/trunk/src/ts2x264.py
rec10/trunk/src/xml2db_dom.py
rec10/trunk/src/zip.py

index dc55259..1503f5a 100644 (file)
@@ -9,7 +9,7 @@ def searchCHFromChtxt(chtxtin):
     chtxtt=chtxtin.replace("_0","_%")
     ret = []
     for datum in rec10d.rec10db.select_by_chtxt_epg_ch(chtxtt):
-        rett = {'bctype':datum[0], 'chtxt':datum[1], 'ch':datum[2], 'csch':datum[3], 'update':datum[4]}
+        rett = {'bctype':datum[0], 'chtxt':datum[1], 'ch':datum[2], 'csch':datum[3], 'update':datum[4], 'chname':datum[5], 'visible':datum[7]}
         ret.append(rett)
     if len(ret) == 0:
         ret.append(None)
@@ -17,7 +17,7 @@ def searchCHFromChtxt(chtxtin):
 def searchCHFromBctype(bctypein):
     ret = []
     for datum in rec10d.rec10db.select_by_bctype_epg_ch(bctypein):
-        rett = {'bctype':datum[0], 'chtxt':datum[1], 'ch':datum[2], 'csch':datum[3], 'update':datum[4]}
+        rett = {'bctype':datum[0], 'chtxt':datum[1], 'ch':datum[2], 'csch':datum[3], 'update':datum[4], 'chname':datum[5], 'visible':datum[7]}
         ret.append(rett)
     if len(ret) == 0:
         ret.append(None)
@@ -25,7 +25,7 @@ def searchCHFromBctype(bctypein):
 def searchCHFromCh(chin):
     ret = []
     for datum in rec10d.rec10db.select_by_ch_epg_ch(chin):
-        rett = {'bctype':datum[0], 'chtxt':datum[1], 'ch':datum[2], 'csch':datum[3], 'update':datum[4]}
+        rett = {'bctype':datum[0], 'chtxt':datum[1], 'ch':datum[2], 'csch':datum[3], 'update':datum[4], 'chname':datum[5], 'visible':datum[7]}
         ret.append(rett)
     if len(ret) == 0:
         ret.append(None)
@@ -33,7 +33,7 @@ def searchCHFromCh(chin):
 def searchAllCHFromCh(chin):
     ret = []
     for datum in rec10d.rec10db.select_by_ch_epg_ch(chin):
-        rett = {'bctype':datum[0], 'chtxt':datum[1], 'ch':datum[2], 'csch':datum[3], 'update':datum[4]}
+        rett = {'bctype':datum[0], 'chtxt':datum[1], 'ch':datum[2], 'csch':datum[3], 'update':datum[4], 'chname':datum[5], 'visible':datum[7]}
         ret.append(rett)
     if len(ret) == 0:
         ret.append(None)
@@ -41,7 +41,7 @@ def searchAllCHFromCh(chin):
 def getAllCH():
     ret = []
     for datum in rec10d.rec10db.select_all_epg_ch():
-        rett = {'bctype':datum[0], 'chtxt':datum[1], 'ch':datum[2], 'csch':datum[3], 'update':datum[4]}
+        rett = {'bctype':datum[0], 'chtxt':datum[1], 'ch':datum[2], 'csch':datum[3], 'update':datum[4], 'chname':datum[5], 'visible':datum[7]}
         ret.append(rett)
     if len(ret) == 0:
         ret.append(None)
index 621523f..51b1967 100644 (file)
@@ -117,7 +117,7 @@ class DB_MySQL:
     def select_by_chtxt_epg_ch(self, chtxt):
         db = self.connect_db()
         dbexe = db[1].execute("\
-        SELECT bctype,chtxt,ch,csch,updatetime \
+        SELECT bctype,chtxt,ch,csch,updatetime,chname,status,visible \
         FROM epg_ch \
         WHERE chtxt LIKE %s", \
                               (chtxt,))
@@ -134,7 +134,7 @@ class DB_MySQL:
     def select_by_bctype_epg_ch(self, bctype):
         db = self.connect_db()
         dbexe = db[1].execute("\
-        SELECT bctype,chtxt,ch,csch,updatetime,status \
+        SELECT bctype,chtxt,ch,csch,updatetime,status,chname,status,visible \
         FROM epg_ch \
         WHERE bctype = %s", \
                               (bctype,))
@@ -154,7 +154,7 @@ class DB_MySQL:
         db = self.connect_db()
         dbexe = db[1].execute("\
         SELECT \
-        bctype,chtxt,ch,csch,updatetime \
+        bctype,chtxt,ch,csch,updatetime,chname,status,visible \
         FROM epg_ch \
         WHERE ch = %s", \
                               (ch,))
@@ -171,7 +171,7 @@ class DB_MySQL:
     def select_all_epg_ch(self):
         db = self.connect_db()
         dbexe = db[1].execute("\
-        SELECT bctype,chtxt,ch,csch,updatetime \
+        SELECT bctype,chtxt,ch,csch,updatetime,chname,status,visible \
         FROM epg_ch \
         ")
         ret = []
@@ -941,6 +941,8 @@ class DB_MySQL:
         INNER JOIN epg_ch \
         WHERE epg_ch.chtxt=epg_timeline.channel \
         AND \
+        epg_ch.visible=1 \
+        AND \
         start >= %s \
         AND \
         stop <= %s \
index c758704..4b277b4 100644 (file)
@@ -135,16 +135,13 @@ def addCommandLogZip(tspath,log_title,log_filename_add,cmd,cmd_log=""):
     os.remove(logo)\r
 def addCommandSelfLog(tspath,command):\r
     logpath=getLogTitle(tspath)+".command.log"\r
-    print logpath\r
     f=""\r
     if os.path.exists(logpath):\r
         f=open(logpath,'a')\r
     else:\r
         f=open(logpath,'w')\r
-    print "test4"\r
     tc=command+u"\n\n"\r
-    print tc\r
-    f.write(tc.encode('utf-8'),"ignore")\r
+    f.write(tc.encode('utf-8','ignore'))\r
     f.close()\r
 def getLogTitle(tspath):\r
     logo=tspath\r
index 409dcb5..a409fc6 100644 (file)
@@ -176,7 +176,7 @@ def encodeMencoderSar(pin,pout,size,is24fps,quality,crf,deinterlace=1):
     unicode(commands.getoutput(u"mkfifo "+streampath),'utf-8','ignore')\r
     logmencoder=recdblist.getLogTitle(pin)+".mencoder.log"\r
     logx264=recdblist.getLogTitle(pin)+".x264.log"\r
-    encexe=mencoder+u" \""+pin+u"\" -vfm ffmpeg "+encvf+u",format=i420 "+fps+" "+ofps+" -oac mp3lame -ovc raw -of rawvideo -o \""+streampath+"\" 2>&1 | "+tee+" \""+logmencoder+"\" & "\r
+    encexe=mencoder+u" \""+pin+u"\" -quiet -vfm ffmpeg "+encvf+u",format=i420 "+fps+" "+ofps+" -oac mp3lame -ovc raw -of rawvideo -o \""+streampath+"\" 2>&1 | "+tee+" \""+logmencoder+"\" & "\r
     encexe=encexe+getX264Commandline(x264preset, x264sar, x264fps, x264profile, x264tune, pout, streampath, x264streamsize, crf=x264crf)\r
     #encexe=encexe+u" nice -n 19 "+x264+" "+x264_sar+" "+x264crf+u" "+x264_addline+u"  --threads "+x264_thread+" "+x264profile+x264preset+" "+x264tune+" "+x264fps+" -o \""+pout+"\" "+streampath+" "+x264streamsize\r
     encexe=u"nice -n 19 " +encexe+" 2>&1 | "+tee+" \""+logx264+"\""\r
@@ -285,20 +285,17 @@ def encodeFfmpegSar(pin,pout,size,is24fps,quality,crf,deinterlace=1):
     exe=exe+getX264Commandline(x264preset, x264sar, x264fps, x264profile, x264tune, pout,"-", x264streamsize, crf=x264crf)\r
     exe = "nice -n 19 " + exe+" 2>&1 | "+tee+" \""+log_x264+"\""\r
     txt=""\r
-    print "test"\r
     #recdblist.addCommandSelfLog(log_ffmpeg,recdblist.getLogTitle(pin)+".log.zip")\r
     #recdblist.addCommandSelfLog(log_x264,recdblist.getLogTitle(pin)+".log.zip")\r
     recdblist.printutf8(exe)\r
-    print exe\r
-    recdblist.addCommandSelfLog(tspath,exe)\r
-    print "test2"\r
+    recdblist.addCommandSelfLog(pin,exe)\r
     try:\r
         txt=unicode(commands.getoutput(exe.encode('utf-8')),'utf-8','ignore')\r
     except:\r
         ""\r
     recdblist.addCommandLog(pin, u"FFmpeg動画エンコード", exe, txt)\r
-    zip.addFile2FileZip(log_ffmpeg, recdblist.getLogTitle(tspath+".log.zip"))\r
-    zip.addFile2FileZip(log_x264, recdblist.getLogTitle(tspath+".log.zip"))\r
+    zip.addFile2FileZip(log_ffmpeg, recdblist.getLogTitle(pin+".log.zip"))\r
+    zip.addFile2FileZip(log_x264, recdblist.getLogTitle(pin+".log.zip"))\r
     os.remove(log_ffmpeg)\r
     os.remove(log_x264)\r
 def getMovieBaseSize(pin):\r
index 29d30d8..0b0374e 100644 (file)
@@ -60,7 +60,7 @@ def xml2db_dom(xmlpath, bctype):#bctypeは放送種別で'TE'(地デジ)BS,CSが
         title=addTitle_Subtitle(rHisch,1,title,desc)\r
         tch=chdb.searchCHFromChtxt(channel)\r
         if tch!=None:\r
-            if tch.get('bctype',"")==bctype:\r
+            if tch.get('bctype',"")==bctype and not tch['visible']==0:\r
                 bt=bayes.get(tch['chtxt'],["","",0])\r
                 bt2=[bt[0]+title+" ",bt[1]+desc+" "+longdesc+" ",bt[2]+1]\r
                 bayes[tch['chtxt']]=bt2\r
index 9fef0bf..61d76d1 100644 (file)
@@ -11,7 +11,7 @@ def addFile2FileZip(addfile,basefile):
     th=0
 
     if os.path.exists(basefile):
-        th=zipfile.ZipFile(basefile,'a')
+        th=zipfile.ZipFile(basefile,'a',zipfile.ZIP_DEFLATED)
     else:
         th=zipfile.ZipFile(basefile,'w')
     if os.path.exists(addfile):