OSDN Git Service

test auto guess program_number function.
[rec10/rec10-git.git] / rec10 / trunk / src / recdblist.py
1 #!/usr/bin/python
2 # coding: UTF-8
3 # Rec10 TS Recording Tools
4 # Copyright (C) 2009-2010 Yukikaze
5
6 """
7 task names
8 """
9 import os
10 import os.path
11
12 global REC_RESERVE
13 global REC_FINAL_RESERVE
14 global REC_ENCODE_GRID
15 global REC_ENCODE_LOCAL
16 global REC_ENCODE_QUE
17 global REC_MISS_ENCODE
18 global REC_KEYWORD
19 global REC_KEYWORD_EVERY_SOME_DAYS
20 global REC_FIN_LOCAL
21 global REC_MISS_DECODE
22 global REC_TS_DECODE_QUE
23 global REC_TS_DECODING
24 global REC_TS_RECORDING
25 global REC_AVI_TO_MKV
26 global REC_AVI_TO_MP4
27 global REC_MKV_TO_MP4
28 global REC_CHANGING_CANTAINER
29
30 #ここから処理のちに移動
31
32 global REC_MOVE_END
33
34 #ここから自動で提起される処理。
35 global REC_AUTO_SUGGEST_REC
36 global REC_AUTO_SUGGEST_DECODE
37 global REC_AUTO_SUGGEST_ENCODE
38 global REC_AUTO_SUGGEST_AVI2MP4
39 global REC_AUTO_SUGGEST_MKV2MP4
40 global REC_AUTO_SUGGEST_AVI2FP
41 global REC_AUTO_SUGGEST_AP2FP
42 global REC_BAYES_SUGGEST
43 global REC_AUTO_KEYWORD
44 REC_RESERVE = "reserve_flexible"
45 REC_FINAL_RESERVE = "reserve_fixed"
46 REC_ENCODE_GRID = "convert_ts_mp4_network"
47 REC_ENCODE_LOCAL = "convert_ts_mp4_running"
48 REC_ENCODE_QUE = "convert_ts_mp4"
49 REC_MISS_ENCODE = "convert_avi_mp4_miss"
50 REC_KEYWORD = "search_today"
51 REC_KEYWORD_EVERY_SOME_DAYS = "search_everyday"
52 REC_FIN_LOCAL = "convert_ts_mp4_finished"
53 REC_MISS_DECODE = "convert_b25_ts_miss"
54 REC_TS_DECODE_QUE = "convert_b25_ts"
55 REC_TS_DECODING = "convert_b25_ts_running"
56 REC_TS_RECORDING = "reserve_running"
57 REC_CHANGING_CANTAINER = "convert_mkv_mp4_runnings"
58 REC_AVI_TO_MKV = "convert_avi_mkv"
59 REC_AVI_TO_MP4 = "convert_avi_mp4"
60 REC_MKV_TO_MP4 = "convert_mkv_mp4"
61
62 REC_MOVE_END = "move_end"
63
64 REC_AUTO_SUGGEST_REC = "auto_suggest_rec"
65 REC_AUTO_SUGGEST_DECODE = "auto_suggest_dec"
66 REC_AUTO_SUGGEST_ENCODE = "auto_suggest_enc"
67 REC_AUTO_SUGGEST_AVI2FP = "auto_suggest_avi2fp"
68 REC_AUTO_SUGGEST_AP2FP = "auto_suggest_ap2fp"
69 REC_AUTO_KEYWORD = "auto_keyword"
70 REC_BAYES_SUGGEST ="bayes_suggest"
71
72 version = 95
73 def printutf8(unicode):
74     str=unicode.encode('utf-8')
75     print str
76     logfname="/var/log/rec10"
77     mode="a"
78     if os.path.exists(logfname):
79         f=open(logfname,mode)
80         f.write(str+"\n")
81         f.close()
82 def addlog(tspath,txt,log_title):
83     logo=tspath
84     logo=logo.replace("_1.wav",".ts")
85     logo=logo.replace("_2.wav",".ts")
86     logo=logo.replace("_1.aac",".ts")
87     logo=logo.replace("_2.aac",".ts")
88     logo=logo.replace("_1.mp3",".ts")
89     logo=logo.replace("_2.mp3",".ts")
90     logo=logo.replace(".ts.tsmix",".ts")
91     logo=logo.replace(".ts.b25",".ts")
92     logo=logo.replace(".sa.avi",".ts")
93     logo=logo.replace(".m2v",".ts")
94     logo=logo.replace(".avi",".ts")
95     logo=logo.replace(".mkv",".ts")
96     logo=logo.replace(".wav",".ts")
97     logo=logo.replace(".mp4",".ts")
98     logo=logo.replace(".mp3",".ts")
99     logo=logo.replace(".aac",".ts")
100     logo=logo.replace(".srt",".ts")
101     logo=logo.replace(".ts",".log")
102     f=open(logo,'a')
103     s=len(txt)
104     stxt=""
105     if s>1600:
106         stxt=txt[0:800]+"\n\n(ry..)\n"
107         st=txt[s-800:].find("\n")
108         if st>0:
109             stxt=stxt+txt[s-800+st:]
110     else:
111         stxt=txt
112     txtw="\n####"+log_title+"####\n"+stxt
113     f.write(txtw.encode('utf-8'))
114     f.close()