OSDN Git Service

stop using trunk directory in rectool
[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-2012 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],'tsid':datum[4],'update':datum[5], 'chname':datum[6], 'visible':datum[8]}
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],'tsid':datum[4], 'update':datum[5], 'chname':datum[6], 'visible':datum[8]}
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],'tsid':datum[4], 'update':datum[5], 'chname':datum[6], 'visible':datum[8]}
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],'tsid':datum[4], 'update':datum[5], 'chname':datum[6], 'visible':datum[8]}
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],'tsid':datum[4], 'update':datum[5], 'chname':datum[6], 'visible':datum[8]}
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],'tsid':datum[4], 'update':datum[5], 'chname':datum[6], 'visible':datum[8]}
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     rec10d.rec10db.set_new_status("8")
63     for datum in rec10d.rec10db.select_get_update_epg_ch("6"):
64         bctype = datum[0]
65         if bctype == "cs1" or bctype == u"cs1":
66             if CSupdate == 0:
67                 ret.append(u"cs1")
68                 CSupdate = 1
69         elif bctype == "cs2" or bctype == u"cs2":
70             if CS2update == 0:
71                 ret.append(u"cs2")
72                 CS2update = 1
73         elif bctype == "bs" or bctype == u"bs":
74             if BSupdate == 0:
75                 ret.append(u"bs")
76                 BSupdate = 1
77         else:
78             ret.append(bctype)
79     return ret
80 def changeCHShow(chtxt,isshow):
81     rec10d.rec10db.change_visible_epg_ch(chtxt, isshow)
82 def updateLogo():
83     ret=[]
84     BSCSUpdate=0
85     for datum in rec10d.rec10db.select_get_updatelogo_epg_ch("720"):
86         bctype=datum[0]
87         if bctype == "cs1" or bctype == u"cs1":
88             if BSCSUpdate==0:
89                 ret.append(u"bs")
90                 BSCSUpdate=1
91         elif bctype == "cs2" or bctype == u"cs2":
92             if BSCSUpdate==0:
93                 ret.append(u"bs")
94                 BSCSUpdate=1
95         elif bctype == "bs" or bctype == u"bs":
96             if BSCSUpdate==0:
97                 ret.append(u"bs")
98                 BSCSUpdate=1
99         else:
100             ret.append(bctype)
101     return ret