source: thinkgear_emulator/puzzlebox_thinkgear_emulator_configuration.py @ 100

Last change on this file since 100 was 90, checked in by sc, 11 years ago
  • debugging in preparation for 0.2.0 release
File size: 3.5 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3#
4# Puzzlebox - ThinkGear Emulator - Configuration
5#
6# Copyright Puzzlebox Productions, LLC (2010)
7#
8# This code is released under the GNU Pulic License (GPL) version 2
9# For more information please refer to http://www.gnu.org/copyleft/gpl.html
10#
11# Last Update: 2010.07.08
12#
13#####################################################################
14
15import os, sys
16
17#####################################################################
18# General configuration
19#####################################################################
20
21DEBUG = 1
22
23CONFIGURATION_FILE_PATH = 'puzzlebox_thinkgear_emulator_configuration.ini'
24
25
26#####################################################################
27# Network addresses
28#####################################################################
29
30THINKGEAR_SERVER_INTERFACE = '' # listen on all of server's network interfaces
31THINKGEAR_SERVER_HOST = '127.0.0.1'
32THINKGEAR_SERVER_PORT = 13854
33
34
35#####################################################################
36# Client configuration
37#####################################################################
38
39CLIENT_NO_REPLY_WAIT = 5 # how many seconds before considering a component dead
40
41
42#####################################################################
43# ThinkGear Connect configuration
44#####################################################################
45
46THINKGEAR_DELIMITER = '\r'
47
48THINKGEAR_CONFIGURATION_PARAMETERS = {"enableRawOutput": False, "format": "Json"}
49
50ENABLE_THINKGEAR_AUTHORIZATION = False
51
52THINKGEAR_AUTHORIZATION_REQUEST = { \
53        "appName": "Puzzlebox Brainstorms", \
54        "appKey": "2e285d7bd5565c0ea73e7e265c73f0691d932408"
55        }
56
57
58#####################################################################
59# ThinkGear Connect Server Emulator configuration
60#####################################################################
61
62THINKGEAR_ENABLE_SIMULATE_HEADSET_DATA = True
63
64THINKGEAR_BLINK_FREQUENCY_TIMER = 6 # blink every 6 seconds
65                                    # (6 seconds is listed by Wikipedia
66                                    # as being the average number of times
67                                    # an adult blinks in a laboratory setting)
68
69THINKGEAR_DEFAULT_SAMPLE_WAVELENGTH = 30 # number of seconds from 0 to max
70                                         # and back to 0 for any given
71                                         # detection value below
72
73
74#####################################################################
75# Flash socket policy handling
76#####################################################################
77
78FLASH_POLICY_FILE_REQUEST = \
79        '<policy-file-request/>%c' % 0 # NULL byte termination
80FLASH_SOCKET_POLICY_FILE = '''<?xml version="1.0"?>
81<!DOCTYPE cross-domain-policy SYSTEM "/xml/dtds/cross-domain-policy.dtd">
82<cross-domain-policy>
83   <site-control permitted-cross-domain-policies="all" />
84   <allow-access-from domain="*" to-ports="%i" />
85</cross-domain-policy>%c''' % (THINKGEAR_SERVER_PORT, 0)
86
87
88#####################################################################
89# Configuration File Parser
90#####################################################################
91
92if os.path.exists(CONFIGURATION_FILE_PATH):
93       
94        file = open(CONFIGURATION_FILE_PATH, 'r')
95       
96        for line in file.readlines():
97                line = line.strip()
98                if len(line) == 0:
99                        continue
100                if line[0] == '#':
101                        continue
102                if line.find('=') == -1:
103                        continue
104                try:
105                        exec line
106                except:
107                        if DEBUG:
108                                print "Error recognizing configuration option:",
109                                print line
110
Note: See TracBrowser for help on using the repository browser.