-
Notifications
You must be signed in to change notification settings - Fork 1
/
settings.py
412 lines (378 loc) · 8.57 KB
/
settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Main configuration file """
import os
import sys
import logging
import logging.handlers
import multiprocessing
from unipath import Path
MY_NAME = 'smarty'
# for session
SECRET_KEY = 'yoursecretkeytypeanystring'
# Robot's gmail account
MY_ACCOUNTS = {'gmail': {'email': 'smarty',
'password': 'botpassword'}}
REDIS = {
'password': 'test',
'socket': '/var/run/redis/redis.sock'
}
GOOGLE = {
'google_talk_server': 'talk.google.com',
'google_talk_server_port': '443',
'google_app_name': 'googleappname',
'google_app_password': 'googleapppassword',
}
TWITTER = {
'consumer_key': '',
'consumer_secret': '',
'access_token_key': '',
'access_token_secret': '',
}
LINKEDIN = {
'consumer_key': '',
'consumer_secret': '',
'access_token_key': '',
'access_token_secret': '',
'return_url': 'http://www.smarty-bot.com'
}
REDMINE = {
'url': '',
'key': '',
'username': '',
'password': ''
}
SUGARCRM = {
'url': 'h',
'username': '',
'password': ''
}
# database
DB = 'mysql+mysqldb://smarty:smarty@db/smarty'
PEOPLE = {
'admin': {
'email': 'youradmin@yourdomain.com'
},
'developer': {
'email': 'developer@yourdomain.com'
}
}
ROBOT_DIR = Path(__file__).ancestor(3)
HOME_DIR = ROBOT_DIR.parent
LOG_DIR = ROBOT_DIR.child('core', 'var', 'log')
CONFIG_DIR = ROBOT_DIR.child('core', 'config')
TMP_DIR = '/tmp'
DEMO_MUSIC_DIR = ROBOT_DIR + '/music/'
FREEBASE = {
"api_key": ''
}
if not os.path.exists(LOG_DIR):
os.makedirs(LOG_DIR)
# try to create log file
file = open('%s/message.log' % LOG_DIR, 'w+')
# Make a global logging object.
logging.basicConfig(filename='%s/message.log' % LOG_DIR, level=logging.DEBUG)
logger = logging.getLogger("logfun")
logger.setLevel(logging.DEBUG)
hand = logging.StreamHandler()
f = logging.Formatter(
"%(levelname)s %(asctime)s %(funcName)s %(lineno)d %(message)s")
hand.setFormatter(f)
logger = logging.getLogger()
smtp_handler = logging.handlers.SMTPHandler(
mailhost=("smtp.gmail.com", 587),
fromaddr=MY_ACCOUNTS['gmail']['email'],
toaddrs=PEOPLE['admin']['email'],
subject=u"%s error!" % MY_NAME,
credentials=(
MY_ACCOUNTS['gmail']['email'],
MY_ACCOUNTS['gmail']['password']
),
secure=()
)
# inform about exceptions only
smtp_handler.setLevel(logging.ERROR)
logger.addHandler(smtp_handler)
logger.addHandler(hand)
multiprocessing.log_to_stderr(logging.DEBUG)
SPEECH_RECOGNITION_ENABLED = True
JABBER_ENABLED = True
WEBSOCK_ENABLED = True
APP_DIRS = {
'config_dir': CONFIG_DIR
, 'lib_dir': CONFIG_DIR + "/../lib/"
, 'app_dir': CONFIG_DIR + "/../"
, 'tmp_input_audio_dir': CONFIG_DIR + "/../tmp/input/audio/"
, 'tmp_output_audio_dir': CONFIG_DIR + "/../tmp/output/audio/"
, 'tmp_input_video_dir': CONFIG_DIR + "/../tmp/input/video/"
, 'audio_dir': CONFIG_DIR + "/../var/dict/audio/"
, 'brain_modules_dir': CONFIG_DIR + "/../brain/"
}
PLAYER_PATH = '/usr/bin/mplayer'
INSTALLED_LIBS = (
'Skype4Py',
)
sys.path.append(os.path.dirname(APP_DIRS['app_dir']))
sys.path.append(os.path.dirname(APP_DIRS['config_dir']))
sys.path.append(ROBOT_DIR)
for lib in INSTALLED_LIBS:
sys.path.append(
os.path.dirname(APP_DIRS['lib_dir'] + lib + '/')
)
DEVICES = {
# Your capture device, use arecord -L to retrieve the one you use
'audio_input': "default",
'audio_output': "default"
}
# greetings must be a tuple
# will be moved to separate dictionary or refactored later
GREETINGS = (
'hello'
, 'Hello'
, 'hey'
, 'yo'
, 'morning'
, 'good morning'
, 'good afternoon'
, 'good day'
, 'good evening'
, 'hello' + MY_NAME
, 'hey ' + MY_NAME
)
# will be moved to separate dictionary or refactored later
S_QUESTIONS = (
"what"
, "what is"
, "what are"
, "where is"
, "where are"
, "where he"
, "where you"
, "where"
, "where it"
, "who is"
, "who are"
, "who"
, "whose is"
, "whose are"
, "whose"
, "which is"
, "which are"
, "which"
, "was it"
, "was she"
, "was he"
, "was"
, "wasn't"
, "how"
, "when"
, "were"
, "why"
, "do"
, "don't"
, "did"
, "didn't"
, "does"
, "doesn't"
, "have"
, "haven't"
, "had"
, "hadn't"
, "has"
, "hasn't"
, "can"
, "can't"
, "could"
, "couldn't"
, "are"
, "is"
, "isn't"
"aren't")
E_QUESTIONS = (
"are you"
, "aren't you"
, "do i"
, "do you"
, "do we"
, "do they"
, "does she"
, "does he"
, "does it"
, "doesn't it"
, "doesn't he"
, "doesn't she"
, "don't you"
, "have you"
, "have we"
, "have they"
, "have it"
, "haven't you"
, "are they"
, "isn't you"
, "did you"
, "didn't you"
)
# common polite questions
POLITE = (
'whould you mind',
'could you please',
'please',
'would you please',
'can you please',
'can you tell me',
'could you tell me',
'i wonder if',
MY_NAME,
MY_NAME.lower()
)
# actually this is the weak place in command recognition mechanism
# if you have some better ideas we would really appreciate to hear them
# these are simple commands that will be executed by
# first word in requested sentense like "say hello"
# This tuple still exists because I did not have time to make it better.
# It contains commands that have arguments.
# Example: after "delete link" an argument
# should follow, like: delete link mysite.com
# If you have any other elegant and simple solution which may replace
# this ugly dictionary please post a comment on github or fork.
#
EMBEDDED_COMMANDS = (
MY_NAME
, 'hi'
, 'say'
, 'send jabber message'
, 'receive'
, 'put'
, 'read'
, 'repeat'
, 'message'
, 'play music'
, 'upgrade'
, 'update me every day with'
, 'update me every hour with'
, 'update me each'
, 'update me in'
, 'update me at'
, 'update me before'
, 'update me after'
, 'update me during'
, 'update me on'
, 'update me next'
, 'update me tomorrow'
, 'update'
, 'help'
, 'turn'
, 'sneeze'
, 'tweet'
, 'ip'
, 'my name is'
, 'my zip is'
, 'my zipcode is'
, 'my zip code is'
, 'my post code is'
, 'my postcode is'
, 'add site url'
, 'add my site url'
, 'add url'
, 'add link'
, 'add new url'
, 'add new link'
, 'add new site url'
, 'add user'
, 'add new user'
, 'create user'
, 'create new user'
, 'create new reaction'
, 'add'
, 'remind me every day with'
, 'remind me after'
, 'remind me at'
, 'remind me before'
, 'remind me during'
, 'remind me each'
, 'remind me every'
, 'remind me hourly'
, 'remind me in the morning'
, 'remind me in the afternoon'
, 'remind me in the midnight'
, 'remind me in'
, 'remind me monthly'
, 'remind me next'
, 'remind me on'
, 'remind me once'
, 'remind me today'
, 'remind me tomorrow'
, 'remind me twice'
, 'remind me weekly'
, 'remind me with'
, 'remind me yearly'
, 'inform me every'
, 'inform me each'
, 'inform me in'
, 'inform me at'
, 'inform me before'
, 'inform me after'
, 'inform me during'
, 'inform me on'
, 'inform me next'
, 'inform me tomorrow'
, 'invite to gtalk'
, 'notify me every'
, 'notify me each'
, 'notify me in'
, 'notify me at'
, 'notify me before'
, 'notify me after'
, 'notify me during'
, 'notify me on'
, 'notify me next'
, 'notify me tomorrow'
, 'msg me every'
, 'msg me each'
, 'msg me in'
, 'msg me at'
, 'msg me before'
, 'msg me after'
, 'msg me during'
, 'msg me on'
, 'msg me next'
, 'msg me tomorrow'
, 'message me'
, 'ping me'
, 'alert me'
, 'who is'
, "whois"
, 'delete link' # because after delete link an argument follows, like: delete link mysite.com
, 'delete url'
, 'delete site url'
, 'remove url'
, 'remove site url'
, 'remove link'
, 'remove'
, 'find'
)
MSG_ME = (
'remind me with message',
'update me with message',
'notify me with message',
'alert me with message',
'message me with',
'msg me with',
'update me with ',
'notify me with',
'alert me with',
'with message',
'with msg',
'remind with',
'update with',
'alert with',
'send me',
'with message'
'with msg'
'with txt'
'with text'
'with'
'by'
'to',
'of',
)