OSDN Git Service

sys.setdefaultencoding('UTF-8') required version.
[rec10/rec10-git.git] / rec10 / branches / 0.9.0 / src / missed.py
1 #!/usr/bin/python
2 # coding: UTF-8
3 # Rec10 TS Recording Tools
4 # Copyright (C) 2009 Yukikaze
5 import glob
6 import os
7 import time
8
9 import configreader
10 dbpath = str(os.path.dirname(os.path.abspath(__file__))) + "/" + "ch.db"
11 if __name__ == "__main__":
12     print "Hello Rec10 Recording Que Search.";
13 def search_b25(path):
14     """
15     録画フォルダを検索し、各QUEの実行状況を表示する
16     """
17     b25list = glob.glob(path + "/*.b25")
18     for b25f in b25list:
19         ##b25f is title.ts.b25  avi is title.avi
20         dir = os.path.split(b25f)[0]
21         title = os.path.split(b25f)[1]
22         title = title.replace(".ts.b25", "")
23         avipath = os.path.join(dir, title + ".avi")
24         tspath = os.path.join(dir, title + ".ts")
25         b25f = b25f.replace(".ts.b25", ".avi")
26         mode = "ts"
27         if os.path.isfile(tspath):##tsファイルが存在している
28             dtime = time.time()-os.path.getmtime(tspath)
29             dtime = int(dtime)
30             if dtime > 120:
31                 if os.path.getsize(tspath) > 1 * 1000 * 1000:##最終更新から22分以上経過かつ1MB以上
32                     mode = "avi"
33                 else:
34                     mode = "tsmiss"
35             else:
36                 mode = "ts"
37         if os.path.isfile(avipath):##tsファイルが存在している
38             dtime = time.time()-os.path.getmtime(avipath)
39             dtime = int(dtime)
40             if dtime > 120:
41                 if os.path.getsize(avipath) > 1 * 1000 * 1000:##最終更新から22分以上経過かつ1MB以上
42                     mode = "fin"
43                 else:
44                     mode = "avimiss"
45             else:
46                 mode = "avi"
47         print title + ":" + mode
48
49 path = configreader.getpath("recpath")
50 search_b25(path)
51