+++ /dev/null
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta http-equiv="refresh" content="10; url=<!--url_for_replace_fin//-->">
- <title>Rec10 Simple Web Interface ver.0.9.0</title>
- </head>
- <body>
- <h1>Rec10 Simple Web Interface ver.0.9.0</h1><br>
- <br>
- <!--text_for_replace_fin//-->
- 予約が終了しました。移動します。
- </body>
-</html>
+++ /dev/null
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>Rec10 Simple Web Interface ver.0.9.1 iEPGデータ追加</title>
- <script type="text/javascript" src="./dojo/dojo/dojo.js" djConfig="parseOnLoad:true">
- </script>
- <!-- テーマの読み込み -->
- <style type="text/css">
- @import "./dojo/dojo/resources/dojo.css";
- @import "./dojo/dijit/themes/tundra/tundra.css";
- </style>
- <script type="text/javascript">
- dojo.require("dojo.parser");
- // ※ ここで、使用するウィジェットの読み込みを行う
- dojo.require("dijit.form.Button");
- dojo.require("dijit.form.TextBox");
- dojo.require("dijit.form.Form");
- dojo.require("dijit.form.ValidationTextBox");
- dojo.require("dijit.form.FilteringSelect");
- </script>
- </head>
- <body class="tundra">
- <div dojoType="dijit.form.Form" action="rec10web.py" onExecute="this.submit()">
- <h1>Rec10 Simple Web Interface ver.0.9.1 iEPGデータ追加</h1><br>
- <input type="text"
- length="40"
- dojoType="dijit.form.TextBox"
- value="<!--iepg_title-value//-->"
- id="iepg_station"
- name="iepg_station">
- <select name="iepg_chtxt"
- dojoType="dijit.form.FilteringSelect"
- autocomplete="false"
- value="<!--ch-value//-->"
- onChange="setType">
- <!--text_for_replace_chtxt_input//-->
- </select>
- <div dojoType="dijit.form.Button" type="submit">追加</div>
- <div name="exec"
- dojoType="dijit.form.ValidationTextBox"
- value="iepg-add_yes"
- style="display:none">
- </div>
- </div>
- </body>
-</html>
+++ /dev/null
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <meta http-equiv="Content-Style-Type" content="text/css">
- <meta http-equiv="Content-Script-Type" content="text/javascript">
- <title>Rec10 Simple Web Interface ver.0.9.1 iEPGデータ表示</title>
- <script type="text/javascript" src="./dojo/dojo/dojo.js" djConfig="parseOnLoad:true">
- </script>
- <!-- テーマの読み込み -->
- <style type="text/css">
- @import "./dojo/dojo/resources/dojo.css";
- @import "./dojo/dijit/themes/tundra/tundra.css";
- @import "./dojo/dojox/grid/resources/Grid.css";
- @import "./dojo/dojox/grid/resources/tundraGrid.css";
- </style>
- <script type="text/javascript">
- dojo.require("dojo.parser");
- // ※ ここで、使用するウィジェットの読み込みを行う
- dojo.require('dojox.grid.DataGrid');
- dojo.require("dijit.form.Form");
- dojo.require("dijit.form.Button");
- dojo.require("dijit.form.TextBox");
- dojo.require("dojo.data.ItemFileWriteStore");
- dojo.require("dojox.data.CsvStore");
- dojo.require("dijit.form.TextBox");
- dojo.require("dojox.grid.Selection");
- var iepgstore = new dojox.data.CsvStore({url:'./iepgdatum.csv'});
- function click(){
- var items=dijit.byId("iepgGrid").selection.getSelected();
- var str="";
- for (i=0;i<items.length;i++){
- var s=dijit.byId("iepgGrid").store.getValue(items[i],"id");
- str=str+s+",";
- }
- dijit.byId("iepgdelnum").setValue(str);
- }
- </script>
- </head>
- <body class="tundra">
- <div dojoType="dijit.form.Form" action="rec10web.py" onExecute="this.submit()">
- <h1>Rec10 Simple Web Interface ver.0.9.1 iEPGデータ表示</h1><br>
- <table dojoType="dojox.grid.DataGrid"
- id="iepgGrid"
- jsid="iepgGrid"
- store="iepgstore"
- query="{id:'*'}"
- width="100%"
- autoHeight="true"
- autoWidth="true"
- clientSort="true"
- onClick="click"
- >
- <thead>
- <tr>
- <th field="id" width="30px">ID</th>
- <th field="name" width="200px">チャンネル</th>
- <th field="chtxt" width="100px">chtxt</th>
- </tr>
- </thead>
- </table>
- <div dojoType="dijit.form.Button" type="submit">DEL</div>
- <div name="exec"
- dojoType="dijit.form.TextBox"
- value="iepg-del"
- style="display:none">
- </div>
- <div dojoType="dijit.form.TextBox"
- name="iepgdelnum"
- id="iepgdelnum"
- value=""
- style="display:none">
- </div>
- </div>
- </body>
-</html>
+++ /dev/null
-rec10web
-
-Rec10Web is Web Interface for Rec10
-Copyright (C) 2009 Yukikaze
-
-rec10webはrec10の録画予約をweb上から行うために作られた補助ツールです。
-rec10web.pyと同じフォルダ内にrec10が作ったconfig.iniへのリンクを張ってください。
-表示にはDojoが必要です。Dojoを設置した上でrswi.htmのdojo関連のパスを書き換えてください。
-LicenseはLGPL v3に準拠します
-yukikaze
-
-dbMySQLパッケージおよびpython2.4以上が必要です。
-
-
-同梱のdojoToolkitはBSDライセンスであり、本文の最後に記載されたライセンスに従い再配布が可能です。
-
-history
-0.9.0
-avi2mp4機能追加
-キーワード機能の追加
-0.8.0
-SQLiteのサポート終了。
-大幅な仕様変更
-
-0.6.0
-データーベースにMySQLサポートを追加
-Rec10WEBのみpython2.4以上で動作するように
-
-0.4.1a
-曜日検索ができるようになった
-
-dojo ライセンス
-The "New" BSD License:
-**********************
-
-Copyright (c) 2005-2009, The Dojo Foundation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
- * Neither the name of the Dojo Foundation nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
+++ /dev/null
-#!/usr/bin/python
-# coding: UTF-8
-# Rec10 TS Recording Tools
-# Copyright (C) 2009 Yukikaze
-import cgi
-import cgitb
-import rec10web_dbMySQL
-import os
-import os.path
-import re
-import datetime
-import ConfigParser
-import time
-cgitb.enable()
-path = str(os.path.dirname(os.path.abspath(__file__))) + "/"
-confp = ConfigParser.SafeConfigParser()
-Conf = 'rec10.conf'
-cpath=""
-if (os.path.exists(os.path.join(path,Conf))):
- cpath=os.path.join(path,Conf)
-elif (os.path.exists(os.path.join("/etc/rec10",Conf))):
- cpath=os.path.join("/etc/rec10",Conf)
-elif (os.path.exists(os.path.join("/etc",Conf))):
- cpath=os.path.join("/etc",Conf)
-
-confp.read(cpath)
-global f
-f = cgi.FieldStorage()
-def getpath(string):
- global confp
- return confp.get('path', string)
-def getdbpath(string):
- global confp
- return confp.get('db', string)
-def getdb():
- retdb = ""
- if getdbpath('db') == 'MySQL':
- dbn = getdbpath("mysql_dbname")
- dbh = getdbpath("mysql_host")
- dbu = getdbpath("mysql_user")
- dbpwd = getdbpath("mysql_passwd")
- dbport = int(getdbpath("mysql_port"))
- retdb = rec10web_dbMySQL.DB_MySQL(dbname=dbn, host=dbh, user=dbu, passwd=dbpwd, port=dbport)
- return retdb
-def getRecDate():
- dl = database.select_all_timeline()
- recdata = "id,type,chtxt,title,btime,etime,deltaday,opt\n"
- #print dl
- for d in dl:
- id = d['id']
- typet = d['type']
- chtxt = d['chtxt']
- title = d['title']
- btime = d['btime']
- etime = d['etime']
- deltatime = d['deltatime']
- deltaday = d['deltaday']
- opt = d['opt']
- if deltaday == None:
- deltaday = u"なし"
- elif deltaday == "":
- deltaday = u"なし"
- if opt == None:
- opt = u"なし"
- if typet == "reserve_flexible":
- typet = u"浮動予約"
- elif typet == "search_today":
- typet = u"当日予約"
- elif typet == "search_everyday":
- typet = u"隔日予約"
- elif typet == "reserve_fixed":
- typet = u"確定予約"
- elif typet == "grid":
- typet = u"外部委託"
- elif typet == "convert_ts_mp4":
- typet = u"縁故予約"
- elif typet == "convert_b25_ts":
- typet = u"解読予約"
- #print btime
- btime = btime[5:16]
- etime = etime[5:16]
- btime = btime.replace("-", "/")
- etime = etime.replace("-", "/")
- if btime[0:5] == etime[0:5]:
- etime = etime[6:]
- s = "\"" + str(id) + "\",\"" + typet + "\",\"" + chtxt + "\",\"" + title + "\",\"" + btime + "\",\"" + etime + "\",\"" + deltaday + "\",\"" + opt + "\"\n"
- s = str(id) + "," + typet + "," + chtxt + "," + title + "," + btime + "," + etime + "," + deltaday + "," + opt + "\n"
- recdata = recdata + s
- f = open(path + "/recdatum.csv", "w")
- f.write(recdata.encode('utf-8'))
- f.close()
-def getiEPGDate():
- dl = database.select_all_iepg()
- recdata = "id,name,chtxt\n"
- #print dl
- s = ""
- for d in dl:
- s = s + d[0] + "," + d[1] + "," + d[2] + "\n"
- recdata = recdata + s
- f = open(path + "/iepgdatum.csv", "w")
- f.write(recdata.encode('utf-8'))
- f.close()
-def getchtxt():
- dl = database.select_all_epg_ch()
- chopt = ""
- for bctype, ontv, chtxt, chname, ch, csch, updatetime in dl:
- chopt = chopt + "<option value=" + chtxt + ">" + chname + "</option>\n "
- return chopt
-def edit_date(id):
- ret = database.select_by_id_timeline(id)
- return ret[0]
-def reserv_recday(keyword, chtxt, btime, etime, deltatime, opt, deltaday, day):
- """
- dayは月曜日を1日曜日を7とした数字
- """
- #bt=datetime.datetime.strptime(btime,"%Y-%m-%d %H:%M:%S")
- #et=datetime.datetime.strptime(etime,"%Y-%m-%d %H:%M:%S")
- bt = datetime.datetime(*time.strptime(btime, "%Y-%m-%d %H:%M:%S")[:-3])
- et = datetime.datetime(*time.strptime(etime, "%Y-%m-%d %H:%M:%S")[:-3])
- dt = int(day)-bt.isoweekday()
- if dt < 0:
- dt = dt + 7
- dbt = bt + datetime.timedelta(days=dt)
- det = et + datetime.timedelta(days=dt)
- btime = dbt.strftime("%Y-%m-%d %H:%M:%S")
- etime = det.strftime("%Y-%m-%d %H:%M:%S")
- return reserv("keyevery", keyword, chtxt, btime, etime, deltatime, opt, "7")
-def reserv(type, keyword, chtxt, btime, etime, deltatime, opt, deltaday):
- MaxT = 2
- MaxS = 2
- tsnum = count_schedule(btime, etime)
- MaxT = MaxT-tsnum[0]
- MaxS = MaxS-tsnum[1]
- bctype = ""
- rett = ""
- bctypegetdb = database.select_by_chtxt_epg_ch(chtxt)
- for bctypet, ontvt, chtxtt, cht, cscht, updatetimet in bctypegetdb:
- bctype = bctypet
- if (type == "reserve_fixed") or (type == "reserve_flexible") or (type == "search_today") or (type == "search_everyday"):
- 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:
- database.add_timeline(type=type, chtxt=chtxt, title=keyword, btime=btime, etime=etime, deltatime=deltatime, deltaday=deltaday, opt=opt)
- rett = ""
- else:
- rett = "over"
- return rett
-def count_schedule(btime, etime):
- """
- return rec num (int return[0]:TE /int return[1]:BS/CS)
- """
- def cmpare(x, y):
- #xt=datetime.datetime(*time.strptime(x,"%Y-%m-%d %H:%M:%S")[:-3])
- #yt=datetime.datetime(*time.strptime(y,"%Y-%m-%d %H:%M:%S")[:-3])
- xt = x
- yt = y
- if xt > yt:
- return -1
- elif xt == yt:
- return 0
- else:
- return 1
- dls = database.schedule_timeline(btime, etime)
- times = []
- btd = datetime.datetime(*time.strptime(btime, "%Y-%m-%d %H:%M:%S")[:-3])
- etd = datetime.datetime(*time.strptime(etime, "%Y-%m-%d %H:%M:%S")[:-3])
- for dl in dls:
- dd1 = datetime.datetime(*time.strptime(dl[4], "%Y-%m-%d %H:%M:%S")[:-3])
- dd2 = datetime.datetime(*time.strptime(dl[5], "%Y-%m-%d %H:%M:%S")[:-3])
- if dd1 < btd:
- dd1 = btd
- if dd2 > etd:
- dd2 = etd
- times.append(dd1)
- times.append(dd2)
- times = list(set(times))
- times.sort(cmpare)
- times.reverse()
- retcount = [0, 0]
- for i in xrange(0, len(times)-2, 1):
- bt1 = times[i]
- et1 = times[i + 1]
- btime1 = bt1.strftime("%Y-%m-%d %H:%M:%S")
- etime1 = et1.strftime("%Y-%m-%d %H:%M:%S")
- ret1 = database.count_schedule_timeline(btime1, etime1)
- if retcount[0] < ret1[0]:
- retcount[0] = ret1[0]
- if retcount[1] < ret1[1]:
- retcount[1] = ret1[1]
- return retcount
-def change_reserv(id, type, keyword, chtxt, btime, etime, deltatime, opt, deltaday):
- """
- idはテキスト
- """
- MaxT = 2
- MaxS = 2
- tsnum = count_schedule(btime, etime)
- MaxT = MaxT-tsnum[0]
- MaxS = MaxS-tsnum[1]
- bctype = ""
- rett = ""
- for dl in database.select_by_chtxt_epg_ch(chtxt):
- bctype = dl[0]
- if (type == "reserve_fixed") or (type == "reserve_flexible") or (type == "search_today") or (type == "search_everyday"):
- 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:
- database.del_by_id_timeline(id)
- database.add_timeline(type=type, chtxt=chtxt, title=keyword, btime=btime, etime=etime, deltatime=deltatime, deltaday=deltaday, opt=opt)
- else:
- rett = "over"
- return rett
-def station2chtxt(station):
- ret = ""
- #try:
- database.new_iepg()
- #except:
- # ""
- sta = database.select_by_station_iepg(station)
- if len(sta) > 0:
- ret = sta[0][2]
- else:
- ret = "n\/a"
- return ret
-def readHtmlSrcSimple():
- f = open(path + 'rswi.htm')
- ret = f.read()
- f.close()
- return unicode(ret,'utf-8')
-def readRecFinisSimple():
- f = open(path + 'fin.htm')
- ret = f.read()
- f.close()
- return unicode(ret,'utf-8')
-def readRecSchedule():
- f = open(path + 'schedule.htm')
- ret = f.read()
- f.close()
- return unicode(ret,'utf-8')
-def readiEPGadd():
- f = open(path + 'iepg_add.htm')
- ret = f.read()
- f.close()
- return unicode(ret,'utf-8')
-def readiEPGshow():
- f = open(path + 'iepg_show.htm')
- ret = f.read()
- f.close()
- return unicode(ret,'utf-8')
-def get_fin(string, refreshurl):
- htmdate = readRecFinisSimple()
- htmdate = htmdate.replace('<!--text_for_replace_fin//-->', string)
- htmdate = htmdate.replace('<!--url_for_replace_fin//-->', refreshurl)
- return htmdate
-def mode_iepg_add(station):
- htmdate = readiEPGadd()
- htmdate = htmdate.replace("<!--text_for_replace_chtxt_input//-->", getchtxt())
- htmdate = htmdate.replace("<!--ch-value//-->", "")
- htmdate = htmdate.replace("<!--iepg_title-value//-->", station)
- return htmdate
-def mode_iepg_fin():
- s = u"epgデータの追加を完了しました。<br>\n録画を行う場合はもう一度おねがいします。<br>"
- u = "rec10web.py?exec=iepg-show"
- return get_fin(s, u)
-def mode_iepg_show():
- htmdate = readiEPGshow()
- return htmdate
-def mode_iepg_del():
- s = u"epgデータを削除しました。"
- u = "rec10web.py?exec=iepg-show"
- return get_fin(s, u)
-def mode_iepg_del_miss():
- s = u"epgデータの削除に失敗しました。"
- u = "rec10web.py?exec=iepg-show"
- return get_fin(s, u)
-def mode_schedule():
- htmdate = readRecSchedule()
- return htmdate
-def mode_recfin():
- s = u"予約が終了しました。移動します。"
- u = "rec10web.py?exec=schedule"
- return get_fin(s, u)
-def mode_recover():
- s = u"最大予約可能数を超えています"
- u = "rec10web.py?exec=schedule"
- return get_fin(s, u)
-def mode_normal():
- htmdate = readHtmlSrcSimple()
- htmdate = htmdate.replace("<!--exec-value//-->", "yes")
- return htmdate
-def mode_del():
- s = u"予約を削除しました。"
- u = "rec10web.py?exec=schedule"
- return get_fin(s, u)
-def mode_edit_rec10web(tasknum):
- #editnum=exect.replace("edit:","")
- htmdate = readHtmlSrcSimple()
- iddata = edit_date(tasknum)
- htmdate = htmdate.replace("<!--text_for_replace_chtxt_input//-->", getchtxt())
- htmdate = htmdate.replace("<!--ch-value//-->", iddata['chtxt'])
- htmdate = htmdate.replace("<!--btime-value//-->", iddata['btime'])
- htmdate = htmdate.replace("<!--etime-value//-->", iddata['etime'])
- htmdate = htmdate.replace("<!--type-value//-->", iddata['type'])
- htmdate = htmdate.replace("<!--ch-value//-->", iddata['chtxt'])
- htmdate = htmdate.replace("<!--title-value//-->", iddata['title'])
- htmdate = htmdate.replace("<!--size-value//-->", size)
- htmdate = htmdate.replace("<!--opts-value//-->", iddata["opt"])
- htmdate = htmdate.replace("<!--exec-value//-->", "edit-exec:" + tasknum)
- return htmdate
-def mode_edit():
- editnum = exect.replace("edit:", "")
- htmdate = readHtmlSrcSimple()
- iddata = edit_date(editnum)
- htmdate = htmdate.replace("<!--text_for_replace_chtxt_input//-->", getchtxt())
- htmdate = htmdate.replace("<!--ch-value//-->", iddata['chtxt'])
- htmdate = htmdate.replace("<!--btime-value//-->", iddata['btime'])
- htmdate = htmdate.replace("<!--etime-value//-->", iddata['etime'])
- htmdate = htmdate.replace("<!--type-value//-->", iddata['type'])
- htmdate = htmdate.replace("<!--ch-value//-->", iddata['chtxt'])
- htmdate = htmdate.replace("<!--title-value//-->", iddata['title'])
- htmdate = htmdate.replace("<!--size-value//-->", size)
- htmdate = htmdate.replace("<!--opts-value//-->", iddata["opt"])
- htmdate = htmdate.replace("<!--exec-value//-->", "edit-exec:" + editnum)
- return htmdate
-dbpath = path + "ch.db"
-database = getdb()
-btime = ""
-etime = ""
-title = ""
-chtxt = ""
-type = "reserve_flexible"
-bt = ""
-station_name = ""
-mode = ""
-###ここからiEPG用の読み出し
-if f.getfirst('station_name'):
- station = f.getfirst('station_name')
- chtxt = station2chtxt(station)
- if chtxt == "n\/a":
- mode = "iepg-add"
- station_name = station
- exect = "iepg-add"
-if f.getfirst('station'):
- station = f.getfirst('station')
- chtxt = station2chtxt(station)
- if chtxt == "n\/a":
- mode = "iepg-add"
- station_name = station
- exect = "iepg-add"
-###ここから外部からの読み出しの場合
-if f.getfirst('type'):
- type = unicode(f.getfirst('type'),'utf-8')
-if f.getfirst('title'):
- title = unicode(f.getfirst('title'),'utf-8')
-if f.getfirst('chtxt'):
- chtxt = unicode(f.getfirst('chtxt'),'utf-8')
-if f.getfirst('btime'):
- btime = unicode(f.getfirst('btime'),'utf-8')
- bt = datetime.datetime(*time.strptime(btime, "%Y-%m-%d %H:%M:%S")[:-3])
-if f.getfirst('etime'):
- etime = unicode(f.getfirst('etime'),'utf-8')
- et = datetime.datetime(*time.strptime(etime, "%Y-%m-%d %H:%M:%S")[:-3])
- if bt != "":
- delt = et-bt
- dt = delt.days * 24 * 60 * 60 + delt.seconds
- if dt < 0:
- dd = datetime.timedelta(days=1)
- et = et + dd
- etime = unicode(et.strftime("%Y-%m-%d %H:%M:%S"),'utf-8')
- if dt < -1 * 24 * 60 * 60:
- d1 = datetime.datetime(bt.year, 0, 0)
- d2 = datetime.datetime(bt.year + 1, 0, 0)
- dd = d2-d1
- et = et + dd
- etime = unicode(et.strftime("%Y-%m-%d %H:%M:%S"),'utf-8')
-size = "S"
-if f.getfirst('size'):
- size = f.getfirst('size')
-opts = ""
-if f.getfirst('opts'):
- opts = f.getfirst('opts')
-deltahour = ""
-if f.getfirst('deltahour', ""):
- deltahour = f.getfirst('deltahour', "")
-deltaday = ""
-if f.getfirst('deltaday', ""):
- deltaday = f.getfirst('deltaday', "")
-exect = ""
-if f.getfirst('exec', ""):
- exect = f.getfirst('exec', "")
-if exect == "schedule":
- mode = "schedule"
- getRecDate()
-elif exect == "yes":
- mode = "yes"
-elif re.search('edit:', exect):
- mode = "edit"
-elif re.search('edit-exec:', exect):
- mode = "edit-exec"
-elif exect == "change":
- mode = "edit-rec10"
-elif exect == "del":
- mode = "del"
-elif exect == "iepg-add":
- mode = "iepg-add"
-elif exect == "iepg-show":
- mode = "iepg-show"
-elif exect == "iepg-add_yes":
- mode = "iepg-add-yes"
-elif exect == "iepg-del":
- mode = "iepg-del"
-htmdate = mode_normal()
-htmdate = htmdate.replace("<!--text_for_replace_chtxt_input//-->", getchtxt())
-htmdate = htmdate.replace("<!--btime-value//-->", btime)
-htmdate = htmdate.replace("<!--etime-value//-->", etime)
-htmdate = htmdate.replace("<!--type-value//-->", type)
-htmdate = htmdate.replace("<!--ch-value//-->", chtxt)
-htmdate = htmdate.replace("<!--title-value//-->", title)
-htmdate = htmdate.replace("<!--size-value//-->", size)
-htmdate = htmdate.replace("<!--opts-value//-->", opts)
-#ここから曜日検索の設定
-if f.getfirst('type') == "keyday":
- rett = ""
- dayt = f.getfirst('day_Mon')
- if dayt:
- rett = rett + reserv_recday(title, chtxt, btime, etime, deltahour, opts, deltaday, dayt)
- dayt = f.getfirst('day_Tue')
- if dayt:
- rett = rett + reserv_recday(title, chtxt, btime, etime, deltahour, opts, deltaday, dayt)
- dayt = f.getfirst('day_Wed')
- if dayt:
- rett = rett + reserv_recday(title, chtxt, btime, etime, deltahour, opts, deltaday, dayt)
- dayt = f.getfirst('day_Thu')
- if dayt:
- rett = rett + reserv_recday(title, chtxt, btime, etime, deltahour, opts, deltaday, dayt)
- dayt = f.getfirst('day_Fri')
- if dayt:
- rett = rett + reserv_recday(title, chtxt, btime, etime, deltahour, opts, deltaday, dayt)
- dayt = f.getfirst('day_Sat')
- if dayt:
- rett = rett + reserv_recday(title, chtxt, btime, etime, deltahour, opts, deltaday, dayt)
- dayt = f.getfirst('day_Sun')
- if dayt:
- rett = rett + reserv_recday(title, chtxt, btime, etime, deltahour, opts, deltaday, dayt)
- if rett == "":
- htmdate = mode_recfin()
- else:
- htmdate = mode_recover()
- chtxt = ""
- exect = ""
-
-
-if mode == "schedule":
- htmdate = mode_schedule()
-elif mode == "edit":
- htmdate = mode_edit()
-elif mode == "iepg-add":
- htmdate = mode_iepg_add(station_name)
-elif mode == "iepg-add-yes":
- try:
- database.new_iepg()
- except:
- ""
- if f.getfirst('iepg_station') and f.getfirst('iepg_chtxt'):
- database.add_iepg(f.getfirst('iepg_station'), f.getfirst('iepg_chtxt'))
- htmdate = mode_iepg_fin()
-elif mode == "iepg-show":
- getiEPGDate()
- htmdate = mode_iepg_show()
-elif mode == "iepg-del":
- s = f.getfirst('iepgdelnum')
- htmdate = ""
- #try:
- for st in s.split(","):
- if st != "":
- database.del_by_id_iepg(st)
- htmdate = mode_iepg_del()
- #except:
- # htmdate=mode_iepg_del_miss()
-elif mode == "edit-rec10":
- s = f.getfirst('tasknum')
- s.replace(" ", "")
- htmdate = mode_edit_rec10web(s.split(",")[0])
-elif mode == "del":
- s = f.getfirst('tasknum')
- s.replace(" ", "")
- ss = s.split(",")
- for st in ss:
- if st != "":
- database.del_by_id_timeline(st)
- htmdate = mode_del()
-elif mode == "edit-exec":
- if (chtxt != "")and(title != "")and(btime != "")and(etime != "")and(opts != ""):
- editnum = exect.replace("edit-exec:", "")
- restxt = change_reserv(editnum, type, title, chtxt, btime, etime, deltahour, opts, deltaday)
- if restxt == "":
- htmdate = mode_recfin()
- elif restxt == "over":
- htmdate = mode_recover()
- else:
- htmdate = mode_recfin()
- exect = ""
-elif mode == "yes":
- if (chtxt != "")and(title != "")and(btime != "")and(etime != "")and(opts != ""):
- restxt = reserv(type, title, chtxt, btime, etime, deltahour, opts, deltaday)
- if restxt == "":
- htmdate = mode_recfin()
- elif restxt == "over":
- htmdate = mode_recover()
- else:
- htmdate = mode_recfin()
-print "Content-Type: text/html"
-print htmdate.encode('utf-8')
+++ /dev/null
-#!/usr/bin/python
-# coding: UTF-8
-# Rec10 TS Recording Tools
-# Copyright (C) 2009 Yukikaze
-import os
-import MySQLdb
-path = str(os.path.dirname(os.path.abspath(__file__))) + "/"
-dbpath = path + "ch.db"
-class DB_MySQL:
- dbname = ""
- dbhost = ""
- dbusr = ""
- dbpasswd = ""
- dbport = 0
- def __init__(self, dbname, user, passwd, host="localhost", port=3306):
- self.dbname = dbname
- self.dbhost = host
- self.dbusr = user
- self.dbpasswd = passwd
- self.dbport = port
- def connect_db(self):
- """
- dbへの接続
- """
- con = MySQLdb.connect(db=self.dbname, host=self.dbhost, port=self.dbport, user=self.dbusr, passwd=self.dbpasswd, charset="utf8")
- cur = con.cursor()
- cur.execute('set names utf8;')
- return [con, cur]
- def close_db(self, db):
- db[1].close()
- db[0].close()
- def select_all_timeline(self):
- db = self.connect_db()
- recdata = []
- dl = db[1].execute("SELECT id,type,chtxt,title,btime,etime,deltatime,deltaday,opt FROM timeline")
- dls = db[1].fetchall()
- for id, typet, chtxt, title, btime, etime, deltatime, deltaday, opt in dls:
- ret = {}
- ret['id'] = id
- ret['type'] = typet
- ret['chtxt'] = chtxt
- ret['title'] = title
- btime = btime.strftime("%Y-%m-%d %H:%M:%S")
- etime = etime.strftime("%Y-%m-%d %H:%M:%S")
- ret['btime'] = btime
- ret['etime'] = etime
- ret['opt'] = opt
- ret['deltatime'] = ""
- ret['deltaday'] = ""
- if deltatime == None:
- deltatime = "3"
- if deltaday == None:
- deltaday = "7"
- if typet == 'key':
- ret['deltatime'] = deltatime
- elif typet == 'keyevery':
- ret['deltatime'] = deltatime
- ret['deltaday'] = deltaday
- recdata.append(ret)
- self.close_db(db)
- return recdata
- def select_by_chtxt_timeline(self, chtxt):
- db = self.connect_db()
- recdata = []
- dl = db[1].execute("SELECT type, chtxt, title, btime, etime, deltatime ,deltaday ,opt FROM timeline WHERE chtxt = %s ", (chtxt, ))
- d = db[1].fetchall()
- for typet, chtxt, title, btime, etime, deltatime, deltaday, opt in d:
- ret = {}
- ret['type'] = typet
- ret['chtxt'] = chtxt
- ret['title'] = title
- btime = btime.strftime("%Y-%m-%d %H:%M:%S")
- etime = etime.strftime("%Y-%m-%d %H:%M:%S")
- ret['btime'] = btime
- ret['etime'] = etime
- ret['opt'] = opt
- if deltatime == None:
- deltatime = "3"
- if deltaday == None:
- deltaday = "7"
- if typet == 'key':
- ret['deltatime'] = deltatime
- elif typet == 'keyevery':
- ret['deltatime'] = deltatime
- ret['deltaday'] = deltaday
- recdata.append(ret)
- self.close_db(db)
- return recdata
- def select_by_id_timeline(self, id):
- db = self.connect_db()
- recdata = []
- dl = db[1].execute("SELECT type, chtxt, title, btime, etime, deltatime ,deltaday ,opt FROM timeline WHERE id = %s ", (id, ))
- d = db[1].fetchall()
- for typet, chtxt, title, btime, etime, deltatime, deltaday, opt in d:
- ret = {}
- ret['type'] = typet
- ret['chtxt'] = chtxt
- ret['title'] = title
- btime = btime.strftime("%Y-%m-%d %H:%M:%S")
- etime = etime.strftime("%Y-%m-%d %H:%M:%S")
- ret['btime'] = btime
- ret['etime'] = etime
- ret['opt'] = opt
- if deltatime == None:
- deltatime = "3"
- if deltaday == None:
- deltaday = "7"
- if typet == 'key':
- ret['deltatime'] = deltatime
- elif typet == 'keyevery':
- ret['deltatime'] = deltatime
- ret['deltaday'] = deltaday
- recdata.append(ret)
- self.close_db(db)
- return recdata
- def select_all_epg_ch(self):
- db = self.connect_db()
- ret = db[1].execute("SELECT bctype,ontv,chtxt,chname,ch,csch,updatetime FROM epg_ch")
- ret = db[1].fetchall()
- self.close_db(db)
- return ret
- def select_by_chtxt_epg_ch(self, chtxt):
- db = self.connect_db()
- ret = db[1].execute("SELECT bctype,ontv,chtxt,ch,csch,updatetime FROM epg_ch WHERE chtxt=%s", (chtxt, ))
- ret = db[1].fetchall()
- self.close_db(db)
- return ret
- def add_timeline(self, type="", chtxt="", title="", btime="", etime="", deltatime="", deltaday="", opt=""):
- db = self.connect_db()
- db[1].execute('INSERT IGNORE INTO timeline (type,chtxt,title,btime,etime,deltatime,deltaday,opt) values (%s,%s,%s,%s,%s,%s,%s,%s)', (type, chtxt, title, btime, etime, deltatime, deltaday, opt))
- #db.commit()
- self.close_db(db)
- def schedule_timeline(self, btime, etime):
- db = self.connect_db()
- dbexe = "SELECT type,epg_ch.bctype,timeline.chtxt,timeline.title,timeline.btime,timeline.etime FROM timeline INNER JOIN epg_ch ON timeline.chtxt=epg_ch.chtxt"
- dbexe = dbexe + " WHERE NOT( ( timeline.etime <= %s ) OR ( timeline.btime >= %s ) )"
- db[1].execute(dbexe, (btime, etime))
- rets = []
- for typet, bctypet, chtxtt, titlet, btimet, etimet in db[1].fetchall():
- ret = [typet, bctypet, chtxtt, titlet, btimet.strftime("%Y-%m-%d %H:%M:%S"), etimet.strftime("%Y-%m-%d %H:%M:%S")]
- rets.append(ret)
- self.close_db(db)
- return rets
- def count_schedule_timeline(self, btime, etime):
- """
- count rectasknum
- return [te num,bs/cs num]
- """
- db = self.connect_db()
- dbexe = "SELECT type,epg_ch.bctype,timeline.chtxt,title FROM timeline INNER JOIN epg_ch ON timeline.chtxt=epg_ch.chtxt"
- dbexe = dbexe + " WHERE NOT( ( timeline.etime <= %s ) OR ( timeline.btime >= %s ) )"
- Srec = 0
- Trec = 0
- db[1].execute(dbexe, (btime, etime))
- for typet, bctypet, chtxtt, titlet in db[1].fetchall():
- if (typet == "reserve_flexible") or (typet == "reserve_fixed") or (typet == "search_today") or (typet == "search_everyday"):
- if bctypet.find("cs") > -1:
- Srec = Srec + 1
- elif bctypet.find("bs") > -1:
- Srec = Srec + 1
- elif bctypet.find("te") > -1:
- Trec = Trec + 1
- self.close_db(db)
- return [Trec, Srec]
- def del_by_id_timeline(self, id):
- db = self.connect_db()
- db[1].execute('DELETE FROM timeline WHERE id=' + id)
- self.close_db(db)
- def new_iepg(self):
- db = self.connect_db()
- try:
- db[1].execute("CREATE TABLE in_iepg \
- (\
- id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,\
- station VARCHAR(200) NOT NULL,\
- chtxt VARCHAR(30) NOT NULL\
- )")
- except:
- ""
- self.close_db(db)
- def add_iepg(self, station, chtxt):
- db = self.connect_db()
- db[1].execute('INSERT IGNORE INTO in_iepg (station,chtxt) VALUES (%s,%s)', (station, chtxt))
- self.close_db(db)
- def del_by_id_iepg(self, num):
- db = self.connect_db()
- db[1].execute("DELETE FROM in_iepg \
- WHERE id=%s", \
- (num, ))
- self.close_db(db)
- def select_by_chtxt_iepg(self, chtxt):
- db = self.connect_db()
- db[1].execute("\
- SELECT \
- id,station,chtxt \
- FROM in_iepg \
- WHERE chtxt=%s "\
- , (chtxt, ))
- retall = db[1].fetchall()
- self.close_db(db)
- rets = []
- if len(retall) > 0:
- for ret in retall:
- a = list(ret)
- a[0] = str(ret[0])
- rets.append(a)
- return rets
- def select_by_station_iepg(self, station):
- db = self.connect_db()
- db[1].execute("\
- SELECT \
- id,station,chtxt \
- FROM in_iepg \
- WHERE station=%s "\
- , (station, ))
- retall = db[1].fetchall()
- self.close_db(db)
- rets = []
- if len(retall) > 0:
- for ret in retall:
- a = list(ret)
- a[0] = str(ret[0])
- rets.append(a)
- return rets
- def select_all_iepg(self):
- db = self.connect_db()
- db[1].execute("\
- SELECT \
- id,station,chtxt \
- FROM in_iepg "\
- )
- retall = db[1].fetchall()
- self.close_db(db)
- rets = []
- if len(retall) > 0:
- for ret in retall:
- a = list(ret)
- a[0] = str(ret[0])
- rets.append(a)
- return rets
\ No newline at end of file
+++ /dev/null
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html lang="ja">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>Rec10 Simple Web Interface ver.0.9.1</title>
- <!-- dojo.jsの読み込み -->
- <script type="text/javascript" src="./dojo/dojo/dojo.js" djConfig="parseOnLoad:true">
- </script>
- <!-- テーマの読み込み -->
- <style type="text/css">
- @import "./dojo/dojo/resources/dojo.css";
- @import "./dojo/dijit/themes/tundra/tundra.css";
- </style>
- <script type="text/javascript">
- dojo.require("dojo.parser");
- // ※ ここで、使用するウィジェットの読み込みを行う
- dojo.require("dijit.form.Button");
- dojo.require("dijit.form.FilteringSelect");
- dojo.require("dijit.form.ValidationTextBox");
- dojo.require("dijit.form.NumberSpinner");
- dojo.require("dijit.form.CheckBox");
- dojo.require("dijit.form.Form");
- //dojo.require("dojox.date");
- function setType(value){
- if (value=="reserve_flexible"){
- //alert("Selected "+value);
- dijit.byId("deltaday").setDisabled(true);
- dijit.byId("deltahour").setDisabled(true);
- setDayopt(false);
- }else if (value=="reserve_day"){
- //alert("Selected "+value);
- dijit.byId("deltaday").setDisabled(true);
- dijit.byId("deltahour").setDisabled(false);
- setDayopt(false);
- }else if (value=="search_today"){
- dijit.byId("deltahour").setDisabled(false);
- setDayopt(true);
- }else if (value=="search_everyday"){
- //alert("Selected "+value);
- dijit.byId("deltaday").setDisabled(false);
- dijit.byId("deltahour").setDisabled(false);
- setDayopt(false);
- }else if (value=="reserve_fixed"){
- //alert("Selected "+value);
- dijit.byId("deltaday").setDisabled(true);
- dijit.byId("deltahour").setDisabled(true);
- setDayopt(false);
- }else if (value=="convert_ts_mp4"){
- dijit.byId("deltaday").setDisabled(true);
- dijit.byId("deltahour").setDisabled(true);
- setDayopt(false);
- }
-
- }
- function setDayopt(bool){
- dijit.byId("day_Sun").setDisabled(!bool);
- dijit.byId("day_Mon").setDisabled(!bool);
- dijit.byId("day_Tue").setDisabled(!bool);
- dijit.byId("day_Wed").setDisabled(!bool);
- dijit.byId("day_Thu").setDisabled(!bool);
- dijit.byId("day_Fri").setDisabled(!bool);
- dijit.byId("day_Sat").setDisabled(!bool);
- }
- function changeSize(){
- var str=dijit.byId("opts").value;
- var s=dijit.byId("size").value;
- str=str.replace("S","");
- str=str.replace("H","");
- str=str.replace("G","");
- str=str.replace("F","");
- str=str.replace("L","");
- str=str+s;
- //alert("Selected "+str);
- dijit.byId("opts").setValue(str);
-
- }
- function changeMove(){
- var str=dijit.byId("opts").value;
- var s=dijit.byId("move").value;
- str=str.replace("R","");
- str=str.replace("D","");
- str=str.replace("E","");
- s=s.replace("None","")
- str=str+s;
- //alert("Selected "+str);
- dijit.byId("opts").setValue(str);
- }
- function setOpts(obj){
- if (obj.checked){
- var str=dijit.byId("opts").value;
- str=str+obj.value;
- }else{
- var str=dijit.byId("opts").value;
- str=str.replace(obj.value,"");
- }
- dijit.byId("opts").setValue(str);
- }
- function changeOpts(){
- var str=dijit.byId("opts").value;
- if (str.indexOf("v")>-1){
- dijit.byId("vfr").setChecked(true);
- }else{
- dijit.byId("vfr").setChecked(false);
- }
- if (str.indexOf("2")>-1){
- dijit.byId("dualpass").setChecked(true);
- }else{
- dijit.byId("dualpass").setChecked(false);
- }
- if (str.indexOf("d")>-1){
- dijit.byId("dualaudio").setChecked(true);
- }else{
- dijit.byId("dualaudio").setChecked(false);
- }
- if (str.indexOf("5")>-1){
- dijit.byId("pentaaudio").setChecked(true);
- }else{
- dijit.byId("pentaaudio").setChecked(false);
- }
- if (str.indexOf("N")>-1){
- dijit.byId("datename").setChecked(true);
- }else{
- dijit.byId("datename").setChecked(false);
- }
- if (str.indexOf("S")>-1){
- dijit.byId("size").setValue("S");
- }else if (str.indexOf("H")>-1){
- dijit.byId("size").setValue("H");
- }else if (str.indexOf("G")>-1){
- dijit.byId("size").setValue("G");
- }else if (str.indexOf("F")>-1){
- dijit.byId("size").setValue("F");
- }else if (str.indexOf("L")>-1){
- dijit.byId("size").setValue("L");
- }else{
- changeSize();
- }
- if (str.indexOf("R")>-1){
- dijit.byId("move").setValue("R");
- }else if (str.indexOf("D")>-1){
- dijit.byId("move").setValue("D");
- }else if (str.indexOf("E")>-1){
- dijit.byId("move").setValue("E");
- }else{
- dijit.byId("move").setValue("None");
- }
- }
- function setbtime_now(){
- var now =new Date();
- now.getMinutes()
- var nm=now.getMinutes();
- nm=nm-nm%10;
- nm=nm+10;
- now.setMinutes(nm,0,0);
- setbtime(now);
- }
- function setetime_now(){
- var ds=dijit.byId("btime").value;
- var d=txt2date(ds);
- setetime(d);
- }
- function setnow(){
- var now =new Date();
- var nm=now.getMinutes();
- nm=nm-nm%10;
- nm=nm+10;
- now.setMinutes(nm,0,0);
- setbtime(now);
- setetime(now);
- }
- function txt2date(txt){
- var d=new Date;
- var ds=txt;
- if (ds.length>3){
- d.setYear(parseInt(ds.substring(0,4),10));
- }
- if (ds.length>6){
- d.setMonth(parseInt(ds.substring(5,7),10)-1);
- }
- if (ds.length>9){
- d.setDate(parseInt(ds.substring(8,10),10));
- }
- if (ds.length>12){
- d.setHours(parseInt(ds.substring(11,13),10));
- }
- if (ds.length>15){
- d.setMinutes(parseInt(ds.substring(14,16),10));
- }
- if (ds.length>18){
- d.setSeconds(parseInt(ds.substring(17,19),10));
- }
- return d
- }
- function add_btimemin(min){
- var ds=dijit.byId("btime").value;
- var d=txt2date(ds);
- //window.alert(ds.toString()+":"+d.toString());
- d.setTime(d.getTime()+min*60*1000);
- setbtime(d);
- }
- function add_etimemin(min){
- var ds=dijit.byId("etime").value;
- var d=txt2date(ds);
- d.setTime(d.getTime()+min*60*1000);
- setetime(d);
- }
-
- function setbtime(date){
- var nowtxt="";
- //window.alert("setbtime");
- nowtxt=String(date.getFullYear())+"-";
- if (date.getMonth()+1<10){
- nowtxt=nowtxt+"0";
- }
- nowtxt=nowtxt+String(date.getMonth()+1)+"-";
- if (date.getDate()<10){
- nowtxt=nowtxt+"0";
- }
- nowtxt=nowtxt+String(date.getDate())+" ";
- if (date.getHours()<10){
- nowtxt=nowtxt+"0"
- }
- nowtxt=nowtxt+String(date.getHours())+":";
- if (date.getMinutes()<10){
- nowtxt=nowtxt+"0"
- }
- nowtxt=nowtxt+String(date.getMinutes())+":00";
- //console.debug("click");
- //window.alert("test");
- dijit.byId("btime").setValue(nowtxt);
- }
- function setetime(date){
- var nowtxt="";
- //window.alert("test");
- nowtxt=String(date.getFullYear())+"-";
- if (date.getMonth()+1<10){
- nowtxt=nowtxt+"0";
- }
- nowtxt=nowtxt+String(date.getMonth()+1)+"-";
- if (date.getDate()<10){
- nowtxt=nowtxt+"0";
- }
- nowtxt=nowtxt+String(date.getDate())+" ";
- if (date.getHours()<10){
- nowtxt=nowtxt+"0"
- }
- nowtxt=nowtxt+String(date.getHours())+":";
- if (date.getMinutes()<10){
- nowtxt=nowtxt+"0"
- }
- nowtxt=nowtxt+String(date.getMinutes())+":00";
- //console.debug("click");
- //window.alert("test");
- dijit.byId("etime").setValue(nowtxt);
- }
- function title2opts(){
- var str=dijit.byId("title").value;
- var stropt=dijit.byId("opts").Value;
- if (stropt==undefined){
- stropt="";
- }
- //stropt=stropt.replace("undefined","");
- //stropt=""
- if (str.indexOf("(2)")>-1){
- //dijit.byId("dualpass").setChecked(true);
- str=stropt+"d";
- dijit.byId("opts").setValue(str);
- }else if(str.indexOf("(二)")>-1){
- //dijit.byId("dualpass").setChecked(true);
- str=stropt+"d";
- dijit.byId("opts").setValue(str);
- }else if(str.indexOf("[二]")>-1){
- //dijit.byId("dualpass").setChecked(true);
- str=stropt+"d";
- dijit.byId("opts").setValue(str);
- }else if(str.indexOf("(二)")>-1){
- //dijit.byId("dualpass").setChecked(true);
- str=stropt+"d";
- dijit.byId("opts").setValue(str);
- }else if(str.indexOf("(二)")>-1){
- //dijit.byId("dualpass").setChecked(true);
- str=stropt+"d";
- dijit.byId("opts").setValue(str);
- }else if(str.indexOf("5.1")>-1){
- //dijit.byId("dualpass").setChecked(true);
- str=stropt+"5";
- dijit.byId("opts").setValue(str);
- }else if(str.indexOf("5.1")>-1){
- //dijit.byId("dualpass").setChecked(true);
- str=stropt+"5";
- dijit.byId("opts").setValue(str);
- }
- }
- //dojo.addOnLoad(init);
- function init(){
- //dojo.debug("test")
- setType("res");
- title2opts();
- changeSize();
- changeOpts();
- //changeSize();
- }
- dojo.addOnLoad(init);
- </script>
- </head>
- <!-- テーマの読み込み -->
- <body class="tundra">
- <div dojoType="dijit.form.Form" action="rec10web.py" onExecute="this.submit()">
- <h1>Rec10 Simple Web Interface ver.0.9.0</h1><br>
- Rec10WEB MENU <a href="./rec10web.py?exec=schedule">Schedule</a> <a href="./rec10web.py?exec=iepg-show">iEPG-Data</a><br><br><br>
- <select name="type"
- dojoType="dijit.form.FilteringSelect"
- autocomplete="false"
- value="<!--type-value//-->"
- onChange="setType">
- <option value="reserve_flexible">通常予約</option>
- <option value="search_today">キーワード予約</option>
- <option value="search_day">曜日予約</option>
- <option value="search_everyday">隔日予約</option>
- <option value="reserve_fixed">最終予約</option>
- <option value="convert_ts_mp4">エンコード予約</option>
- <option value="convert_b25_ts">復号化予約</option>
- <option value="convert_avi_mp4">MP4化予約(AVI)</option>
- <option value="convert_mkv_mp4">MP4化予約(MKV)</option>
- <option value="convert_avi_mkv">MKV化予約(AVI)</option>
-
- </select>番組名/キーワード
- <input type="text"
- length="40"
- dojoType="dijit.form.TextBox"
- value="<!--title-value//-->"
- id="title"
- name="title">
- チャンネル
- <select name="chtxt"
- dojoType="dijit.form.FilteringSelect"
- autocomplete="false"
- value="<!--ch-value//-->"
- onChange="setType">
- <!--text_for_replace_chtxt_input//-->
- </select>
- <br><br>開始時刻
- <div name="btime"
- id="btime"
- dojoType="dijit.form.ValidationTextBox"
- promptmessage="年-月-日 時間:分:秒"
- value="<!--btime-value//-->"
- regexp="\d{4}\-\d{2}\-\d{2} \d{2}\:\d{2}\:\d{2}">
- </div>
- <div dojoType="dijit.form.Button" onclick="setbtime_now()">現在</div>
- <div dojoType="dijit.form.Button" onclick="add_btimemin(5)">+5m</div>
- <div dojoType="dijit.form.Button" onclick="add_btimemin(30)">+30m</div>
- <div dojoType="dijit.form.Button" onclick="add_btimemin(180)">+3h</div>
- <div dojoType="dijit.form.Button" onclick="add_btimemin(720)">+12h</div>
- 終了時刻
- <div name="etime"
- id="etime"
- dojoType="dijit.form.ValidationTextBox"
- promptmessage="年-月-日 時間:分:秒"
- value="<!--etime-value//-->"
- regexp="\d{4}\-\d{2}\-\d{2} \d{2}\:\d{2}\:\d{2}">
- </div>
- <div dojoType="dijit.form.Button" onclick="setetime_now()">一致</div>
- <div dojoType="dijit.form.Button" onclick="add_etimemin(1)">+1m</div>
- <div dojoType="dijit.form.Button" onclick="add_etimemin(5)">+5m</div>
- <div dojoType="dijit.form.Button" onclick="add_etimemin(30)">+30m</div>
- <div dojoType="dijit.form.Button" onclick="add_etimemin(60)">+1h</div>
- <br>
- <br>隔日周期(days)
- <input dojoType="dijit.form.NumberSpinner"
- value="7"
- smallDelta="1"
- largeDelta="10"
- constraints="{min:0,max:24,places:0}"
- maxlength="2"
- id="deltaday"
- name="deltaday">
- キーワード録画許容誤差(hours)
- <input dojoType="dijit.form.NumberSpinner"
- value="3"
- smallDelta="1"
- largeDelta="10"
- constraints="{min:0,max:24,places:0}"
- maxlength="2"
- id="deltahour"
- name="deltahour"><br><br>
-
- <input type="checkbox"
- dojoType="dijit.form.CheckBox"
- id="day_Mon" name="day_Mon" value="1">月曜
- <input type="checkbox"
- dojoType="dijit.form.CheckBox"
- id="day_Tue" name="day_Tue" value="2">火曜
- <input type="checkbox"
- dojoType="dijit.form.CheckBox"
- id="day_Wed" name="day_Wed" value="3">水曜
- <input type="checkbox"
- dojoType="dijit.form.CheckBox"
- id="day_Thu" name="day_Thu" value="4">木曜
- <input type="checkbox"
- dojoType="dijit.form.CheckBox"
- id="day_Fri" name="day_Fri" value="5">金曜
- <input type="checkbox"
- dojoType="dijit.form.CheckBox"
- id="day_Sat" name="day_Sat" value="6">土曜
- <input type="checkbox"
- dojoType="dijit.form.CheckBox"
- id="day_Sun" name="day_Sun" value="7">日曜
- 処理後自動移動オプション
- <select name="move"
- dojoType="dijit.form.FilteringSelect"
- autocomplete="false"
- value="None"
- id="move"
- onChange="changeMove">
- <option selected="selected" value="None">移動しない</option>
- <option value="R">録画後移動</option>
- <option value="D">復号後移動</option>
- <option value="E">縁故後移動</option>
- </select>
- <br><br>
- 録画サイズ
- <select name="size"
- dojoType="dijit.form.FilteringSelect"
- autocomplete="false"
- value="<!--size-value//-->"
- id="size"
- onChange="changeSize">
- <option selected="selected" value="S">SDサイズ(720x480 1250kbps)</option>
- <option value="L">CS放送SDサイズ(リサイズ無し 1250kbps)</option>
- <option value="G">低画質HDサイズ(1280x720 2500kbps)</option>
- <option value="H">HDサイズ(1280x720 3750kbps)</option>
- <option value="F">フルハイビジョン(1920x1080 5000kbps)</option>
- </select>
- <input type="checkbox"
- dojoType="dijit.form.CheckBox"
- id="vfr" name="vfr" value="v"
- onClick="setOpts(this)">可変フレームレート
- <input type="checkbox"
- dojoType="dijit.form.CheckBox"
- id="dualaudio" name="dualaudio" value="d"
- onClick="setOpts(this)">二ヶ国語放送
- <input type="checkbox"
- dojoType="dijit.form.CheckBox"
- id="pentaaudio" name="pentaaudio" value="5"
- onClick="setOpts(this)">5.1ch放送
- <input type="checkbox"
- dojoType="dijit.form.CheckBox"
- id="dualpass" name="dualpass" value="2"
- onClick="setOpts(this)">2passモード
- <input type="checkbox"
- dojoType="dijit.form.CheckBox"
- id="datename" name="datename" value="N"
- onClick="setOpts(this)">タイトル日付追加
- Options
- <div name="opts"
- dojoType="dijit.form.ValidationTextBox"
- value="<!--opts-value//-->"
- onChange="changeOpts"
- id="opts">
- </div>
- <div dojoType="dijit.form.Button" type="submit">予約</div>
- <div name="exec"
- dojoType="dijit.form.ValidationTextBox"
- value="<!--exec-value//-->"
- style="display:none";>
- </div>
- </div>
-</body>
-</html>
\ No newline at end of file
+++ /dev/null
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html lang="ja">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <meta http-equiv="Content-Style-Type" content="text/css">
- <meta http-equiv="Content-Script-Type" content="text/javascript">
- <title>Rec10Web Schedule管理</title>
- <script src="./dojo/dojo/dojo.js" djConfig="parseOnLoad:true">
- </script>
- <!-- テーマの読み込み -->
- <style type="text/css">
- @import "./dojo/dojo/resources/dojo.css";
- @import "./dojo/dijit/themes/tundra/tundra.css";
- @import "./dojo/dojox/grid/resources/Grid.css";
- @import "./dojo/dojox/grid/resources/tundraGrid.css";
- </style>
- <script type="text/javascript">
- <!--
- dojo.require('dojo.parser');
- dojo.require('dojox.grid.DataGrid');
- dojo.require('dojo.data.ItemFileReadStore');
- dojo.require('dojox.data.CsvStore');
- dojo.require("dijit.form.Form");
- dojo.require('dijit.form.FilteringSelect');
- dojo.require('dijit.form.Button');
- // グリッドに表示する元データをロード
- var store = new dojox.data.CsvStore({url:'./recdatum.csv'});
- function click(){
- var items=dijit.byId("grid").selection.getSelected();
- var str="";
- for (i=0;i<items.length;i++){
- var s=dijit.byId("grid").store.getValue(items[i],"id");
- str=str+s+",";
- }
- dijit.byId("tasknum").setValue(str);
- }
- -->
- </script>
- </head>
-
- <!-- テーマの読み込み -->
- <body class="tundra">
- <div dojoType="dijit.form.Form" action="rec10web.py" onExecute="this.submit()">
- <table
- id="grid"
- name="grid"
- dojoType="dojox.grid.DataGrid"
- store="store"
- query="{id:'*'}"
- autoHeight="true"
- width="100%"
- autoWidth="true"
- clientSort="true"
- onClick="click">
- <thead>
- <tr>
- <th width="30px" field="id">ID</th>
- <th width="90px" field="type">タイプ</th>
- <th width="50px" field="chtxt">チャンネル</th>
- <th width="150px" field="title">タイトル</th>
- <th width="100px" field="btime">開始</th>
- <th width="100px" field="etime">終了</th>
- <th width="30px" field="opt">オプション</th>
- <th width="50px" field="deltaday">周期</th>
- </tr>
- </thead>
- </table>
- <select name="exec"
- dojoType="dijit.form.FilteringSelect"
- autocomplete="false"
- value="del"
- onChange="setType">
- <option value="del">削除(複数同時可能)</option>
- <option value="change">変更(最後に選択したもの)</option>
- </select>
- <div dojoType="dijit.form.Button" type="submit">実行</div>
- <div dojoType="dijit.form.TextBox"
- name="tasknum"
- id="tasknum"
- value=""
- style="display:none">
- </div>
- </div>
- </body>
-</html>
+++ /dev/null
-#!/usr/bin/perl
-use strict;
-use KCatch;
-use Config::Simple;
-use DBI;
-use CGI::Minimal;
-use SVG;
-use Time::Piece;
-use Encode;
-use Text::Ngram;
-use utf8;
-our $svg="";
-our $dbh;
-my $cgi=CGI::Minimal->new;
-my $nHTML="";
-
-my $cfg = new Config::Simple;
-if ( -e '/etc/rec10.conf' ) {
- $cfg->read( '/etc/rec10.conf' );
-}
-my $sql = $cfg->param( 'db.db' );
-if ( $sql eq 'MySQL') {
- my $name = $cfg->param( 'db.mysql_dbname' );
- my $host = $cfg->param( 'db.mysql_host' );
- my $port = $cfg->param( 'db.mysql_port' );
- my $user = $cfg->param( 'db.mysql_user' );
- my $pass = $cfg->param( 'db.mysql_passwd' );
- $dbh = DBI->connect("dbi:mysql:$name:$host:$port", $user, $pass, {
- AutoCommit => 1,
- RaiseError => 1,
- });
- $dbh->do( 'SET NAMES utf8' );
-}
-my $btimenow=localtime;
-my $etimenow=$btimenow+12*60*60;
-if ($cgi->param('mode') eq "graph"){
- $nHTML ="";
- $nHTML = qq {Content-type:image/svg+xml\n\n};
- my $date = Time::Piece->strptime($cgi->param('btime'),'%Y-%m-%d_%H-%M-%S');
- my $date2 = Time::Piece->strptime($cgi->param('etime'),'%Y-%m-%d_%H-%M-%S');
- my $ddate = $date2-$date;
- my $dtime = $ddate->hours;
- if ($dtime<1){
- $dtime=1;
- }
- $nHTML .= chtimesvg($cgi->param('chtxt'),$date,$dtime);
-}elsif ($cgi->param('mode') eq "timegraph"){
- $nHTML ="";
- $nHTML = qq {Content-type:image/svg+xml\n\n};
- my $date = Time::Piece->strptime($cgi->param('btime'),'%Y-%m-%d_%H-%M-%S');
- my $date2 = Time::Piece->strptime($cgi->param('etime'),'%Y-%m-%d_%H-%M-%S');
- my $ddate = $date2-$date;
- my $dtime = $ddate->hours;
- if ($dtime<1){
- $dtime=1;
- }
- $nHTML .= timesvg($date,$dtime);
-}elsif ($cgi->param('mode') eq "table"){
- $nHTML ="";
- $nHTML = qq {Content-type:application/xhtml+xml\n\n};
- my $date = Time::Piece->strptime($cgi->param('btime'),'%Y-%m-%d_%H-%M-%S');
- my $date2 = Time::Piece->strptime($cgi->param('etime'),'%Y-%m-%d_%H-%M-%S');
- my $ddate = $date2-$date;
- my $dtime = $ddate->hours;
- if ($dtime<1){
- $dtime=1;
- }
- $nHTML .= timesvg($date,$dtime);
-}else{
- if ($cgi->param('btime')ne ""){
- $btimenow=Time::Piece->strptime($cgi->param('btime'),'%Y-%m-%d_%H-%M-%S');
- }
- if ($cgi->param('etime')ne ""){
- $etimenow=Time::Piece->strptime($cgi->param('etime'),'%Y-%m-%d_%H-%M-%S');
- }
- my $ch1=$cgi->param('ch1');
- my $ch2=$cgi->param('ch2');
- my $ch3=$cgi->param('ch3');
- my $btxt=$btimenow->strftime('%Y-%m-%d_%H-00-00');
- my $etxt=$etimenow->strftime('%Y-%m-%d_%H-00-00');
- my $btxtnew2=$etimenow;
- my $etxtnew2=$etimenow+18*60*60;
- my $hdate=localtime;
- $hdate=$hdate+1*60*60;
- my $btxtnew1;
- my $etxtnew1;
- if ($btimenow<$hdate){
- $btxtnew1=$btimenow;
- $etxtnew1=$etimenow;
- }else{
- $btxtnew1=$btimenow-18*60*60;
- $etxtnew1=$btimenow;
- }
- my @clist=@{db_select_chlist()};
- my $chtxtlist ="";
- if ($ch1 eq ""){
- $ch1=$clist[0][0];
- }
- if ($ch2 eq ""){
- $ch2=$clist[1][0];
- }
- if ($ch3 eq ""){
- $ch3=$clist[2][0];
- }
- my $blink="rec10webg2.pl?ch1=$ch1&ch2=$ch2&ch3=$ch3&btime=".$btxtnew1->strftime('%Y-%m-%d_%H-%M-%S')."&etime=".$etxtnew1->strftime('%Y-%m-%d_%H-%M-%S');
- my $alink="rec10webg2.pl?ch1=$ch1&ch2=$ch2&ch3=$ch3&btime=".$btxtnew2->strftime('%Y-%m-%d_%H-%M-%S')."&etime=".$etxtnew2->strftime('%Y-%m-%d_%H-%M-%S');
- foreach my $cht (@clist){
- my @cht2=@{$cht};
- my $chn=$cht2[1];
- utf8::decode($chn);
- $chtxtlist=$chtxtlist."<option value=\"$cht2[0]\">$chn</option>\n";
- }
- my $chtxtlist1 = $chtxtlist;
- my $chtxtlist2 = $chtxtlist;
- my $chtxtlist3 = $chtxtlist;
- $chtxtlist1 =~ s/$ch1"/$ch1" selected="selected"/;
- $chtxtlist2 =~ s/$ch2"/$ch2" selected="selected"/;
- $chtxtlist3 =~ s/$ch3"/$ch3" selected="selected"/;
- $nHTML .= qq {Content-type:application/xhtml+xml\n\n};
- $nHTML .= qq {<?xml version="1.0" encoding="UTF-8"?>\n};
- $nHTML .= qq {<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"\n"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n};
- $nHTML .= qq {<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">\n};
- $nHTML .= qq {<head>\n};
- $nHTML .= qq {<title>Rec10WEB G2 番組表 ver alpha 2010-03-15};
- $nHTML .= qq {</title>\n};
- $nHTML .= qq {</head>\n};
- $nHTML .= qq {<body>\n};
- $nHTML .= qq {<form action="rec10webg2.pl">\n};
- $nHTML .= qq {<p>Rec10WEB G2 alpha</p>\n};
- $nHTML .= qq {<p>Rec10 番組表</p>\n};
- $nHTML .= qq {<p style="width:100%;height:10%;buttom:2%;position:relative;">};
- $nHTML .= qq {<select size="1" name="ch1" style="left:3%;width:30%;height:100%;position:relative;">\n};
- $nHTML .= $chtxtlist1;
- $nHTML .= qq {</select>\n};
- $nHTML .= qq {<select size="1" name="ch2" style="left:3%;width:30%;height:100%;position:relative;">\n};
- $nHTML .= $chtxtlist2;
- $nHTML .= qq {</select>\n};
- $nHTML .= qq {<select size="1" name="ch3" style="left:3%;width:30%;height:100%;position:relative;">\n};
- $nHTML .= $chtxtlist3;
- $nHTML .= qq {</select>\n};
- $nHTML .= qq {<input type="submit" name="submit" value="表示" style="left:3%;width:3%;position:relative;"/>\n};
- $nHTML .= qq {</p>\n};
- $nHTML .= qq {<div style="width:100%;height:82%;bottom:3%;position:fixed;">\n};
- $nHTML .= qq {<object type="image/svg+xml" data="rec10webg2.pl?mode=timegraph&btime=$btxt&etime=$etxt" style="width:3%;height:100%;">\n};
- $nHTML .= qq {SVG Timeline\n};
- $nHTML .= qq {</object>\n};
- $nHTML .= qq {<object type="image/svg+xml" data="rec10webg2.pl?mode=graph&chtxt=$ch1&btime=$btxt&etime=$etxt" style="width:30%;height:100%;">\n};
- $nHTML .= qq {SVG Timeline\n};
- $nHTML .= qq {</object>\n};
- $nHTML .= qq {<object type="image/svg+xml" data="rec10webg2.pl?mode=graph&chtxt=$ch2&btime=$btxt&etime=$etxt" style="width:30%;height:100%;">\n};
- $nHTML .= qq {SVG Timeline\n};
- $nHTML .= qq {</object>\n};
- $nHTML .= qq {<object type="image/svg+xml" data="rec10webg2.pl?mode=graph&chtxt=$ch3&btime=$btxt&etime=$etxt" style="width:30%;height:100%;">\n};
- $nHTML .= qq {SVG Timeline\n};
- $nHTML .= qq {</object>\n};
- $nHTML .= qq {<object type="image/svg+xml" data="rec10webg2.pl?mode=timegraph&btime=$btxt&etime=$etxt" style="width:3%;height:100%;">\n};
- $nHTML .= qq {SVG Timeline\n};
- $nHTML .= qq {</object>\n};
- $nHTML .= qq {</div>\n};
- $nHTML .= qq {<p style="bottom:1%;position:fixed;">\n};
- $nHTML .= qq {<a href="$blink" style="left:0%;position:fixed;">前へ</a>\n};
- $nHTML .= qq {<a href="$alink" style="right:3%;position:fixed;">次へ</a>\n};
- $nHTML .= qq {</p>\n};
- $nHTML .= qq {</form>\n};
- $nHTML .= qq {</body>\n};
- $nHTML .= qq {</html>\n};
-}
-print encode('utf-8',$nHTML);
-sub db_select_auto_bayes_timeline{#chtxt,btime,etime
- my $ary_db = $dbh->selectall_arrayref(
- "SELECT chtxt,title, btime, etime, point FROM auto_timeline_bayes"
- ."WHERE btime >= \"".$_[1]."\" "
- ."AND "
- ."etime <= \"".$_[2]."\""
- ."AND "
- ."chtxt = \"".$_[0]."\""
- );
- return $ary_db;
-}
-sub db_select_auto_jbk_timeline{#chtxt,btime,etime
- my $ary_db = $dbh->selectall_arrayref(
- "SELECT chtxt,title, btime, etime, point FROM auto_timeline_keyword"
- ."WHERE btime >= \"".$_[1]."\" "
- ."AND "
- ."etime <= \"".$_[2]."\""
- ."AND "
- ."chtxt = \"".$_[0]."\""
- );
- return $ary_db;
-}
-sub db_select_timeline{
- my $ary_db = $dbh->selectall_arrayref(
- "SELECT type, chtxt, title, btime, etime, deltatime ,deltaday ,opt FROM timeline"
- );
- return $ary_db;
-}
-sub db_select_chtxt_btime_etime_timeline{#chtxt,btime,etime
- my $ary_db = $dbh->selectall_arrayref(
- "SELECT type, chtxt, title, btime, etime FROM timeline"
- ."WHERE btime >= \"".$_[1]."\" "
- ." AND "
- ."etime <= \"".$_[2]."\""
- ."AND "
- ."chtxt = \"".$_[0]."\""
- );
- return $ary_db;
-}
-sub db_select_chlist{
- my $dbe="SELECT chtxt,chname FROM epg_ch";
- my $ary_db = $dbh->selectall_arrayref($dbe);
- return $ary_db;
-}
-sub db_select_epg_ch{#chtxt#btime#etime
- my $dbe="SELECT epg_ch.chtxt,title,start,stop,exp,longexp,category FROM epg_timeline "
- ."INNER JOIN epg_ch "
- ."WHERE epg_ch.ontv=epg_timeline.channel "
- ."AND "
- ."start >= \"".$_[1]."\" "
- ."AND "
- ."stop <= \"".$_[2]."\" "
- ."AND "
- ."epg_ch.chtxt=\"".$_[0]."\"";
- my $ary_db = $dbh->selectall_arrayref($dbe);
- #print "$ary_db->[0][2]\n";
- return $ary_db;
-}
-#該当する番組の状況を調べる
-sub check_program{#chtxt#btime#etime#title 0:normal 1:bayesおすすめ 2:jbkおすすめ 8:予約がいっぱい 9:予約済み 10:予約済みduplicate 11: 予約済みepg変更
- my $ret=0;
- my $dbt="SELECT type, chtxt, title, btime, etime ,epgduplicate ,epgchange FROM timeline "
- ."WHERE btime >= \"".$_[1]."\" "
- ." AND "
- ."etime <= \"".$_[2]."\""
- ." AND "
- ."chtxt = \"".$_[0]."\""
- ." AND "
- ."title = \"".$_[3]."\"";
- my $ary_db = $dbh->selectall_arrayref($dbt);
- my @ary=@{$ary_db};
- if ($#ary>-1){##該当が一件以上
- #die @ary;
- my @dbl=@ary;
- #die @dbl;
- if (int($dbl[5])>0){
- $ret=10;
- }elsif (int($dbl[6])>0){
- $ret=11;
- }else{
- $ret=9;
- }
- }else{
- $ret=0;
- }
- return $ret;
-}
-sub timesvg{#btime,dtime
- $svg = SVG -> new(
- width=>"100%",height=>"100%",
- );
- my $btime = $_[0]->strftime( '%Y-%m-%d %H:00:00' );
- my $bt = Time::Piece->strptime($btime,'%Y-%m-%d %H:%M:%S');
- $bt = $bt + 3600;
- for (my $i = 0; $i <= $_[1]-2;$i++){
- my $btt= $bt + 3600*$i;
- my $tit = $btt->strftime( '%Y%m%d%H' );
- if (substr($tit,8,2)eq "00"){
- $tit = substr($tit,4,2)."/".substr($tit,6,2);
- }else{
- $tit = substr($tit,8,2).":00";
- }
- my $btime2=$btt-$_[0];
- my $y=$btime2->minutes;
- $y=$y*100/60/$_[1];
- $svg->text(
- font_size => "100%",
- x=>"0%",y=>"$y%",
- -cdata=>$tit
- );
- }
- my $out = $svg->xmlify(
- -pubid => "-//W3C//DTD SVG 1.1//EN",
- -dtd => "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd",
- );
- my $b ="http:\/\/www\.w3\.org\/TR\/2001\/REC-SVG-20010904\/DTD\/svg10\.dtd";
- my $e ="http:\/\/www\.w3\.org\/Graphics\/SVG\/1\.1\/DTD\/svg11\.dtd";
- $out =~ s/$b/$e/;
- return $out;
-}
-sub chtimesvg{#chtxt,btime,dtime
- $svg = SVG -> new(
- width=>"100%",height=>"100%",
- );
- my $bt = $_[1];
- my $btime = $bt->strftime( '%Y%m%d%H%M%S' );
- my $et = $bt + $_[2]*3600;
- my $etime = $et->strftime( '%Y%m%d%H%M%S' );
- my @auto_bayes = @{db_select_epg_ch($_[0],$btime,$etime)};#chtxt#btime#etime
- my @dbl =@{db_select_epg_ch($_[0],$btime,$etime)};
- foreach my $tt (@dbl){
- my @tt2=@{$tt};
- my $bttime2=substr($tt2[2],0,4)."-".substr($tt2[2],4,2)."-".substr($tt2[2],6,2)
- ." ".substr($tt2[2],8,2).":".substr($tt2[2],10,2).":".substr($tt2[2],12,2);
- my $ettime2=substr($tt2[3],0,4)."-".substr($tt2[3],4,2)."-".substr($tt2[3],6,2)
- ." ".substr($tt2[3],8,2).":".substr($tt2[3],10,2).":".substr($tt2[3],12,2);
- my $bttime=Time::Piece->strptime($bttime2,'%Y-%m-%d %H:%M:%S');
- my $ettime=Time::Piece->strptime($ettime2,'%Y-%m-%d %H:%M:%S');
- my $btime2=$bttime-$bt;
- my $y=$btime2->minutes;
- #$y=$y*100/60/$_[2];
- $y=$y*100/60/$_[2];
- my $h=($ettime-$bttime);
- $h=$h->minutes;
- #$h=$h*100/60/$_[2];
- $h=$h*100/60/$_[2];
- my $colin="Snow";
- my $colout="LemonChiffon";
- my $colorchar="Black";
- my $cat = $tt2[6];
- my $type = 0;##typeは表示タイプ 0:normal 1:bayesおすすめ 2:jbkおすすめ 8:予約がいっぱい 9:予約済み
-
- foreach my $ab (@auto_bayes){
- my @ab2=@{$ab};
- #print "Content-Type: application/xhtml+xml\n\n";
- #print $ab2[2];
- my $btt=substr($ab2[2],0,4)."-".substr($ab2[2],4,2)."-".substr($ab2[2],6,2)
- ." ".substr($ab2[2],8,2).":".substr($ab2[2],10,2).":".substr($ab2[2],12,2);
- my $ett=substr($ab2[3],0,4)."-".substr($ab2[3],4,2)."-".substr($ab2[3],6,2)
- ." ".substr($ab2[3],8,2).":".substr($ab2[3],10,2).":".substr($ab2[3],12,2);
- my $tbtime=Time::Piece->strptime($btt,'%Y-%m-%d %H:%M:%S');
- my $tetime=Time::Piece->strptime($ett,'%Y-%m-%d %H:%M:%S');
- if ((($bttime-$tbtime)<30*60)&&(($tetime-$ettime)<30*60)&&(length($tt2[1])>0)&&(length($ab2[1])>0)){
- my $str1=$tt2[1];
- utf8::decode($str1);
- my $str2=$ab2[1];
- utf8::decode($str2);
- my %ng=Text::Ngram->ngram_counts({spaces=>0},$str1,2);
- my $ddbtime=$tbtime-$bttime+1;
- $ddbtime=abs($ddbtime);
- my $dp=1000-1000*$ddbtime/(7 * 24 * 60 * 60);
- my $point=0;
- use Data::Dumper;
- while ((my $key,my $value) = each(%ng)){
- my $i=$str2;
- #die Dumper($key);
- $i=$i=~ s/$key//g;
- if ($i>0){
- #die $i;
- $i=90+10*$i;
- }else{
- $i=0;
- }
- $point += $i;
- }
- if ($point>0){
- $point += $dp;
- die $point;
- }
- if ($point>1200){
- $type=1;
- #die $point;
- }
- }
- }
- #epg_ch.chtxt,title,start,stop,exp,longexp,category
- $type = check_program($tt2[0],$bttime2,$ettime2,$tt2[1]);
- utf8::decode($cat);
- my $title;
- $title=$tt2[1];
- if ($cat eq "その他"){
- $colin="Snow";
- $colout="LemonChiffon";
- }elsif($cat eq "情報"){
- $colin="LightGoldenrodYellow";
- $colout="Khaki";
- }elsif ($cat eq "ニュース・報道"){
- $colin="PeachPuff";
- $colout="LightPink";
- }elsif ($cat eq "アニメ・特撮"){
- $colin="AliceBlue";
- $colout="DodgerBlue";
- }elsif ($cat eq "バラエティ"){
- $colin="LightPink";
- $colout="Coral";
- }elsif ($cat eq "スポーツ"){
- $colin="Honeydew";
- $colout="GreenYellow";
- }elsif ($cat eq "音楽"){
- $colin="Plum";
- $colout="Orchid";
- }elsif ($cat eq "映画"){
- $colin="BurlyWood";
- $colout="RosyBrown";
- }
- if ($type==1){##braviaモード
- #$colin="white";
- $colorchar="Green";
- }elsif ($type==2){##jbkモード
- $colorchar="Blue";
- }elsif ($type==8){##予約がいっぱい
- $colorchar="Gray";
- }elsif ($type==9){##録画予約済み
- $colorchar="Orange";
- }elsif ($type==10){##10:予約済みduplicate
- $colorchar="Red";
- }elsif ($type==11){##録画予約済みchange
- $colorchar="Green";
- }
- my $link="rectool.pl?mode=confirm&mode_sub=reserve&chtxt=".$_[0]."&start=".$bttime->strftime( '%Y%m%d%H%M%S' )."&stop=".$ettime->strftime( '%Y%m%d%H%M%S' );
- getrect(0,$y,100,$h,$title,$tt2[4],$link,$colout,$colin,substr($tt2[2],8,4)." - ".substr($tt2[3],8,4),$colorchar);#x,y,width,height,title,desc,link,colorout,colorin
- }
- #print "</body></html>";
- my $out = $svg->xmlify(
- -pubid => "-//W3C//DTD SVG 1.1//EN",
- -dtd => "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd",
- );
- my $b ="http:\/\/www\.w3\.org\/TR\/2001\/REC-SVG-20010904\/DTD\/svg10\.dtd";
- my $e ="http:\/\/www\.w3\.org\/Graphics\/SVG\/1\.1\/DTD\/svg11\.dtd";
- $out =~ s/$b/$e/;
- return $out;
-}
-sub getrect(){#x,y,width,height,title,desc,link,colorout,colorin,timedesc,colorfont
- my $x=shift;
- my $y=shift;
- my $width=shift;
- my $height=shift;
- my $title=shift;
- my $desc= shift;
- my $link= shift;
- my $colorout= shift;
- my $colorin = shift;
- my $timechar = shift;
- my $colorchar = shift;
- my $ttxt=$title." ".$desc;
- utf8::decode($ttxt);
- utf8::decode($title);
- utf8::decode($desc);
- my $anc = $svg -> anchor(
- -href => $link,
- 'target' => '_blank',
- -title => $ttxt
- );
- my $bgrec=$anc->group(
- style=>{stroke=>"black",fill=>"black"}
- );
- $bgrec->rectangle(
- x=>"$x%",y=>"$y%",
- width=>"$width%",height=>"$height%",
- rx=>3.0,ry=>3.0,
- #"stroke-width"=>"3",
- );
- my $rec1=$anc->group(
- #style=>{stroke=>$colorout,fill=>$colorin}
-
- ##############################test
- style=>{stroke=>$colorout,fill=>$colorin}
-
- );
- my $charcol=$anc->group(
- style=>{fill=>$colorchar}
- );
- $rec1->rectangle(
- x=>"$x%",y=>"$y%",
- width=>"$width%",height=>"$height%",
- rx=>3.0,ry=>3.0,
- #'onmouseover'=>"evt.target.setAttribute('fill','yellow');",
- #'onmouseout'=>"evt.target.setAttribute('fill',$colorin);"
- #"stroke-width"=>"3",
- );
- if ($height>4){
- $charcol ->text(
- style => {
- 'font-size' => "60%",
- },
-
- x=>"$x%",y=>($y+4)."%",
- -cdata=>$timechar,
- );
- }
- if ($height>2){
- $charcol ->text(
- style => {
- 'font-size' => "80%",
- },
- x=>"$x%",y=>($y+2)."%",
- -cdata=>$title
- );
- }
- return ;
-}
+++ /dev/null
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\r
-<html dir="ltr">\r
- <head>\r
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">\r
- <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dijit/themes/claro/claro.css">\r
- <style type="text/css">\r
- body, html { font-family:helvetica,arial,sans-serif; font-size:90%; }\r
- </style>\r
- <style type="text/css">\r
- html, body { width: 100%; height: 100%; margin: 0; overflow:hidden; }\r
- #borderContainerTwo { width: 100%; height: 100%; }\r
- </style>\r
- <title>Rec10Suite 0.0.3</title>\r
- <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js" type="text/javascript" djConfig="parseOnLoad : true, isDebug : true"></script>\r
- <script type="text/javascript">\r
- dojo.require("dijit.layout.ContentPane");\r
- dojo.require("dijit.layout.TabContainer");\r
- dojo.require("dijit.layout.AccordionContainer");\r
- dojo.require("dijit.layout.BorderContainer");\r
- dojo.require("dojo.data.ItemFileReadStore");\r
- dojo.require("dijit.form.FilteringSelect");
- dojo.require("dijit.form.TextBox");
- dojo.require("dijit.form.Button");\r
- dojo.require("dijit.form.DateTextBox");\r
- dojo.require("dijit.form.TimeTextBox");\r
- dojo.require("dijit.form.HorizontalSlider");\r
- dojo.require("dijit.form.HorizontalRuleLabels");\r
- dojo.require("dojox.grid.DataGrid");\r
- dojo.require("dojo.date.locale");
- dojo.require("dojo.date");\r
- var ttch=["","",""];\r
- var ttlastchange=0;\r
- var gbtime="";\r
- var getime="";\r
- var reserve_grid_structure= [{cells:[\r
- {name:"ID",field:"id",width:"4em"},\r
- {name:"タイプ",field:"type",width:"5em",formatter:gridTypeFormatter},\r
- {name:"チャンネル",field:"chtxt",width:"5em"},\r
- {name:"開始",field:"btime",width:"6em"},\r
- {name:"終了",field:"etime",width:"3em"},\r
- {name:"タイトル",field:"title",width:"auto"},\r
- {name:"opt",field:"opt",width:"4em"},\r
- {name:"dt",field:"deltatime",width:"2em"},\r
- {name:"dd",field:"deltaday",width:"2em"}\r
- ]}];\r
- function readCh(){\r
- var chlistPaneTE=dojo.byId("progTableTE");\r
- var chlistPaneBS=dojo.byId("progTableBS");\r
- var chlistPaneCS=dojo.byId("progTableCS");\r
- dojo.xhrGet({\r
- url:"rec10webg3.py?mode=chlist",\r
- handleAs: "json",\r
- load: function(data,ioargs){\r
- //console.log("res=", data['items']);\r
- for (i=0;i<data['items'].length;i++){\r
- var node = document.createElement("div");\r
- var child = new dijit.form.ToggleButton\r
- ( {id: data['items'][i]["name"], \r
- label: data['items'][i]["label"],\r
- iconClass: "dijitCheckBoxIcon"},node );\r
- dojo.connect(node,"onClick",data['items'][i]["name"],addTimetableCh);\r
- if (data['items'][i]['type']=="bs"){\r
- chlistPaneBS.appendChild(child.domNode);\r
- }else if (data['items'][i]['type']=="cs"){\r
- chlistPaneCS.appendChild(child.domNode);\r
- }else {\r
- chlistPaneTE.appendChild(child.domNode);\r
- }\r
- }; \r
- },\r
- error: function(error,args) {\r
- console.warn("error!",error);\r
- }\r
- });\r
- };\r
- function changeTab(tabid){\r
- dijit.byId("main_tab").selectChild(dijit.byId(tabid));\r
- }\r
- function setFilteringSelectValue(dijitid){\r
- console.warn("test");\r
- dijit.byId(dijitid).set('value',dijit.byId(dijitid).store._arrayOfAllItems[0]['id']);\r
- }\r
- function DateTime2dt(ttime){\r
- var tt=new Date(parseInt(ttime.substring(0,4)),parseInt(ttime.substring(5,7)),parseInt(ttime.substring(8,10)),parseInt(ttime.substring(11,13)),parseInt(ttime.substring(14,16),0));\r
- return tt\r
- }\r
- function dt2DateTime(tt){\r
- function get2(t){\r
- if (t<10){\r
- return "0"+t\r
- }else{\r
- return t\r
- }\r
- }\r
- var month=parseInt(tt.getMonth());\r
- return tt.getFullYear()+"-"+get2(month)+"-"+get2(tt.getDate())+"T"+get2(tt.getHours())+":"+get2(tt.getMinutes())+":"+get2(tt.getSeconds());\r
- }\r
- function addTimetableCh(chtxt){\r
- var have = 0;\r
- console.dir(chtxt);\r
- for (i = 0; i < 3; i++) {\r
- if (ttch[i] == chtxt) {\r
- ttch[i] = "";\r
- have = 1;\r
- removeSingleCh("timetable-id"+i);\r
- }\r
- }\r
- if (have == 0) {\r
- var change = 0;\r
- for (i = 0; i < 3; i++) {\r
- if (ttch[i].length == 0) {\r
- ttch[i] = chtxt;\r
- ttlastchange = i;\r
- change = 1;\r
- }\r
- }\r
- if (change == 0) {\r
- ttch[(ttlastchange + 1) % 3] = chtxt;\r
- change = 1;\r
- ttlastchange = (ttlastchange + 1) % 3;\r
- }\r
- showTimeTable("timetableContainer", ttch, gbtime, getime, 5);\r
- }\r
- }\r
- function calcMaxHeight(parentid,chlists,bt,et,fontsize){\r
- var maxH=0;\r
- var tempH=0;\r
- for (ch in chlists){\r
- var chnode=dojo.doc.createElement("div");\r
- chnode.setAttribute("style","width:100%;");\r
- //chnode.setAttribute("id",data['items'][i]['id']);\r
- dojo.xhrGet({\r
- url:parentid+".json",\r
- handleAs: "json",\r
- sync: true,\r
- load: function(data,ioargs){\r
- var baseForm=dojo.byId(parentid);\r
- for (i=0;i<data['items'].length;i++){\r
- var node = dojo.doc.createElement("div");\r
- node.setAttribute("style","border:3px solid #CCC;width:100%;");\r
- node.setAttribute("id",data['items'][i]['id']);\r
- var nodetitle = dojo.doc.createElement("h5");\r
- var node_str = dojo.doc.createTextNode(data['items'][i]['min']+" : "+data['items'][i]['title']);\r
- var node_str_desc = dojo.doc.createTextNode(data['items'][i]['desc']);\r
- nodetitle.appendChild(node_str);\r
- node.appendChild(nodetitle);\r
- node.appendChild(node_str_desc);\r
- baseForm.appendChild(node);\r
- tempH=tempH+node.clientHeight;\r
- if (maxH<tempH){\r
- maxH=tempH;\r
- }\r
- baseForm.removeChild(node);\r
- }; \r
- },\r
- error: function(error,args) {\r
- console.warn("error!",error);\r
- }\r
- });\r
- //console.log(maxH);\r
- //console.log(tempH);\r
- if (maxH<tempH){\r
- maxH=tempH;\r
- }\r
- tempH=0;\r
- }\r
- return maxH;\r
- }\r
- function showTimeTableSingleCH(parentid,ch,bt,et,fontsize,maxsize){\r
- var thisMaxheight=calcMaxHeight(parentid,[ch,],bt,et,fontsize);\r
- dojo.xhrGet({\r
- url:parentid+".json",\r
- handleAs: "json",\r
- load: function(data,ioargs){\r
- var baseForm=dojo.byId(parentid);\r
- console.dir(baseForm);\r
- for (i=0;i<data['items'].length;i++){\r
- var node = dojo.doc.createElement("div");\r
- node.setAttribute("style","border:3px solid #FFFFFF;width:100%;");\r
- node.setAttribute("id",data['items'][i]['id']+"_test");\r
- var nodetitle = dojo.doc.createElement("h5");\r
- var node_str = dojo.doc.createTextNode(data['items'][i]['min']+" : "+data['items'][i]['title']);\r
- var node_str_desc = dojo.doc.createTextNode(data['items'][i]['desc']);\r
- nodetitle.appendChild(node_str);\r
- node.appendChild(nodetitle);\r
- node.appendChild(node_str_desc);\r
- baseForm.appendChild(node);\r
- var h=node.clientHeight;\r
- console.log(h);\r
- baseForm.removeChild(node);\r
- node = dojo.doc.createElement("div");\r
- node.setAttribute("style","border:3px solid #CCC;width:100%;height:"+h*maxsize/thisMaxheight+"");\r
- node.setAttribute("id",data['items'][i]['id']);\r
- nodetitle = dojo.doc.createElement("h5");\r
- node_str = dojo.doc.createTextNode(data['items'][i]['min']+" : "+data['items'][i]['title']);\r
- node_str_desc = dojo.doc.createTextNode(data['items'][i]['desc']);\r
- nodetitle.appendChild(node_str);\r
- node.appendChild(nodetitle);\r
- node.appendChild(node_str_desc);\r
- baseForm.appendChild(node);\r
- }; \r
- },\r
- error: function(error,args) {\r
- console.warn("error!",error);\r
- }\r
- });\r
- }\r
- function removeSingleCh(parentid){\r
- var baseForm=dojo.byId(parentid);\r
- var children=baseForm.getChildren();\r
- console.dir(children);\r
- for (i=0;i<children.length();i++){\r
- baseForm.removeChild(childen[i]);\r
- }\r
- }\r
- function showTimeTable(parentid,chlists,btime,etime,fontsize){\r
- var widthp=Math.floor(100/chlists.length);\r
- var every_width=20;\r
- var timetabelArray= new Array();\r
- var bt=new Date(parseInt(btime.substring(0,4)),parseInt(btime.substring(5,7)),parseInt(btime.substring(8,10)),parseInt(btime.substring(11,13)),parseInt(btime.substring(14,16),0));\r
- var et=new Date(parseInt(etime.substring(0,4)),parseInt(etime.substring(5,7)),parseInt(etime.substring(8,10)),parseInt(etime.substring(11,13)),parseInt(etime.substring(14,16),0));\r
- bt.setSeconds(0);\r
- if (bt.getMinutes()>30){\r
- bt.setMinutes(30);\r
- }else{\r
- bt.setMinutes(0);\r
- }\r
- et.setSeconds(0);\r
- if (et.getMinutes()>30){\r
- et.setMinutes(30);\r
- et=dojo.date.add(et, "minute", 30);\r
- }else{\r
- et.setMinutes(30);\r
- }\r
- var dt=dojo.date.difference(bt,et,"minute");\r
- var nbt=bt;\r
- var i=0;\r
- while(dt>i){\r
- console.dir([dt,i]);\r
- net=dojo.date.add(nbt,"minute",30);\r
- var theight=calcMaxHeight("timetable-id0",chlists,dt2DateTime(nbt),dt2DateTime(net),fontsize);\r
- console.log(theight)\r
- for (j=0;j<chlists.length;j++){\r
- if (j>2){\r
- j=chlists.length;\r
- }else{\r
- showTimeTableSingleCH("timetable-id"+j,chlists[j],nbt,net,fontsize,theight);\r
- }\r
- }\r
- i=i+30;\r
- nbt=dojo.date.add(nbt,"minute",30);\r
- }\r
- }
-
-
-
-
-
-
-//########################################################################
- function showSearchEPG(){
- var keyw=dojo.byId("tb_search_keyword").value;\r
- dojo.xhrGet({\r
- url:"rec10webg3.py?mode=epg-search&keyword="+keyw,\r
- handleAs: "json",\r
- load: function(data,ioargs){\r
- var baseForm=dojo.byId("tab_epgsearch");\r
- console.dir(data);
- console.dir(data.items);\r
- for (i=0;i<data['items'].length;i++){\r
- var node = dojo.doc.createElement("p");
- var hr = dojo.doc.createElement("hr");
- var titlediv = dojo.doc.createElement("div");
- titlediv.setAttribute("style","font-size:1.4em;font-weight:bold;");
- var titlediv_text = dojo.doc.createTextNode(data['items'][i]['title']);
- titlediv.appendChild(titlediv_text);
- var datespan1 = dojo.doc.createElement("span");
- datespan1.setAttribute("style","font-size:1.2em;font-weight:bold;");
- var date_text = dojo.doc.createTextNode(data['items'][i]['btime'].substring(6,10)+" ");
- datespan1.appendChild(date_text);
- var datespan2 = dojo.doc.createElement("span");
- datespan2.setAttribute("style","font-size:1em;");
- var date_text2 = dojo.doc.createTextNode(data['items'][i]['btime'].substring(11,16));
- datespan2.appendChild(date_text2);
- var channel = dojo.doc.createElement("span");
- channel.setAttribute("style","font-size:1.2em;font-style:italic;");
- var channel_text = dojo.doc.createTextNode(data['items'][i]['chtxt']);
- channel.appendChild(channel_text);
- var desc_div = dojo.doc.createElement("div");
- desc_div.setAttribute("style","font-size:1em;font-style:italic;");
- var desc_div = dojo.doc.createTextNode(data['items'][i]['exp'].replace(/\n/g,"<br>"));
- datespan2.appendChild(date_text2);
- node.appendChild(hr);
- node.appendChild(titlediv);
- node.appendChild(datespan1);
- node.appendChild(datespan2);
- node.appendChild(channel);
- node.appendChild(desc_div);\r
- baseForm.appendChild(node);\r
- }; \r
- },\r
- error: function(error,args) {\r
- console.warn("error!",error);\r
- }\r
- });
-
- }
- function gridTypeFormatter(type){
- switch(type){
- case "reserve_flexible":return "<span style='color:skyblue'>未確定予約</span>";
- case "reserve_fixed":return "<span style='color:blue'>確定予約</span>";
- case "convert_ts_mp4_network":return "<span style='color:black'>ネット変換予約</span>";
- case "convert_ts_mp4_running":return "<span style='color:orange'>動画圧縮中</span>";
- case "convert_ts_mp4":return "<span style='color:yellow'>圧縮予約</span>";
- case "convert_avi_mp4_miss":return "<span style='color:'></span>";
- case "search_today":return "<span style='color:skyblue'>当日予約</span>";
- case "search_everyday":return "<span style='color:purple'>隔日予約</span>";
- case "convert_ts_mp4_finished":return "<span style='color:gray'>圧縮終了</span>";
- case "convert_b25_ts_miss":return "<blink><span style='color:red'>解読失敗</span></blink>";
- case "convert_b25_ts":return "<span style='color:green'>解読予約</span>";
- case "convert_b25_ts_running":return "<span style='color:yellowgreen'>解読中</span>";
- case "reserve_running":return "<span style='color:orange'>録画中</span>";
- case "convert_mkv_mp4_runnings":return "<span style='color:'></span>";
- case "convert_avi_mkv":return "<span style='color:'></span>";
- case "convert_avi_mp4":return "<span style='color:'></span>";
- case "convert_mkv_mp4":return "<span style='color:'></span>";
- case "move_end":return "<span style='color:gray'>移動終了</span>";
-
- default : return type;
- }
- }\r
- dojo.addOnLoad\r
- (\r
- function(){\r
- readCh();\r
- }\r
- );\r
- </script>\r
- <style type="text/css">\r
- @import "http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojox/grid/resources/Grid.css";\r
- @import "http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojox/grid/resources/claroGrid.css";\r
- </style>\r
- </head>\r
- \r
- <body class=" claro ">\r
- <div dojoType="dijit.layout.BorderContainer" gutters="true" id="borderContainerTwo">\r
- <div dojoType="dijit.layout.ContentPane" region="top" splitter="false">\r
- Rec10Suite WEB Interface version 0.0.1\r
- </div>\r
- <div dojoType="dijit.layout.BorderContainer" liveSplitters="false" design="sidebar"\r
- region="center" id="mainSplit">\r
- <div dojoType="dijit.layout.AccordionContainer" minSize="20" style="width: 300px;"\r
- id="leftMainAccordion" region="leading" splitter="true">\r
- <div dojoType="dijit.layout.ContentPane" title="番組表" selected="true">\r
- <div dojoType="dijit.layout.AccordionContainer" minSize="20" style="width: 100%;"\r
- id="leftProgramTabTE" region="leading" splitter="true">\r
- <div dojoType="dijit.layout.BorderContainer" id="progTableTE" title="地上派" selected="true"></div>\r
- <div dojoType="dijit.layout.BorderContainer" id="progTableBS" title="BS"></div>\r
- <div dojoType="dijit.layout.BorderContainer" id="progTableCS" title="CS"></div>\r
- </div>\r
- </div>\r
- <div dojoType="dijit.layout.ContentPane" title="予約">\r
- <div dojoType="dijit.form.Button" id="simpleReserveButton" label="新規予約" onclick=changeTab("tab_newreserve")></div>\r
- <hr>\r
- <div dojoType="dijit.form.Button" id="ReserveListTimeButton" label="予約確認(時間順)" onclick=changeTab("tab_list_time")></div>\r
- </div>\r
- <div dojoType="dijit.layout.ContentPane" title="設定">\r
- </div>\r
- <div dojoType="dijit.layout.ContentPane" title="その他">\r
- </div>\r
- </div>\r
- <div dojoType="dijit.layout.TabContainer" id="main_tab" region="center" tabStrip="true">\r
- <div dojoType="dijit.layout.ContentPane" title="番組表" selected="true">\r
- <div dojoType="dijit.layout.BorderContainer" id="timetableContainer" design="headline" style="width:100%;height:100%;" gutters="true">\r
- <div dojoType="dijit.layout.ContentPane" id="timetable-id0" region="left" style="width:30%"></div>\r
- <div dojoType="dijit.layout.ContentPane" id="timetable-id1" region="center"></div>\r
- <div dojoType="dijit.layout.ContentPane" id="timetable-id2" region="right" style="width:30%"></div>\r
- <div dojoType="dijit.layout.ContentPane" id="timetable-button" region="bottom" style="height:4%;position:relative;">\r
- <div dojoType="dijit.form.Button" style="position:absolute;left:0.5em;" onClick=showTimeTable()><<前</div>\r
- <div dojoType="dijit.form.Button" style="position:absolute;right:0.5em;" onClick=showTimeTable()>次>></div>\r
- <div dojoType="dijit.form.Button" style="position:absolute;left:40%;" onClick=showTimeTable()>06h</div>\r
- <div dojoType="dijit.form.Button" style="position:absolute;left:48.5%;" onClick=showTimeTable()>12h</div>\r
- <div dojoType="dijit.form.Button" style="position:absolute;right:40%;" onClick=showTimeTable()>24h</div>\r
- <div dojoType="dijit.form.Button" style="position:absolute;left:10%;" onClick=showTimeTable("timetableContainer",["tb1","tb2","tb3"],"2001-01-01T12:00:00","2001-01-01T13:15:00",5)>test</div>\r
- </div>\r
- </div>\r
- </div>
- <div dojoType="dijit.layout.ContentPane" id="tab_timetablebasic" title="TimeTable" href="rec10webg2.pl">
- </div>
- <div dojoType="dijit.layout.ContentPane" id="tab_epgsearch" title="Search" onClick="showSearchEPG()">
- <p>Program Search:<div dojoType="dijit.form.TextBox" id="tb_search_keyword">Keyword</div>
- <div dojoType="dijit.form.Button" id="tb_search_button">Search</div></p>
- </div>
- <div dojoType="dijit.layout.ContentPane" title="番組表3" >
- <div dojoType="dijit.layout.BorderContainer" id="timetableContainer3" design="headline" style="width:100%;height:100%;" gutters="true">
- <div dojoType="dijit.layout.ContentPane" id="timetable3-tt" region="center" href="rec10webg2.pl?mode=timegraph&btime=2011-05-07_06-00-00&etime=2011-05-07_18-00-00"></div>\r
- <div dojoType="dijit.layout.ContentPane" id="timetable3-id0" region="right" style="width:28%" href="rec10webg2.pl?mode=graph&chtxt=13&btime=2011-05-07_06-00-00&etime=2011-05-07_18-00-00"></div>\r
- <div dojoType="dijit.layout.ContentPane" id="timetable3-id1" region="right" style="width:28%" href="rec10webg2.pl?mode=graph&chtxt=21&btime=2011-05-07_06-00-00&etime=2011-05-07_18-00-00"></div>\r
- <div dojoType="dijit.layout.ContentPane" id="timetable3-id2" region="right" style="width:28%" href="rec10webg2.pl?mode=graph&chtxt=21&btime=2011-05-07_06-00-00&etime=2011-05-07_18-00-00"></div>\r
- <div dojoType="dijit.layout.ContentPane" id="timetable3-button" region="bottom" style="height:4%;position:relative;">\r
- <div dojoType="dijit.form.Button" style="position:absolute;left:0.5em;" onClick=showTimeTable()><<前</div>\r
- <div dojoType="dijit.form.Button" style="position:absolute;right:0.5em;" onClick=showTimeTable()>次>></div>\r
- <div dojoType="dijit.form.Button" style="position:absolute;left:40%;" onClick=showTimeTable()>06h</div>\r
- <div dojoType="dijit.form.Button" style="position:absolute;left:48.5%;" onClick=showTimeTable()>12h</div>\r
- <div dojoType="dijit.form.Button" style="position:absolute;right:40%;" onClick=showTimeTable()>24h</div>\r
- <div dojoType="dijit.form.Button" style="position:absolute;left:10%;" onClick=showTimeTable("timetableContainer",["tb1","tb2","tb3"],"2001-01-01T12:00:00","2001-01-01T13:15:00",5)>test</div>\r
- </div>\r
- </div>\r
- </div>\r
- <div dojoType="dijit.layout.ContentPane" id="tab_list_time" title="予約確認(時間順)">\r
- <div dojoType="dojo.data.ItemFileReadStore" jsId="reserveStore"\r
- url="rec10webg3.py?mode=timeline"></div>\r
- <table dojoType="dojox.grid.DataGrid" id="grid_reserve_list_time" structure="reserve_grid_structure"\r
- store="reserveStore" style="font-size:1.4em;"></table>\r
- </div>\r
- <div dojoType="dijit.layout.ContentPane" id="tab_newreserve" title="新規予約">\r
- <h2>新規予約</h2><br>\r
- <p>\r
- <div dojoType="dojo.data.ItemFileReadStore" jsId="chlistStore"\r
- url="chlist.json"></div>\r
- <div dojoType="dojo.data.ItemFileReadStore" jsId="dbtypeStore"\r
- url="typelist.json" ></div>\r
- <h3>タイトル:</h3>\r
- <div dojoType="dijit.form.TextBox" id="newreserve_title" style="width:30%"></div><br>\r
- </p>\r
- <p>\r
- <h3>詳細設定</h3>\r
- コマンド:\r
- <div dojoType="dijit.form.FilteringSelect" id="newreserve_dbtype_list" \r
- autoComplete="true" store="dbtypeStore" searchAttr= "label" \r
- onShow="setFilteringSelectValue('newreserve_dbtype_list')"></div>\r
- チャンネル:\r
- <div dojoType="dijit.form.FilteringSelect" id="newreserve_ch_list" \r
- autoComplete="true" store="chlistStore" searchAttr= "label" \r
- onShow="setFilteringSelectValue('newreserve_ch_list')"></div><br>\r
- <p>\r
- <h4>時刻設定</h4>\r
- 開始時間:\r
- <div dojoType="dijit.form.DateTextBox" id="newreserve_bdata" constraints="{datePattern:'yyyy-MM-dd'}"></div>\r
- <div dojoType="dijit.form.TimeTextBox" id="newreserve_btime"></div><br>\r
- 終了時間:\r
- <div dojoType="dijit.form.DateTextBox" id="newreserve_edata" constraints="{datePattern:'yyyy-MM-dd'}"></div>\r
- <div dojoType="dijit.form.TimeTextBox" id="newreserve_etime"></div><br><br>\r
- <p>\r
- 隔日検索:\r
- <div dojoType="dijit.form.HorizontalSlider" id="newreserve_deladay" \r
- minimum="1" maximum="7" value="7" discreteValues="7"\r
- intermediateChanges="true" style="width:300px">\r
- <ol dojoType="dijit.form.HorizontalRuleLabels">\r
- <li>1</li><li>2</li><li>3</li><li>4</li><li>5</li>\r
- <li>6</li><li>7</li>\r
- </ol>\r
- </div><br>\r
- 時刻揺らぎ:\r
- <div dojoType="dijit.form.HorizontalSlider" id="newreserve_delatime" \r
- minimum="1" maximum="10" value="3" discreteValues="10"\r
- intermediateChanges="true" style="width:300px">\r
- <ol dojoType="dijit.form.HorizontalRuleLabels">\r
- <li>1</li><li>2</li><li>3</li><li>4</li><li>5</li>\r
- <li>6</li><li>7</li><li>8</li><li>9</li><li>10</li>\r
- </ol>\r
- </div>\r
- </p>\r
- </p>\r
- </p>\r
- <div dojoType="dijit.form.Button" onClick=showTimeTable("tab_newreserve",["tb1","tb2"],"2001-01-01T12:00:00","2001-01-01T13:15:00",5)></div>\r
- </div>\r
- </div>\r
- </div>\r
- </div>\r
- </body>\r
-</html>\r
+++ /dev/null
-#!/usr/bin/python
-# coding: UTF-8
-# Rec10 TS Recording Tools
-# Copyright (C) 2009-2011 Yukikaze
-import cgi
-import os
-import os.path
-import re
-import datetime
-import ConfigParser
-import MySQLdb
-import time
-try:
- import simplejson as json
-except ImportError:
- import json
-#import cgitb
-#cgitb.enable()
-
-path = str(os.path.dirname(os.path.abspath(__file__))) + "/"
-confp = ConfigParser.SafeConfigParser()
-Conf = 'rec10.conf'
-cpath=""
-if (os.path.exists(os.path.join(path,Conf))):
- cpath=os.path.join(path,Conf)
-elif (os.path.exists(os.path.join("/etc/rec10",Conf))):
- cpath=os.path.join("/etc/rec10",Conf)
-elif (os.path.exists(os.path.join("/etc",Conf))):
- cpath=os.path.join("/etc",Conf)
-confp.read(cpath)
-def getpath(string):
- global confp
- return confp.get('path', string)
-def getdbpath(string):
- global confp
- return confp.get('db', string)
-def getdb():
- retdb = ""
- if getdbpath('db') == 'MySQL':
- dbn = getdbpath("mysql_dbname")
- dbh = getdbpath("mysql_host")
- dbu = getdbpath("mysql_user")
- dbpwd = getdbpath("mysql_passwd")
- dbport = int(getdbpath("mysql_port"))
- #print [dbn,dbh,dbu,dbpwd,dbport]
- retdb = DB_MySQL(dbname=dbn, host=dbh, user=dbu, passwd=dbpwd, port=dbport)
- return retdb
-class DB_MySQL:
- dbname = ""
- dbhost = ""
- dbusr = ""
- dbpasswd = ""
- dbport = 0
- def __init__(self, dbname, user, passwd, host="localhost", port=3306):
- self.dbname = dbname
- self.dbhost = host
- self.dbusr = user
- self.dbpasswd = passwd
- self.dbport = port
- def connect_db(self):
- """
- dbへの接続
- """
- con = MySQLdb.connect(db=self.dbname, host=self.dbhost, port=self.dbport,\
- user=self.dbusr, passwd=self.dbpasswd, charset="utf8")
- cur = con.cursor()
- cur.execute('set names utf8;')
- return [con, cur]
- def close_db(self, db):
- db[1].close()
- db[0].close()
-
- ###timeline系
- def timeline2dic(self,timeline):
- ret={}
- ret['id']=timeline[0]
- ret['type']=timeline[1]
- ret['chtxt']=timeline[2]
- ret['title']=timeline[3]
- ret['btime']=timeline[4].strftime("%m/%d %H:%M")
- ret['etime']=timeline[5].strftime("%H:%M")
- ret['bt']=timeline[4]
- ret['et']=timeline[5]
- if not timeline[6]:
- ret['deltatime']=timeline[6]
- else:
- ret['deltatime']="3"
- if not timeline[7]:
- ret['deltaday']=timeline[7]
- else:
- ret['deltaday']="7"
- ret['opt']=timeline[8]
- ret['epgtitle']=timeline[9]
- ret['epgbtime']=timeline[10]
- ret['epgetime']=timeline[11]
- ret['epgduplicate']=timeline[12]
- ret['epgchange']=timeline[13]
- ret['epgexp']=timeline[14]
- ret['counter']=timeline[15]
- return ret
- def select_all_timeline(self):
- db = self.connect_db()
- recdata = []
- dl = db[1].execute("SELECT id,type,chtxt,title,btime,etime,deltatime,deltaday,opt,\
- epgtitle,epgbtime,epgetime,epgduplicate,epgchange,epgexp,counter FROM timeline ORDER BY btime")
- dls = db[1].fetchall()
- for line in dls:
- recdata.append(self.timeline2dic(line))
- self.close_db(db)
- return recdata
- def select_by_chtxt_timeline(self, chtxt):
- db = self.connect_db()
- recdata = []
- dl = db[1].execute("SELECT id,type,chtxt,title,btime,etime,deltatime,deltaday,opt,\
- epgtitle,epgbtime,epgetime,epgduplicate,epgchange,epgexp,counter FROM timeline WHERE chtxt = %s ", (chtxt, ))
- d = db[1].fetchall()
- for line in dls:
- recdata.append(self.timeline2dic(line))
- self.close_db(db)
- return recdata
- def select_by_id_timeline(self, idt):
- db = self.connect_db()
- recdata = []
- dl = db[1].execute("SELECT id,type,chtxt,title,btime,etime,deltatime,deltaday,opt,\
- epgtitle,epgbtime,epgetime,epgduplicate,epgchange,epgexp,counter FROM timeline WHERE id = %s ", (idt, ))
- d = db[1].fetchall()
- for line in dls:
- recdata.append(self.timeline2dic(line))
- self.close_db(db)
- return recdata
- def select_by_btime_etime_chtxt_timeline(self,btime,etime,chtxt):
- db = self.connect_db()
- recdata = []
- dl = db[1].execute("SELECT id,type,chtxt,title,btime,etime,deltatime,deltaday,opt,\
- epgtitle,epgbtime,epgetime,epgduplicate,epgchange,epgexp,counter FROM timeline \
- WHERE btime >= %s AND etime <= %s AND chtxt = %s", (btime,etime,chtxt ))
- dls = db[1].fetchall()
- for line in dls:
- recdata.append(self.timeline2dic(line))
- self.close_db(db)
- return recdata
- def add_timeline(self, type="", chtxt="", title="", btime="", etime="", deltatime="", deltaday="", opt=""):
- db = self.connect_db()
- db[1].execute('INSERT IGNORE INTO timeline (type,chtxt,title,btime,etime,deltatime,deltaday,opt) \
- values (%s,%s,%s,%s,%s,%s,%s,%s)', (type, chtxt, title, btime, etime, deltatime, deltaday, opt))
- self.close_db(db)
-
-
- ########epg_ch系
- def epg_ch2dic(self,epg_ch):
- ret={}
- ret['bctype']=epg_ch[0]
- ret['chtxt']=epg_ch[1]
- ret['ch']=epg_ch[2]
- ret['csch']=epg_ch[3]
- ret['chname']=epg_ch[4]
- ret['updatetime']=epg_ch[5]
- ret['status']=epg_ch[6]
- ret['visible']=epg_ch[7]
- if ret["chtxt"].split("_")[0]=="BS":
- ret["type"]="BS"
- elif ret["chtxt"].split("_")[0]=="CS":
- ret["type"]="CS"
- else:
- ret["type"]="TE"
- return ret
- def select_all_epg_ch(self):
- db = self.connect_db()
- r1 = db[1].execute("SELECT bctype,chtxt,ch,csch,chname,updatetime,status,visible FROM epg_ch")
- lines = db[1].fetchall()
- ret=[]
- for ls in lines:
- ret.append(self.epg_ch2dic(ls))
- self.close_db(db)
- return ret
- def select_by_chtxt_epg_ch(self, chtxt):
- db = self.connect_db()
- r1 = db[1].execute("SELECT bctype,chtxt,ch,csch,chname,updatetime,status,visible FROM epg_ch WHERE chtxt=%s", (chtxt, ))
- lines = db[1].fetchall()
- ret=[]
- for ls in lines:
- ret.append(epg_ch2dic(ls))
- self.close_db(db)
- return ret
-
- ########epg_timeline系
- def epg_timeline2dic(self,epg_timeline):
- ret={}
- ret['bctype']=epg_timeline[0]
- ret['channel']=epg_timeline[1]
- ret['chtxt']=epg_timeline[1]
- ret['start']=datetime.datetime(*time.strptime(epg_timeline[2], "%Y%m%d%H%M%S")[:-3])
- ret['stop']=datetime.datetime(*time.strptime(epg_timeline[3], "%Y%m%d%H%M%S")[:-3])
- ret['bt']=ret['start']
- ret['et']=ret['stop']
- ret['btime']=ret['bt'].strftime("%Y-%m-%d %H:%M:%S")
- ret['etime']=ret['et'].strftime("%Y-%m-%d %H:%M:%S")
- ret['title']=epg_timeline[4]
- ret['exp']=epg_timeline[5]
- ret['longexp']=epg_timeline[6]
- ret['category']=epg_timeline[7]
- return ret
- def select_all_epg_timeline(self):
- db = self.connect_db()
- r1 = db[1].execute("SELECT bctype,channel,start,stop,title,exp,longexp,category FROM epg_timeline")
- lines = db[1].fetchall()
- ret=[]
- for ls in lines:
- ret.append(self.epg_timeline2dic(ls))
- self.close_db(db)
- return ret
- def select_by_chtxt_epg_timeline(self, chtxt):
- db = self.connect_db()
- r1 = db[1].execute("SELECT bctype,channel,start,stop,title,exp,longexp,category FROM epg_timeline WHERE channel=%s", (chtxt, ))
- lines = db[1].fetchall()
- ret=[]
- for ls in lines:
- ret.append(self.epg_timeline2dic(ls))
- self.close_db(db)
- return ret
- def select_by_btime_etime_chtxt_epg_timeline(self,btime,etime,chtxt):
- db = self.connect_db()
- start=datetime.datetime(*time.strptime(btime, "%Y-%m-%d %H:%M:%S")[:-3]).strftime("%Y%m%d%H%M%S")
- stop=datetime.datetime(*time.strptime(etime, "%Y-%m-%d %H:%M:%S")[:-3]).strftime("%Y%m%d%H%M%S")
- recdata = []
- dl = db[1].execute("SELECT bctype,channel,start,stop,title,exp,longexp,category FROM epg_timeline \
- WHERE start >= %s AND stop <= %s AND channel = %s", (start,stop,chtxt ))
- dls = db[1].fetchall()
- for line in dls:
- recdata.append(self.epg_timeline2dic(line))
- self.close_db(db)
- return recdata
- def select_by_keyword_title_epg_timeline(self,keyword="",chtxt="",btime="",etime=""):
- keyt=""
- chtxtt=""
- btimet=""
- etimet=""
- if len(keyword)>0:
- keyt=" AND title LIKE '%"+keyt+"%' "
- if len(btime)>0:
- start=datetime.datetime(*time.strptime(btime, "%Y-%m-%d %H:%M:%S")[:-3]).strftime("%Y%m%d%H%M%S")
- stop=datetime.datetime(*time.strptime(etime, "%Y-%m-%d %H:%M:%S")[:-3]).strftime("%Y%m%d%H%M%S")
- btimet=" AND start >= "+start+" "
- etimet=" AND stop <= "+stop+" "
- if len(chtxt)>0:
- chtxtt=" AND channel = "+chtxt+" "
- db = self.connect_db()
- recdata = []
- #print "SELECT bctype,channel,start,stop,title,exp,longexp,category FROM epg_timeline \
- #WHERE bctype LIKE '%' "+keyt+btimet+etimet+chtxtt+""
- dl = db[1].execute("SELECT bctype,channel,start,stop,title,exp,longexp,category FROM epg_timeline \
- WHERE bctype LIKE '%' "+keyt+btimet+etimet+chtxtt+"")
- dls = db[1].fetchall()
- for line in dls:
- recdata.append(self.epg_timeline2dic(line))
- self.close_db(db)
- return recdata
-#####ここまでDBの読み込み/書き込み系
-global db
-db=getdb()
-jsonHeader="Content-Type: application/json;charset=utf-8\n"
-htmlHeader="Content-Type: text/html; charset=utf-8\n"
-global f
-f = cgi.FieldStorage()
-#mode="timeline"
-mode=""
-
-
-
-if f.getfirst('mode',""):
- mode=f.getfirst('mode', "")
-if mode=="chtypelist":
- #print "Content-Type: application/json;charset=utf-8\n"
- print jsonHeader
- typest={"identifier":"id","items":[
- {
- "id":"search_everyday",
- "label":u"隔日検索"
- },{
- "id":"search_today",
- "label":u"当日検索"
- },{
- "id":"reserve_flexible",
- "label":u"浮動予約"
- },{
- "id":"reserve_fixed",
- "label":u"確定予約"
- },{
- "id":"convert_b25_ts",
- "label":u"解読予約"
- },{
- "id":"convert_ts_mp4",
- "label":u"縁故予約"
- }
- ]}
- print json.dumps(typest)
-if mode=="chlist":
- chls=db.select_all_epg_ch()
- chll={"identifier":"id","items":[]}
- for chl in chls:
- chll["items"].append({"id":chl["chtxt"],"type":chl["type"],"label":chl["chname"]})
- print jsonHeader
- print json.dumps(chll)
-if mode=="timeline":####録画一覧用
- tlll={"identifier":"id","items":[]}
- dbl=None
- if f.getfirst("chtxt"):
- dbl=db.select_by_btime_etime_chtxt_timeline(btime,etime,chtxt)
- else:
- dbl=db.select_all_timeline()
- if dbl:
- for dbi in dbl:
- tlll["items"].append({"id":dbi["id"],"btime":dbi["btime"],"etime":dbi["etime"],
- "chtxt":dbi["chtxt"],"title":dbi["title"],"type":dbi["type"],
- "deltatime":dbi["deltatime"],"deltaday":dbi["deltaday"],
- "opt":dbi["opt"]})
- #print jsonHeader
- print htmlHeader
- print json.dumps(tlll,encoding="utf-8")
-if mode=="epg-timeline":
- tlll={"items":[]}
- btime=f.getfirst("btime")
- etime=f.getfirst("etime")
- if not btime:
- btime=datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
- if not etime:
- et=datetime.datetime.now()+datetime.timedelta(days=8)
- etime=et.strftime("%Y-%m-%d %H:%M:%S")
- chtxt=f.getfirst("chtxt")
- if not chtxt:
- chtxt="18_3096"
- if chtxt:
- dbl=db.select_by_btime_etime_chtxt_epg_timeline(btime,etime,chtxt)
- for dbi in dbl:
- tlll["items"].append({"id":dbi["btime"],"btime":dbi["btime"],
- "chtxt":dbi["chtxt"],"title":dbi["title"],
- "exp":dbi["exp"],"longexp":dbi["longexp"],
- "category":dbi["category"]})
- print jsonHeader
- #print htmlHeader
- print json.dumps({"data":tlll},encoding="utf-8")
-if mode=="epg-search":
- tlll={"items":[]}
- btime=f.getfirst("btime")
- etime=f.getfirst("etime")
- if not btime:
- bt=datetime.datetime.now()
- btime=bt.strftime("%Y-%m-%d %H:%M:%S")
- if not etime:
- et=datetime.datetime.now()+datetime.timedelta(days=8)
- etime=et.strftime("%Y-%m-%d %H:%M:%S")
- chtxt=f.getfirst("chtxt")
- if not chtxt:
- chtxt=""
- keyword=f.getfirst("keyword")
- if not keyword:
- keyword=""
- dbl=db.select_by_keyword_title_epg_timeline(keyword=keyword,chtxt=chtxt,btime=btime,etime=etime)
- for dbi in dbl:
- tlll["items"].append({"id":dbi["btime"],"btime":dbi["btime"],
- "chtxt":dbi["chtxt"],"title":dbi["title"],
- "exp":dbi["exp"],"longexp":dbi["longexp"],
- "category":dbi["category"]})
- print jsonHeader
- #print htmlHeader
- print json.dumps({"data":tlll},encoding="utf-8")
+++ /dev/null
-#!/usr/bin/python
-# coding: UTF-8
-# iRec10EPG Rec10 iEPG supporting tool
-#Copyright 2009 Yukikaze
-import os
-import ConfigParser
-import codecs
-import webbrowser
-import sys
-import re
-import urllib
-mypath=os.path.dirname(sys.argv[0])
-def rec10web(webpath,title,station,btime,etime):
- browserpath="title="+title+"&btime="+btime+"&etime="+etime+"&station="+station
- browserpath=urllib.quote_plus(browserpath,"=&")
- browserpath=webpath+"?"+browserpath
- print browserpath
-
- webbrowser.open(browserpath,new=2)
-def iepg2rec10webopts(path):
- station=""
- year=""
- month=""
- date=""
- start=""
- end=""
- title=""
-
- for line in codecs.open(path,'r','shift_jis'):
- if re.search('station:',line):
- station=line.replace("station:","")
- station=station.replace(" ","")
- station=station.replace("\r\n","")
- elif re.search('year:',line):
- year=line.replace("year:","")
- year=year.replace(" ","")
- year=year.replace("\r\n","")
- elif re.search('month:',line):
- month=line.replace("month:","")
- month=month.replace(" ","")
- month=month.replace("\r\n","")
- elif re.search('date:',line):
- date=line.replace("date:","")
- date=date.replace(" ","")
- date=date.replace("\r\n","")
- elif re.search('start:',line):
- start=line.replace("start:","")
- start=start.replace(" ","")
- start=start.replace("\r\n","")
- elif re.search('end:',line):
- end=line.replace("end:","")
- end=end.replace(" ","")
- end=end.replace("\r\n","")
- elif re.search('program-title:',line):
- title=line.replace("program-title:","")
- title=title.replace(" ","")
- title=title.replace("\r\n","")
- ret={}
- ret['title']=title.encode('UTF-8')
- ret['btime']=year+"-"+month+"-"+date+" "+start+":00"
- ret['btime']=ret['btime'].encode('UTF-8')
- ret['etime']=year+"-"+month+"-"+date+" "+end+":00"
- ret['etime']=ret['etime'].encode('UTF-8')
- ret['station']=station.encode('UTF-8')
- return ret
-
-
-confp=ConfigParser.SafeConfigParser()
-Conf=os.path.join(mypath, 'setting.ini')
-confp.read(Conf)
-rec10path=confp.get('path','rec10web')
-print rec10path
-argvs=sys.argv
-webopt=iepg2rec10webopts(argvs[1])
-print webopt
-
-rec10web(rec10path,webopt['title'],webopt['station'],webopt['btime'],webopt['etime'])
+++ /dev/null
-iRec10EPG -Rec10iEPG\91Î\89\9e\83N\83\89\83C\83A\83\93\83g- ver.0.3.1
-
-\96{\83\\83t\83g\82ð\8eg\82¤\82½\82ß\82É\82Í\98^\89æ\82ð\8ds\82¤\83}\83V\83\93\82ÉRec10web\82ª\90Ý\92u\82³\82ê\82Ä\82¢\82é\95K\97v\82ª\82 \82è\82Ü\82·
-[\92\8d\88Ó]
-\83C\83\93\83X\83g\81[\83\8b\90æ\82Ìsetting.ini(\8f\89\8aú\82Å\82ÍC:\Program Files\iRec10EPG)\82É
-rec10web.py\82Ö\82Ì\83A\83h\83\8c\83X\82ð\8f\91\82«\8d\9e\82ñ\82Å\82\82¾\82³\82¢\81B
-
-
-Copyright (C) 2009 yukikaze(yukikaze.jp@gmail.com)
-http://gn64.web.fc2.com/
\ No newline at end of file
+++ /dev/null
-[path]
-rec10web=http:///rec10web.py
+++ /dev/null
-from distutils.core import setup\r
-import py2exe\r
-\r
-py2exe_options = {\r
- "compressed": 1,\r
- "optimize": 2,\r
- "bundle_files": 2}\r
-\r
-setup(\r
- options = {"py2exe": py2exe_options},\r
- console = [\r
- {"script" : "iRec10EPG.py", "icon_resources": [(1,"HP-TV-Dock.ico")]}],\r
- zipfile = None)\r