OSDN Git Service

test auto guess program_number function.
[rec10/rec10-git.git] / rec10 / trunk / src / recdblist.py
index 6a93f9e..50b3cd2 100644 (file)
@@ -1,11 +1,14 @@
 #!/usr/bin/python
 # coding: UTF-8
 # Rec10 TS Recording Tools
-# Copyright (C) 2009 Yukikaze
+# Copyright (C) 2009-2010 Yukikaze
 
 """
 task names
 """
+import os
+import os.path
+
 global REC_RESERVE
 global REC_FINAL_RESERVE
 global REC_ENCODE_GRID
@@ -34,6 +37,8 @@ global REC_AUTO_SUGGEST_DECODE
 global REC_AUTO_SUGGEST_ENCODE
 global REC_AUTO_SUGGEST_AVI2MP4
 global REC_AUTO_SUGGEST_MKV2MP4
+global REC_AUTO_SUGGEST_AVI2FP
+global REC_AUTO_SUGGEST_AP2FP
 global REC_BAYES_SUGGEST
 global REC_AUTO_KEYWORD
 REC_RESERVE = "reserve_flexible"
@@ -59,10 +64,51 @@ REC_MOVE_END = "move_end"
 REC_AUTO_SUGGEST_REC = "auto_suggest_rec"
 REC_AUTO_SUGGEST_DECODE = "auto_suggest_dec"
 REC_AUTO_SUGGEST_ENCODE = "auto_suggest_enc"
-REC_AUTO_SUGGEST_AVI2MP4 = "auto_suggest_a24"
-REC_AUTO_SUGGEST_MKV2MP4 = "auto_suggest_m24"
+REC_AUTO_SUGGEST_AVI2FP = "auto_suggest_avi2fp"
+REC_AUTO_SUGGEST_AP2FP = "auto_suggest_ap2fp"
 REC_AUTO_KEYWORD = "auto_keyword"
 REC_BAYES_SUGGEST ="bayes_suggest"
 
+version = 95
 def printutf8(unicode):
-    print unicode.encode('utf-8')
\ No newline at end of file
+    str=unicode.encode('utf-8')
+    print str
+    logfname="/var/log/rec10"
+    mode="a"
+    if os.path.exists(logfname):
+        f=open(logfname,mode)
+        f.write(str+"\n")
+        f.close()
+def addlog(tspath,txt,log_title):
+    logo=tspath
+    logo=logo.replace("_1.wav",".ts")
+    logo=logo.replace("_2.wav",".ts")
+    logo=logo.replace("_1.aac",".ts")
+    logo=logo.replace("_2.aac",".ts")
+    logo=logo.replace("_1.mp3",".ts")
+    logo=logo.replace("_2.mp3",".ts")
+    logo=logo.replace(".ts.tsmix",".ts")
+    logo=logo.replace(".ts.b25",".ts")
+    logo=logo.replace(".sa.avi",".ts")
+    logo=logo.replace(".m2v",".ts")
+    logo=logo.replace(".avi",".ts")
+    logo=logo.replace(".mkv",".ts")
+    logo=logo.replace(".wav",".ts")
+    logo=logo.replace(".mp4",".ts")
+    logo=logo.replace(".mp3",".ts")
+    logo=logo.replace(".aac",".ts")
+    logo=logo.replace(".srt",".ts")
+    logo=logo.replace(".ts",".log")
+    f=open(logo,'a')
+    s=len(txt)
+    stxt=""
+    if s>1600:
+        stxt=txt[0:800]+"\n\n(ry..)\n"
+        st=txt[s-800:].find("\n")
+        if st>0:
+            stxt=stxt+txt[s-800+st:]
+    else:
+        stxt=txt
+    txtw="\n####"+log_title+"####\n"+stxt
+    f.write(txtw.encode('utf-8'))
+    f.close()
\ No newline at end of file