OSDN Git Service

add logo reader.
[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-2011 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], 'chname':datum[5], 'visible':datum[7]}
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], 'chname':datum[5], 'visible':datum[7]}
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], 'chname':datum[5], 'visible':datum[7]}
29         ret.append(rett)
30     if len(ret) == 0:
31         ret.append(None)
32     return ret[0]
33 def searchCHFromCsch(cschin):
34     ret = []
35     for datum in rec10d.rec10db.select_by_csch_epg_ch(cschin):
36         rett = {'bctype':datum[0], 'chtxt':datum[1], 'ch':datum[2], 'csch':datum[3], 'update':datum[4], 'chname':datum[5], 'visible':datum[7]}
37         ret.append(rett)
38     if len(ret) == 0:
39         ret.append(None)
40     return ret[0]
41 def searchAllCHFromCh(chin):
42     ret = []
43     for datum in rec10d.rec10db.select_by_ch_epg_ch(chin):
44         rett = {'bctype':datum[0], 'chtxt':datum[1], 'ch':datum[2], 'csch':datum[3], 'update':datum[4], 'chname':datum[5], 'visible':datum[7]}
45         ret.append(rett)
46     if len(ret) == 0:
47         ret.append(None)
48     return ret
49 def getAllCH():
50     ret = []
51     for datum in rec10d.rec10db.select_all_epg_ch():
52         rett = {'bctype':datum[0], 'chtxt':datum[1], 'ch':datum[2], 'csch':datum[3], 'update':datum[4], 'chname':datum[5], 'visible':datum[7]}
53         ret.append(rett)
54     if len(ret) == 0:
55         ret.append(None)
56     return ret
57 def update():
58     ret = []
59     CSupdate = 0
60     CS2update = 0
61     BSupdate = 0
62     HUupdate = 0
63     rec10d.rec10db.set_new_status("8")
64     for datum in rec10d.rec10db.select_get_update_epg_ch("6"):
65         bctype = datum[0]
66         if bctype == "cs1" or bctype == u"cs1":
67             if CSupdate == 0:
68                 ret.append(u"cs1")
69                 CSupdate = 1
70         elif bctype == "cs2" or bctype == u"cs2":
71             if CS2update == 0:
72                 ret.append(u"cs2")
73                 CS2update = 1
74         elif bctype == "bs" or bctype == u"bs":
75             if BSupdate == 0:
76                 ret.append(u"bs")
77                 BSupdate = 1
78         else:
79             ret.append(bctype)
80     return ret
81 def changeCHShow(chtxt,isshow):
82     rec10d.rec10db.change_visible_epg_ch(chtxt, isshow)