#chadd('放送種別','ontvコード(ontvのサイトなどで調べられる)','略称(何でもよい)','チャンネル(物理チャンネル)','CS放送の場合の内訳')
#地上波の設定 東京都(筆者は東京で受信していないため正しいかどうか分かりません)
-#chadd('te26', '0442.ontvjapan.com', 'nhk-k', '26', '0')
-#chadd('te27', '0432.ontvjapan.com', 'nhk-s', '27', '0')
-#chadd('te25', '0404.ontvjapan.com', 'nittere', '25', '0')
-#chadd('te22', '0405.ontvjapan.com', 'tbs', '22', '0')
-#chadd('te23', '0406.ontvjapan.com', 'tokyo', '23', '0')
-#chadd('te21', '0407.ontvjapan.com', 'fuji', '21', '0')
-#chadd('te24', '0420.ontvjapan.com', 'asahi', '24', '0')
-#chadd('te20', '0420.ontvjapan.com', 'tokyomx', '20', '0')#よくわかりません
-#
+#chadd('te27', '0031.ontvjapan.com', 'nhk-s', '27', '0')
+#chadd('te26', '0041.ontvjapan.com', 'nhk-k', '26', '0')
+#chadd('te25', '0004.ontvjapan.com', 'nittere', '25', '0')
+#chadd('te22', '0005.ontvjapan.com', 'tbs', '22', '0')
+#chadd('te21', '0006.ontvjapan.com', 'fuji', '21', '0')
+#chadd('te24', '0007.ontvjapan.com', 'asahi', '24', '0')
+#chadd('te23', '0008.ontvjapan.com', 'tokyo', '23', '0')
+##chadd('te', '0009.ontvjapan.com', 'tvk', '', '0')
+##chadd('te', '0010.ontvjapan.com', 'chiba', '', '0')
+##chadd('te', '0011.ontvjapan.com', 'gunma', '', '0')
+##chadd('te', '0012.ontvjapan.com', 'tama', '', '0')
+#chadd('te28', '0013.ontvjapan.com', 'housou', '28', '0')
+#chadd('te20', '0016.ontvjapan.com', 'mxtv', '20', '0')
+##chadd('te', '0018.ontvjapan.com', 'tochigi', '', '0')
#地上波の設定 愛知県向け
chadd('te13', '0442.ontvjapan.com', 'nhk-k', '13', '0')
chadd('te20', '0432.ontvjapan.com', 'nhk-s', '20', '0')
add_rec_num=str(add_rec_num)
add_all_num=str(add_all_num)
db[1].execute("\
- UPDATE bayeskey SET ratio_rec=ratio_rec+%s,ratio_all=ratio_all+%s WHERE keychar=\"NUM\" AND chtxt=%s",\
+ UPDATE bayeskey SET ratio_rec=CONVERT(ratio_rec+%s,DECIMAL(32,14)),ratio_all=CONVERT(ratio_all+%s,DECIMAL(32,14)) WHERE keychar=\"NUM\" AND chtxt=%s",\
(add_rec_num,add_all_num,chtxt))
self.close_db(db)
def change_bayeskey(self,key,chtxt,new_ratio_rec,new_ratio_all):
newnum=str(newnum)
db = self.connect_db()
db[1].execute("\
- UPDATE bayeskey SET ratio_all=ratio_all*%s/(%s+%s) WHERE chtxt=%s AND NOT (keychar=\"NUM\")",(beforenum,newnum,beforenum,chtxt)\
+ UPDATE bayeskey SET ratio_all=CONVERT(ratio_all*%s/(%s+%s),DECIMAL(32,14)) WHERE chtxt=%s AND NOT (keychar=\"NUM\")",(beforenum,newnum,beforenum,chtxt)\
)
self.close_db(db)
def change_ratio_all_bayeskey(self,key,chtxt,beforenum,addnum):
db[1].execute("INSERT INTO bayeskey (keychar,chtxt,ratio_rec,ratio_all) \
VALUES (%s,%s,%s,%s)\
ON DUPLICATE KEY UPDATE \
- ratio_all=(ratio_all*%s+%s)/%s",(key,chtxt,"0",str(Decimal(addnum)/beforenumf),beforenum,chtxt,key))
+ ratio_all=CONVERT((ratio_all*%s+%s)/%s,DECIMAL(32,14))",(key,chtxt,"0",str(Decimal(addnum)/beforenumf),beforenum,chtxt,key))
self.close_db(db)
def change_multi_ratio_all_bayeskey(self,chtxt,beforenum,list):
"""
db[1].execute("INSERT INTO bayeskey (keychar,chtxt,ratio_rec,ratio_all) \
VALUES (%s,%s,%s,%s)\
ON DUPLICATE KEY UPDATE \
- ratio_all=(ratio_all*%s+%s)/%s",retl)
+ ratio_all=CONVERT((ratio_all*%s+%s)/%s,DECIMAL(32,14))",retl)
self.close_db(db)
def change_ratio_rec_reduce_bayeskey(self,chtxt,beforenum,newnum):
beforenum=str(beforenum)
newnum=str(newnum)
db = self.connect_db()
db[1].execute("\
- UPDATE bayeskey SET ratio_rec=ratio_rec*%s/(%s+%s) WHERE chtxt=%s AND NOT (keychar=\"NUM\")",(beforenum,newnum,beforenum,chtxt)\
+ UPDATE bayeskey SET ratio_rec=CONVERT(ratio_rec*%s/(%s+%s),DECIMAL(32,14)) WHERE chtxt=%s AND NOT (keychar=\"NUM\")",(beforenum,newnum,beforenum,chtxt)\
)
self.close_db(db)
def change_ratio_rec_bayeskey(self,key,chtxt,beforenum,addnum):
db[1].execute("INSERT INTO bayeskey (keychar,chtxt,ratio_rec,ratio_all) \
VALUES (%s,%s,%s,%s)\
ON DUPLICATE KEY UPDATE \
- ratio_rec=(ratio_rec*%s+%s)/%s",(key,chtxt,str(Decimal(addnum)/beforenumf),"0",beforenum,chtxt,key))
+ ratio_rec=CONVERT((ratio_rec*%s+%s)/%s,DECIMAL(32,14))",(key,chtxt,str(Decimal(addnum)/beforenumf),"0",beforenum,chtxt,key))
self.close_db(db)
def change_multi_ratio_rec_bayeskey(self,chtxt,beforenum,list):#self,key,chtxt,beforenum,addnum):
beforenumf=beforenum
db[1].execute("INSERT INTO bayeskey (keychar,chtxt,ratio_rec,ratio_all) \
VALUES (%s,%s,%s,%s)\
ON DUPLICATE KEY UPDATE \
- ratio_rec=(ratio_rec*%s+%s)/%s",retl)
+ ratio_rec=CONVERT((ratio_rec*%s+%s)/%s,DECIMAL(32,14))",retl)
self.close_db(db)
def select_by_key_bayeskey(self,key,chtxt):
db = self.connect_db()
dt = tnow-lastup
dt = dt.days * 24 * 60 + dt.seconds
if dt > 2 * 60 * 60:
- ts2epg.write(tmppath + chtxt + "epgdate.xml", chdb.chtxtsearch(chtxt)['ch'])
- xml2db.xml2db(tmppath + chtxt + "epgdate.xml", chdb.chtxtsearch(chtxt)['bctype'])
+ ts2epg.write(tmppath + chtxt + "epgdata.xml", chdb.chtxtsearch(chtxt)['ch'])
+ xml2db.xml2db(tmppath + chtxt + "epgdata.xml", chdb.chtxtsearch(chtxt)['bctype'])
def updatebc(bctype):
bctypel = chdb.bctypesearch(bctype)
print bctypel
try:
- ts2epg.write(tmppath + bctype + "epgdate.xml", chdb.bctypesearch(bctype)['ch'])
- xml2db.xml2db(tmppath + bctype + "epgdate.xml", bctype)
- shutil.copyfile(tmppath + bctype + "epgdate.xml", tmppath + bctype + "epgdate.bak.xml")
+ ts2epg.write(tmppath + bctype + "epgdata.xml", chdb.bctypesearch(bctype)['ch'])
+ xml2db.xml2db(tmppath + bctype + "epgdata.xml", bctype)
+ shutil.copyfile(tmppath + bctype + "epgdata.xml", tmppath + bctype + "epgdata.bak.xml")
rec10d.rec10db.update_by_bctype_chdata(bctype)
except Exception, inst:
print type(inst)
print inst
- xml2db.xml2db(tmppath + bctype + "epgdate.bak.xml", bctype)
+ xml2db.xml2db(tmppath + bctype + "epgdata.bak.xml", bctype)
rec10d.rec10db.update_status_by_bctype_chdata(bctype, "2")
def updatebc_bak(bctype):
"""
update epg data by .bak file
"""
- xml2db.xml2db(tmppath + bctype + "epgdate.bak.xml", bctype)
+ xml2db.xml2db(tmppath + bctype + "epgdata.bak.xml", bctype)
def searchtime2(titletxt, timet, deltatime, chtxt):
time = datetime.datetime.strptime(timet, "%Y-%m-%d %H:%M:%S")
ret = []
def type_decode_que(typetxt,chtxt,title,bt,et,opt):
btime = bt.strftime("%Y-%m-%d %H:%M:%S")
etime = et.strftime("%Y-%m-%d %H:%M:%S")
+ tnow = datetime.datetime.now()
+ dtt = bt-tnow
+ dt = dtt.days * 24 * 60 * 60 + dtt.seconds
typetxtnow=typetxt
typetxting=""
typetxtmiss=""
recdb.rec_reckey(typetxtnow, title, chtxt, btime, etime, opt)
sys.exit()
-def type_encode_que():
+def type_encode_que(typetxt,chtxt,title,bt,et,opt):
btime = bt.strftime("%Y-%m-%d %H:%M:%S")
etime = et.strftime("%Y-%m-%d %H:%M:%S")
+ tnow = datetime.datetime.now()
+ dtt = bt-tnow
+ dt = dtt.days * 24 * 60 * 60 + dtt.seconds
typetxtnow=typetxt
typetxting=""
typetxtfin=""