source: thinkgear_emulator/puzzlebox_thinkgear_emulator_configuration.py @ 120

Last change on this file since 120 was 116, checked in by sc, 11 years ago

thinkgear_emulator/puzzlebox_thinkgear_emulator_configuration:

  • THINKGEAR_ATTENTION_MULTIPLIER added
  • THINKGEAR_MEDITATION_MULTIPLIER added

thinkgear_emulator/puzzlebox_thinkgear_server.py:

  • support for attention and meditation multipliers added
File size: 3.6 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.20
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# Server 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
57THINKGEAR_ATTENTION_MULTIPLIER = 1.0
58
59THINKGEAR_MEDITATION_MULTIPLIER = 0.75
60
61
62#####################################################################
63# ThinkGear Connect Server Emulator configuration
64#####################################################################
65
66THINKGEAR_ENABLE_SIMULATE_HEADSET_DATA = True
67
68THINKGEAR_BLINK_FREQUENCY_TIMER = 6 # blink every 6 seconds
69                                    # (6 seconds is listed by Wikipedia
70                                    # as being the average number of times
71                                    # an adult blinks in a laboratory setting)
72
73THINKGEAR_DEFAULT_SAMPLE_WAVELENGTH = 30 # number of seconds from 0 to max
74                                         # and back to 0 for any given
75                                         # detection value below
76
77
78#####################################################################
79# Flash socket policy handling
80#####################################################################
81
82FLASH_POLICY_FILE_REQUEST = \
83        '<policy-file-request/>%c' % 0 # NULL byte termination
84FLASH_SOCKET_POLICY_FILE = '''<?xml version="1.0"?>
85<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
86<cross-domain-policy>
87   <site-control permitted-cross-domain-policies="all" />
88   <allow-access-from domain="*" to-ports="%i" />
89</cross-domain-policy>%c''' % (THINKGEAR_SERVER_PORT, 0)
90
91
92#####################################################################
93# Configuration File Parser
94#####################################################################
95
96if os.path.exists(CONFIGURATION_FILE_PATH):
97       
98        file = open(CONFIGURATION_FILE_PATH, 'r')
99       
100        for line in file.readlines():
101                line = line.strip()
102                if len(line) == 0:
103                        continue
104                if line[0] == '#':
105                        continue
106                if line.find('=') == -1:
107                        continue
108                try:
109                        exec line
110                except:
111                        if DEBUG:
112                                print "Error recognizing configuration option:",
113                                print line
114
Note: See TracBrowser for help on using the repository browser.