#!/usr/bin/python
# coding: UTF-8
# Rec10 TS Recording Tools
-# Copyright (C) 2009-2011 Yukikaze
+# Copyright (C) 2009-2012 Yukikaze
import MySQLdb
import recdblist
import warnings
chtxt VARCHAR(20) PRIMARY KEY,\
ch VARCHAR(20),\
csch VARCHAR(20),\
+ tsid VARCHAR(20),\
chname VARCHAR(100),\
updatetime DATETIME,\
status TINYINT,\
recdblist.addCommonlogEX("Error", "new_epg_ch (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
self.close_db(db)
- def add_epg_ch(self, bctype, chtxt, ch, csch, updatetime,logoupdate,scanupdate):
+ def add_epg_ch(self, bctype, chtxt, ch, csch,tsid,updatetime,logoupdate,scanupdate):
db = self.connect_db()
db[1].execute('\
- INSERT INTO epg_ch (bctype,chtxt,ch,csch,chname,updatetime,status,visible,logoupdate,scanupdate)\
- VALUES (%s,%s,%s,%s,"",%s,%s,%s,%s,%s)', \
- (bctype, chtxt, ch, csch, updatetime, "1","1",logoupdate,scanupdate))
+ INSERT INTO epg_ch (bctype,chtxt,ch,csch,tsid,chname,updatetime,status,visible,logoupdate,scanupdate)\
+ VALUES (%s,%s,%s,%s,%s,"",%s,%s,%s,%s,%s)', \
+ (bctype, chtxt, ch, csch,tsid,updatetime, "1","1",logoupdate,scanupdate))
self.close_db(db)
def delete_all_epg_ch(self):
db = self.connect_db()
def select_by_chtxt_epg_ch(self, chtxt):
db = self.connect_db()
dbexe = db[1].execute("\
- SELECT bctype,chtxt,ch,csch,updatetime,chname,status,visible,logoupdate,scanupdate \
+ SELECT bctype,chtxt,ch,csch,tsid,updatetime,chname,status,visible,logoupdate,scanupdate \
FROM epg_ch \
WHERE chtxt LIKE %s", \
(chtxt,))
self.close_db(db)
for dl in dls:
r = list(dl)
- r[4] = r[4].strftime("%Y-%m-%d %H:%M:%S")
- r[8] = r[8].strftime("%Y-%m-%d %H:%M:%S")
- r[9] = r[9].strftime("%Y-%m-%d %H:%M:%S")
+ r[5] = r[5].strftime("%Y-%m-%d %H:%M:%S")
+ if r[9]!=None:
+ r[9] = r[9].strftime("%Y-%m-%d %H:%M:%S")
+ else:
+ r[9]="2012-04-01 00:00:00"
+ r[10] = r[10].strftime("%Y-%m-%d %H:%M:%S")
ret.append(r)
return ret
def select_by_bctype_epg_ch(self, bctype):
db = self.connect_db()
dbexe = db[1].execute("\
- SELECT bctype,chtxt,ch,csch,updatetime,status,chname,status,visible,logoupdate,scanupdate \
+ SELECT bctype,chtxt,ch,csch,tsid,updatetime,status,chname,status,visible,logoupdate,scanupdate \
FROM epg_ch \
WHERE bctype = %s", \
(bctype,))
for dl in dls:
#recdblist.printutf8(dl)
r = list(dl)
- r[4] = r[4].strftime("%Y-%m-%d %H:%M:%S")
- r[9] = r[9].strftime("%Y-%m-%d %H:%M:%S")
- r[10] = r[10].strftime("%Y-%m-%d %H:%M:%S")
- r[5] = str(r[5])
+ r[5] = r[5].strftime("%Y-%m-%d %H:%M:%S")
+ if r[10]!=None:
+ r[10] = r[10].strftime("%Y-%m-%d %H:%M:%S")
+ else:
+ r[10]="2011-04-01 00:00:00"
+ r[11] = r[11].strftime("%Y-%m-%d %H:%M:%S")
+ r[6] = str(r[6])
ret.append(r)
+ import random
+ ret.insert(0,ret[random.randint(0,len(ret)-1)])
return ret
def select_by_ch_epg_ch(self, ch):
db = self.connect_db()
dbexe = db[1].execute("\
SELECT \
- bctype,chtxt,ch,csch,updatetime,chname,status,visible,logoupdate,scanupdate \
+ bctype,chtxt,ch,csch,tsid,updatetime,chname,status,visible,logoupdate,scanupdate \
FROM epg_ch \
WHERE ch = %s", \
(ch,))
self.close_db(db)
for dl in dls:
r = list(dl)
- r[4] = r[4].strftime("%Y-%m-%d %H:%M:%S")
- r[8] = r[8].strftime("%Y-%m-%d %H:%M:%S")
+ r[5] = r[5].strftime("%Y-%m-%d %H:%M:%S")
r[9] = r[9].strftime("%Y-%m-%d %H:%M:%S")
+ r[10] = r[10].strftime("%Y-%m-%d %H:%M:%S")
ret.append(r)
return ret
def select_by_csch_epg_ch(self, csch):
db = self.connect_db()
dbexe = db[1].execute("\
SELECT \
- bctype,chtxt,ch,csch,updatetime,chname,status,visible,logoupdate,scanupdate \
+ bctype,chtxt,ch,csch,tsid,updatetime,chname,status,visible,logoupdate,scanupdate \
FROM epg_ch \
WHERE csch = %s", \
(csch,))
self.close_db(db)
for dl in dls:
r = list(dl)
- r[4] = r[4].strftime("%Y-%m-%d %H:%M:%S")
- r[8] = r[8].strftime("%Y-%m-%d %H:%M:%S")
+ r[5] = r[5].strftime("%Y-%m-%d %H:%M:%S")
r[9] = r[9].strftime("%Y-%m-%d %H:%M:%S")
+ r[10] = r[10].strftime("%Y-%m-%d %H:%M:%S")
ret.append(r)
return ret
def select_all_epg_ch(self):
db = self.connect_db()
dbexe = db[1].execute("\
- SELECT bctype,chtxt,ch,csch,updatetime,chname,status,visible,logoupdate,scanupdate \
+ SELECT bctype,chtxt,ch,csch,tsid,updatetime,chname,status,visible,logoupdate,scanupdate \
FROM epg_ch \
")
ret = []
self.close_db(db)
for dl in dls:
r = list(dl)
- r[4] = r[4].strftime("%Y-%m-%d %H:%M:%S")
- r[8] = r[8].strftime("%Y-%m-%d %H:%M:%S")
+ r[5] = r[5].strftime("%Y-%m-%d %H:%M:%S")
r[9] = r[9].strftime("%Y-%m-%d %H:%M:%S")
+ r[10] = r[10].strftime("%Y-%m-%d %H:%M:%S")
ret.append(r)
return ret
def change_visible_epg_ch(self,chtxt,visible):
self.change_installed_in_status(1)
self.change_version_in_status("101")
#self.change_installed_in_status()#チャンネルスキャンをさせる
-
+ def update_db_101to102(sekf):
+ self.drop_in_settings()
+ self.new_in_settings()
+ self.new_epg_ch()
+ db = self.connect_db()
+ try:
+ db[1].execute("\
+ ALTER TABLE epg_ch ADD tsid VARCHAR(20)\
+ ")
+ except:
+ ""
+ self.close_db(db)
+ self.change_installed_in_status(1)
+ self.change_version_in_status("102")
+ #self.change_installed_in_status()#チャンネルスキャンをさせる
+