OSDN Git Service

b0ce3af7153b7ad09a05246812db5fcf57de37a1
[rec10/rec10-git.git] / rec10 / trunk / src / rec10d.py
1 #!/usr/bin/python\r
2 # coding: UTF-8\r
3 # Rec10 TS Recording Tools\r
4 # Copyright (C) 2009-2011 Yukikaze\r
5 import os\r
6 import os.path\r
7 import warnings\r
8 warnings.filterwarnings('ignore', "the sets module is deprecated")\r
9 import configreader\r
10 import dbMySQL\r
11 import timerec\r
12 path = str(os.path.dirname(os.path.abspath(__file__))) + "/"\r
13 tmppath = configreader.getConfPath("tmp")+"/"\r
14 if tmppath=="/":\r
15     tmppath=path\r
16 if not os.path.exists(tmppath):\r
17     os.makedirs(tmppath)\r
18 global rec10db\r
19 def main():\r
20     timerec.task()\r
21 db = configreader.getConfDB("db")\r
22 if db == "MySQL":\r
23     dbn = configreader.getConfDB("mysql_dbname")\r
24     dbh = configreader.getConfDB("mysql_host")\r
25     dbu = configreader.getConfDB("mysql_user")\r
26     dbpwd = configreader.getConfDB("mysql_passwd")\r
27     dbport = int(configreader.getConfDB("mysql_port"))\r
28     rec10db = dbMySQL.DB_MySQL(dbname=dbn, host=dbh, user=dbu, passwd=dbpwd, port=dbport)\r
29     rec10db.new_in_status()\r
30 else:\r
31     rec10db = dbSQLite.DB_SQLite(path + "ch.db")\r
32 if __name__ == "__main__":\r
33     main()\r
34 \r