OSDN Git Service

scan purchased.
[rec10/rec10-git.git] / rec10 / trunk / src / chdb.py
1 #!/usr/bin/python
2 # coding: UTF-8
3 # Rec10 TS Recording Tools
4 # Copyright (C) 2009-2010 Yukikaze
5     # モジュール属性 argv を取得するため
6 import rec10d
7
8 def searchCHFromChtxt(chtxtin):
9     chtxtt=chtxtin.replace("_0","_%")
10     ret = []
11     for datum in rec10d.rec10db.select_by_chtxt_epg_ch(chtxtt):
12         rett = {'bctype':datum[0], 'chtxt':datum[1], 'ch':datum[2], 'csch':datum[3], 'update':datum[4]}
13         ret.append(rett)
14     if len(ret) == 0:
15         ret.append(None)
16     return ret[0]
17 def searchCHFromBctype(bctypein):
18     ret = []
19     for datum in rec10d.rec10db.select_by_bctype_epg_ch(bctypein):
20         rett = {'bctype':datum[0], 'chtxt':datum[1], 'ch':datum[2], 'csch':datum[3], 'update':datum[4]}
21         ret.append(rett)
22     if len(ret) == 0:
23         ret.append(None)
24     return ret[0]
25 def searchCHFromCh(chin):
26     ret = []
27     for datum in rec10d.rec10db.select_by_ch_epg_ch(chin):
28         rett = {'bctype':datum[0], 'chtxt':datum[1], 'ch':datum[2], 'csch':datum[3], 'update':datum[4]}
29         ret.append(rett)
30     if len(ret) == 0:
31         ret.append(None)
32     return ret[0]
33 def searchAllCHFromCh(chin):
34     ret = []
35     for datum in rec10d.rec10db.select_by_ch_epg_ch(chin):
36         rett = {'bctype':datum[0], 'chtxt':datum[1], 'ch':datum[2], 'csch':datum[3], 'update':datum[4]}
37         ret.append(rett)
38     if len(ret) == 0:
39         ret.append(None)
40     return ret
41 def getAllCH():
42     ret = []
43     for datum in rec10d.rec10db.select_all_epg_ch():
44         rett = {'bctype':datum[0], 'chtxt':datum[1], 'ch':datum[2], 'csch':datum[3], 'update':datum[4]}
45         ret.append(rett)
46     if len(ret) == 0:
47         ret.append(None)
48     return ret
49 def update():
50     ret = []
51     CSupdate = 0
52     CS2update = 0
53     BSupdate = 0
54     HUupdate = 0
55     rec10d.rec10db.set_new_status("8")
56     for datum in rec10d.rec10db.select_get_update_epg_ch("6"):
57         bctype = datum[0]
58         if bctype == "cs1" or bctype == u"cs1":
59             if CSupdate == 0:
60                 ret.append(u"cs1")
61                 CSupdate = 1
62         elif bctype == "cs2" or bctype == u"cs2":
63             if CS2update == 0:
64                 ret.append(u"cs2")
65                 CS2update = 1
66         elif bctype == "bs" or bctype == u"bs":
67             if BSupdate == 0:
68                 ret.append(u"bs")
69                 BSupdate = 1
70         else:
71             ret.append(bctype)
72     return ret
73 def changeCHShow(chtxt,isshow):
74     rec10d.rec10db.change_isshow_epg_ch(chtxt, isshow)