OSDN Git Service

implement Housou University Multi Channel.
[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 ontvsearch(ontvin):
9     ret = []
10     for datum in rec10d.rec10db.select_by_ontv_epg_ch(ontvin):
11         rett = {'bctype':datum[0], 'ontv':datum[1], 'chtxt':datum[2], 'ch':datum[3], 'csch':datum[4], 'update':datum[5]}
12         ret.append(rett)
13     if len(ret) == 0:
14         ret.append(None)
15     return ret[0]
16 def chtxtsearch(chtxtin):
17     ret = []
18     for datum in rec10d.rec10db.select_by_chtxt_epg_ch(chtxtin):
19         rett = {'bctype':datum[0], 'ontv':datum[1], 'chtxt':datum[2], 'ch':datum[3], 'csch':datum[4], 'update':datum[5]}
20         ret.append(rett)
21     if len(ret) == 0:
22         ret.append(None)
23     return ret[0]
24 def bctypesearch(bctypein):
25     ret = []
26     for datum in rec10d.rec10db.select_by_bctype_epg_ch(bctypein):
27         rett = {'bctype':datum[0], 'ontv':datum[1], 'chtxt':datum[2], 'ch':datum[3], 'csch':datum[4], 'update':datum[5]}
28         ret.append(rett)
29     if len(ret) == 0:
30         ret.append(None)
31     return ret[0]
32 def chsearch(chin):
33     ret = []
34     for datum in rec10d.rec10db.select_by_ch_epg_ch(chin):
35         rett = {'bctype':datum[0], 'ontv':datum[1], 'chtxt':datum[2], 'ch':datum[3], 'csch':datum[4], 'update':datum[5]}
36         ret.append(rett)
37     if len(ret) == 0:
38         ret.append(None)
39     return ret[0]
40 def getall():
41     ret = []
42     for datum in rec10d.rec10db.select_all_epg_ch():
43         rett = {'bctype':datum[0], 'ontv':datum[1], 'chtxt':datum[2], 'ch':datum[3], 'csch':datum[4], 'update':datum[5]}
44         ret.append(rett)
45     if len(ret) == 0:
46         ret.append(None)
47     return ret
48 def update():
49     ret = []
50     CSupdate = 0
51     CS2update = 0
52     BSupdate = 0
53     HUupdate = 0
54     rec10d.rec10db.set_new_status("8")
55     for datum in rec10d.rec10db.select_get_update_epg_ch("6"):
56         bctype = datum[0]
57         if bctype == "cs1" or bctype == u"cs1":
58             if CSupdate == 0:
59                 ret.append(u"cs1")
60                 CSupdate = 1
61         elif bctype == "cs2" or bctype == u"cs2":
62             if CS2update == 0:
63                 ret.append(u"cs2")
64                 CS2update = 1
65         elif bctype == "bs" or bctype == u"bs":
66             if BSupdate == 0:
67                 ret.append(u"bs")
68                 BSupdate = 1
69         elif bctype == "hu" or bctype == u"hu":
70             if HUupdate == 0:
71                 ret.append(u"hu")
72                 HUupdate = 1
73         else:
74             ret.append(bctype)
75     return ret