- db.semaphore_store(False)
-
-
-def switch():
- """
- Switch stream
- """
- try:
- target = g['stuff'].split()[0]
-
- # Filter and ignore
- args = parse_arguments()
- try:
- if g['stuff'].split()[-1] == '-f':
- only = raw_input('Only nicks: ')
- ignore = raw_input('Ignore nicks: ')
- args.filter = filter(None, only.split(','))
- args.ignore = filter(None, ignore.split(','))
- elif g['stuff'].split()[-1] == '-d':
- args.filter = c['ONLY_LIST']
- args.ignore = c['IGNORE_LIST']
- except:
- printNicely(red('Sorry, wrong format.'))
- return
-
- # Public stream
- if target == 'public':
- keyword = g['stuff'].split()[1]
- if keyword[0] == '#':
- keyword = keyword[1:]
- # Kill old process
- os.kill(g['stream_pid'], signal.SIGKILL)
- args.track_keywords = keyword
- # Start new process
- p = Process(
- target=stream,
- args=(
- c['PUBLIC_DOMAIN'],
- args))
- p.start()
- g['stream_pid'] = p.pid
-
- # Personal stream
- elif target == 'mine':
- # Kill old process
- os.kill(g['stream_pid'], signal.SIGKILL)
- # Start new process
- p = Process(
- target=stream,
- args=(
- c['USER_DOMAIN'],
- args,
- g['original_name']))
- p.start()
- g['stream_pid'] = p.pid
- printNicely('')
- if args.filter:
- printNicely(cyan('Only: ' + str(args.filter)))
- if args.ignore:
- printNicely(red('Ignore: ' + str(args.ignore)))
- printNicely('')
- except:
- printNicely(red('Sorry I can\'t understand.'))
+ c['lock'] = False
+ # Init tweet dict and message dict
+ c['tweet_dict'] = []
+ c['message_dict'] = []
+ # Image on term
+ c['IMAGE_ON_TERM'] = args.image_on_term
+ set_config('IMAGE_ON_TERM', str(c['IMAGE_ON_TERM']))
+ # Mute dict
+ c['IGNORE_LIST'] += build_mute_dict()