source: thinkgear_emulator/puzzlebox_thinkgear_emulator_configuration.py @ 89

Last change on this file since 89 was 89, checked in by sc, 11 years ago
  • preparation for 0.2.0 release
File size: 3.3 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
30BRAINSTORMS_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# ThinkGear Connect configuration
37#####################################################################
38
39THINKGEAR_DELIMITER = '\r'
40
41THINKGEAR_CONFIGURATION_PARAMETERS = {"enableRawOutput": False, "format": "Json"}
42
43ENABLE_THINKGEAR_AUTHORIZATION = False
44
45THINKGEAR_AUTHORIZATION_REQUEST = { \
46        "appName": "Puzzlebox Brainstorms", \
47        "appKey": "2e285d7bd5565c0ea73e7e265c73f0691d932408"
48        }
49
50
51#####################################################################
52# ThinkGear Connect Server Emulator configuration
53#####################################################################
54
55THINKGEAR_ENABLE_SIMULATE_HEADSET_DATA = True
56
57THINKGEAR_BLINK_FREQUENCY_TIMER = 6 # blink every 6 seconds
58                                    # (6 seconds is listed by Wikipedia
59                                    # as being the average number of times
60                                    # an adult blinks in a laboratory setting)
61
62THINKGEAR_DEFAULT_SAMPLE_WAVELENGTH = 30 # number of seconds from 0 to max
63                                         # and back to 0 for any given
64                                         # detection value below
65
66
67#####################################################################
68# Flash socket policy handling
69#####################################################################
70
71FLASH_POLICY_FILE_REQUEST = \
72        '<policy-file-request/>%c' % 0 # NULL byte termination
73FLASH_SOCKET_POLICY_FILE = '''<?xml version="1.0"?>
74<!DOCTYPE cross-domain-policy SYSTEM "/xml/dtds/cross-domain-policy.dtd">
75<cross-domain-policy>
76   <site-control permitted-cross-domain-policies="all" />
77   <allow-access-from domain="*" to-ports="%i" />
78</cross-domain-policy>%c''' % (THINKGEAR_SERVER_PORT, 0)
79
80
81#####################################################################
82# Configuration File Parser
83#####################################################################
84
85if os.path.exists(CONFIGURATION_FILE_PATH):
86       
87        file = open(CONFIGURATION_FILE_PATH, 'r')
88       
89        for line in file.readlines():
90                line = line.strip()
91                if len(line) == 0:
92                        continue
93                if line[0] == '#':
94                        continue
95                if line.find('=') == -1:
96                        continue
97                try:
98                        exec line
99                except:
100                        if DEBUG:
101                                print "Error recognizing configuration option:",
102                                print line
103
Note: See TracBrowser for help on using the repository browser.