From 93dcb0915d184686b4ef310599a5ed949db0967a Mon Sep 17 00:00:00 2001 From: gn64_jp Date: Sat, 4 Jul 2009 01:16:17 +0000 Subject: [PATCH] edit mode git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/rec10@65 4e526526-5e11-4fc0-8910-f8fd03428081 --- Rec10WEB/trunk/src/rec10web.py | 96 ++++++++- Rec10WEB/trunk/src/rswi_edit.htm | 421 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 516 insertions(+), 1 deletion(-) create mode 100644 Rec10WEB/trunk/src/rswi_edit.htm diff --git a/Rec10WEB/trunk/src/rec10web.py b/Rec10WEB/trunk/src/rec10web.py index 1867bcf..82320aa 100644 --- a/Rec10WEB/trunk/src/rec10web.py +++ b/Rec10WEB/trunk/src/rec10web.py @@ -6,6 +6,7 @@ import cgi import cgitb import sqlite3 import os +import re import datetime cgitb.enable() path=str(os.path.dirname(os.path.abspath(__file__)))+"/" @@ -56,6 +57,28 @@ def getchtxt(): chopt=chopt+"\n " db.close() return chopt +def edit_date(id): + db=sqlite3.connect(dbpath) + ret={} + for idt,typet,chtxt,title,btime,etime,deltatime,opt,deltaday in db.execute("SELECT id,type,chtxt,title,btime,etime,deltatime,opt,deltaday From rectime WHERE id ="+id): + ret['id']=idt + ret['type']=typet + ret['chtxt']=chtxt + ret['title']=title + ret['btime']=btime + ret['etime']=etime + try: + ret['deltatime']=deltatime + except: + ret['deltatime']="" + ret['opt']=opt + try: + ret['deltaday']=daltaday + except: + ret['deltaday']="" + db.close() + return ret + def reserv_recday(keyword,chtxt,btime,etime,deltatime,opt,deltaday,day): """ dayは月曜日を1日曜日を7とした数字 @@ -108,6 +131,50 @@ def reserv(type,keyword,chtxt,btime,etime,deltatime,opt,deltaday): rett="over" db.close() return rett +def change_reserv(id,type,keyword,chtxt,btime,etime,deltatime,opt,deltaday): + """ + idはテキスト + """ + MaxT=2 + MaxS=2 + db=sqlite3.connect(dbpath) + bt="\'"+btime+"\'" + et="\'"+etime+"\'" + idn=int(id) + dbexe="SELECT id,type,chdata.bctype,rectime.chtxt,rectime.title FROM rectime INNER JOIN chdata ON rectime.chtxt=chdata.chtxt" + #dbexe="SELECT bctype,chtxt,title FROM rectime INNER JOIN chdata ON rectime.chtxt=chdata.chtxt" + + dbexe=dbexe+" WHERE NOT( ( rectime.etime <= "+bt+" ) OR ( rectime.btime >= "+et+" ) )" + for idt,typet,bctypet, chtxtt, titlet in db.execute(dbexe): + if idt != idn: + if (typet=="rec") or (typet=="res") or (typet=="key") or (typet=="keyevery"): + if bctypet.find("cs")>-1: + MaxS=MaxS-1 + elif bctypet.find("bs")>-1: + MaxS=MaxS-1 + elif bctypet.find("te")>-1: + MaxT=MaxT-1 + bctype="" + rett="" + for bctypet, chtxtt in db.execute("SELECT bctype,chtxt FROM chdata WHERE chtxt=\'"+chtxt+"\'"): + bctype=bctypet + if (type=="rec") or (type=="res") or (type=="key") or (type=="keyevery"): + if bctype.find("cs")>-1: + MaxS=MaxS-1 + elif bctype.find("bs")>-1: + MaxS=MaxS-1 + elif bctype.find("te")>-1: + MaxT=MaxT-1 + if MaxS>-1 and MaxT>-1: + db.execute('delete from rectime where id='+id) + recline="\""+type+"\",\""+chtxt+"\",\""+keyword+"\",datetime(\""+btime+"\"),datetime(\""+etime+"\"),\""+deltatime+"\",\""+opt+"\",\""+deltaday+"\"" + #print recline + db.execute('insert into rectime ("type","chtxt","title","btime","etime","deltatime","opt","deltaday") values ('+recline+')') + db.commit() + else: + rett="over" + db.close() + return rett def station2chtxt(station): db=sqlite3.connect(dbpath) ret="" @@ -127,6 +194,11 @@ def readHtmlSrcSimple(): ret=f.read() f.close() return ret +def readHtmlEdit(): + f = open(path+'rswi_edit.htm') + ret=f.read() + f.close() + return ret def readRecFinisSimple(): f = open(path+'fin.htm') @@ -208,7 +280,6 @@ if f.getfirst('exec',""): htmdate= readHtmlSrcSimple() htmdate=htmdate.replace("",getchtxt()) - htmdate=htmdate.replace("",btime) htmdate=htmdate.replace("",etime) htmdate=htmdate.replace("",type) @@ -260,7 +331,30 @@ if (chtxt != "")and(title != "")and(btime!="")and(etime!="")and(opts!="")and(exe htmdate=readRecFinisOver() exect="" # +if (chtxt != "")and(title != "")and(btime!="")and(etime!="")and(opts!="")and(re.search('edit-exec:',exect)): + editnum=exect.replace("edit-exec:","") + restxt=change_reserv(editnum,type, title, chtxt, btime, etime, deltahour, opts, deltaday) + if restxt=="": + htmdate=readRecFinisSimple() + elif restxt=="over": + htmdate=readRecFinisOver() + exect="" if exect=="schedule": htmdate=readRecSchedule() +if re.search('edit:',exect): + editnum=exect.replace("edit:","") + htmdate= readHtmlEdit() + iddata=edit_date(editnum) + htmdate=htmdate.replace("",getchtxt()) + htmdate=htmdate.replace("",iddata["chtxt"]) + htmdate=htmdate.replace("",iddata["btime"]) + htmdate=htmdate.replace("",iddata["etime"]) + htmdate=htmdate.replace("",iddata["type"]) + htmdate=htmdate.replace("",iddata["chtxt"]) + htmdate=htmdate.replace("",iddata["title"]) + htmdate=htmdate.replace("",size) + htmdate=htmdate.replace("",iddata["opt"]) + htmdate=htmdate.replace("","edit-exec:"+editnum) + print htmdate diff --git a/Rec10WEB/trunk/src/rswi_edit.htm b/Rec10WEB/trunk/src/rswi_edit.htm new file mode 100644 index 0000000..4a57aa7 --- /dev/null +++ b/Rec10WEB/trunk/src/rswi_edit.htm @@ -0,0 +1,421 @@ + + + + + + + Rec10 Simple Web Interface ver.0.5.0a 編集画面 + + + + + + + + +
+

Rec10 Simple Web Interface ver.0.5.0a 編集画面


+ 番組名/キーワード + チャンネル + +

開始時刻 +
+
+
現在
+
+30m
+
+3h
+
+12h
+ 終了時刻 +
+
+
一致
+
+5m
+
+30m
+
+1h
+
+
隔日周期(days) + + キーワード録画許容誤差(hours) +

+ + 月曜 + 火曜 + 水曜 + 木曜 + 金曜 + 土曜 + 日曜 +

+ 録画サイズ + アニメ + 二ヶ国語放送 + 5.1ch放送 + 2passモード + Xvidモード + + Options +
+
予約
+
+
+ + -- 2.11.0