OSDN Git Service

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