#!/usr/bin/env python #coding=utf-8 from __future__ import with_statement import sys import os import datetime import time import ConfigParser # 读取配置文件 try: config = ConfigParser.ConfigParser() with open(os.path.expanduser('~') + '/huoju_fty_home/config.cfg', 'rw') as f: config.readfp(f) except IOError, e: print e sys.exit(1) class APP_CFG(object): OFFLINE_CONFIG_HOST = config.get('offline_config', 'host') OFFLINE_CONFIG_USER = config.get('offline_config', 'user') OFFLINE_CONFIG_PASSWORD = config.get('offline_config', 'password') OFFLINE_CONFIG_PORT = config.get('offline_config', 'port') ONLINE_CONFIG_HOST = config.get('online_config', 'host') ONLINE_CONFIG_USER = config.get('online_config', 'user') ONLINE_CONFIG_PASSWORD = config.get('online_config', 'password') ONLINE_CONFIG_PORT = config.get('online_config', 'port') SCRAPY_CONFIG_HOST = config.get('scrapy_config', 'host') SCRAPY_CONFIG_USER = config.get('scrapy_config', 'user') SCRAPY_CONFIG_PASSWORD = config.get('scrapy_config', 'password') SCRAPY_CONFIG_PORT = config.get('scrapy_config', 'port') # # 离线数据库配置 # OFFLINE_CONFIG = config.get('info', 'offline_config') # # 在线数据库配置 # ONLINE_CONFIG = config.get('info', 'online_config') # # 电视台收视率统计路径 # AD_TELEVISION_STAT_PATH = config.get('info', 'tmp_path') + 'ad_television_stat.txt' # # 备案发行数据路径 # AD_TV_RECORD_DISTRIBUTION_PATH = config.get('info', 'tmp_path') + 'ad_tv_record_distribution.txt' # # 趋势路径 # TRENDING_PATH = config.get('info', 'tmp_path') + 'trending.txt' # # 收视预测路径 # TV_STATION_RATINGS_STAT_PATH = config.get('info', 'tmp_path') + 'tv_station_ratings_stat.txt' # # 推荐结果路径 # TV_STATION_RECOMMEND_PATH = config.get('info', 'tmp_path') + 'tv_station_recommend.txt' # # 类型预测路径 # TV_STATION_TYPE_STAT_PATH = config.get('info', 'tmp_path') + 'tv_station_type_stat.txt'