logo2 BLOB,\
logo3 BLOB,\
logo4 BLOB,\
- logo5 BLOB\
+ logo5 BLOB,\
+ logoupdate DATETIME,\
+ logostatus TINYINT DEFAULT 2,\
+ scanupdate DATETIME\
)')
except Exception, inst:
if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
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):
+ def add_epg_ch(self, bctype, chtxt, ch, csch, updatetime,logoupdate,scanupdate):
db = self.connect_db()
db[1].execute('\
- INSERT INTO epg_ch (bctype,chtxt,ch,csch,chname,updatetime,status,visible)\
- VALUES (%s,%s,%s,%s,"",%s,%s,%s)', \
- (bctype, chtxt, ch, csch, updatetime, "1","1"))
+ 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))
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 \
+ SELECT bctype,chtxt,ch,csch,updatetime,chname,status,visible,logoupdate,scanupdate \
FROM epg_ch \
WHERE chtxt LIKE %s", \
(chtxt,))
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")
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 \
+ SELECT bctype,chtxt,ch,csch,updatetime,status,chname,status,visible,logoupdate,scanupdate \
FROM epg_ch \
WHERE bctype = %s", \
(bctype,))
#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])
ret.append(r)
return ret
db = self.connect_db()
dbexe = db[1].execute("\
SELECT \
- bctype,chtxt,ch,csch,updatetime,chname,status,visible \
+ bctype,chtxt,ch,csch,updatetime,chname,status,visible,logoupdate,scanupdate \
FROM epg_ch \
WHERE ch = %s", \
(ch,))
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")
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 \
+ bctype,chtxt,ch,csch,updatetime,chname,status,visible,logoupdate,scanupdate \
FROM epg_ch \
WHERE csch = %s", \
(csch,))
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")
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 \
+ SELECT bctype,chtxt,ch,csch,updatetime,chname,status,visible,logoupdate,scanupdate \
FROM epg_ch \
")
ret = []
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")
ret.append(r)
return ret
def change_visible_epg_ch(self,chtxt,visible):
ret = db[1].fetchall()
self.close_db(db)
return ret
+ def select_get_updatelogo_epg_ch(self, dhour):
+ db = self.connect_db()
+ dbexe = db[1].execute("SELECT bctype,chtxt,logostatus FROM epg_ch \
+ WHERE (\
+ ( \
+ updatetime < DATE_SUB(now(),INTERVAL " + dhour + " HOUR) \
+ AND \
+ logostatus = 1 \
+ ) \
+ OR \
+ logostatus > 1 )\
+ ORDER BY status DESC")
+ ret = []
+ #recdblist.printutf8(dbexe)
+ if dbexe > 0:
+ ret = db[1].fetchall()
+ self.close_db(db)
+ return ret
def update_by_bctype_epg_ch(self, bctype):
db = self.connect_db()
db[1].execute("\
status = 1 \
WHERE bctype = %s", (bctype,))
self.close_db(db)
+
def update_by_bctype_and_chtxt_epg_ch(self, bctype, chtxt):
db = self.connect_db()
db[1].execute("\
(status, bctype)\
)
self.close_db(db)
- def update_chname_by_chtxt_epg_ch(self,chtxt,chname):
+ def update_status_by_bctype_epg_ch(self, bctype, status):
db = self.connect_db()
db[1].execute("\
UPDATE epg_ch \
SET \
- chname=%s \
- WHERE chtxt = %s", \
- (chname, chtxt)\
+ status=%s , \
+ updatetime=now() \
+ WHERE bctype = %s", \
+ (status, bctype)\
+ )
+ self.close_db(db)
+ def update_logostatus_by_bctype_epg_ch(self,bctype,logostatus):
+ db = self.connect_db()
+ db[1].execute("\
+ UPDATE epg_ch \
+ SET \
+ logostatus=%s , \
+ logoupdate=now() \
+ WHERE bctype = %s", \
+ (logostatus, bctype)\
)
self.close_db(db)
def add_auto_proc_tmp(self,type,title,chtxt):
recdblist.addCommonlogEX("Error","updatebc(epgdb.py)", str(type(inst)), str(inst)+"\n"+traceback.format_exc(),log_level=200)\r
xml2db_dom.xml2db_dom(tmppath + bctype + "epgdata.bak.xml", bctype)\r
rec10d.rec10db.update_status_by_bctype_epg_ch(bctype, "2")\r
+def updateLogo_bc(bctype):\r
+ bctypel = chdb.searchCHFromBctype(bctype)\r
+ #print bctype\r
+ try:\r
+ ts2epg.writeLogoEpgXML(tmppath + bctype + "logo.xml", chdb.searchCHFromBctype(bctype)['ch'])\r
+ xml2db_dom.xml2db_dom_logo(tmppath + bctype + "logo.xml", bctype)\r
+ shutil.copyfile(tmppath + bctype + "logo.xml", tmppath + bctype + "logo.bak.xml")\r
+ time.sleep(5)\r
+ rec10d.rec10db.update_logostatus_by_bctype_epg_ch(bctype,"1")\r
+ except Exception, inst:\r
+ recdblist.addCommonlogEX("Error","updatebc(epgdb.py)", str(type(inst)), str(inst)+"\n"+traceback.format_exc(),log_level=200)\r
+ xml2db_dom.xml2db_dom(tmppath + bctype + "logo.bak.xml", bctype)\r
+ rec10d.rec10db.update_logostatus_by_bctype_epg_ch(bctype,"2")\r
def searchTime(titletxt, timet, deltatime, chtxt):\r
time = datetime.datetime.strptime(timet, "%Y-%m-%d %H:%M:%S")\r
ret = []\r
elif len(ch)>2:\r
timet = "240"\r
writeEpgXMLTime(pout, ch ,timet)\r
-def writeEpgXMLTime(pout, ch ,times):\r
+def writeLogoEpgXML(pout, ch):\r
+ """\r
+ tsを取得してepgの入ったxmlとして書き出す\r
+ """\r
+ timet = "1200"\r
+ writeEpgXMLTime(pout, ch ,timet,islogo=1)\r
+def writeEpgXMLTime(pout, ch ,times,islogo=0):\r
"""\r
指定された時間分tsを取得してepgの入ったxmlとして書き出す\r
"""\r
if os.access(pout + ".ts", os.F_OK):\r
os.remove(pout + ".ts")\r
time.sleep(10)\r
- tv2ts.tv2tsmix(pout + ".ts", ch, timet)\r
- exe = "export LANG=ja_JP.UTF-8 && nice -n 15 " + epgdump + " " + mode + " " + pout + ".ts " + pout\r
+ tv2ts.tv2b25ts(pout+ ".ts", ch, time)\r
+ logoopt=""\r
+ if islogo==1:\r
+ logoopt="/LOGO "\r
+ exe = "export LANG=ja_JP.UTF-8 && nice -n 15 " + epgdump + " " +logoopt+ mode + " " + pout + ".ts " + pout\r
recdblist.printutf8(exe)\r
recdblist.addCommonlogEX(u"通常", "write_time(ts2epg.py)", exe,"",log_level=500)\r
unicode(commands.getoutput(exe),'utf-8','ignore')\r