-
-
-def switch():
- """
- Switch stream
- """
- try:
- target = g['stuff'].split()[0]
- # Filter and ignore
- args = parse_arguments()
- try:
- if g['stuff'].split()[-1] == '-f':
- guide = 'To ignore an option, just hit Enter key.'
- printNicely(light_magenta(guide))
- only = raw_input('Only nicks [Ex: @xxx,@yy]: ')
- ignore = raw_input('Ignore nicks [Ex: @xxx,@yy]: ')
- 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 thread
- g['stream_stop'] = True
- args.track_keywords = keyword
- # Start new thread
- th = threading.Thread(target=stream, args=(c['PUBLIC_DOMAIN'], args))
- th.daemon = True
- th.start()
- # Personal stream
- elif target == 'mine':
- # Kill old thread
- g['stream_stop'] = True
- # Start new thread
- th = threading.Thread(target=stream, args=(c['USER_DOMAIN'], args, g['original_name']))
- th.daemon = True
- th.start()
- g['prefix'] = True
- printNicely('')
- if args.filter:
- printNicely(cyan('Only: ' + str(args.filter)))
- if args.ignore:
- printNicely(red('Ignore: ' + str(args.ignore)))
- printNicely('')
- except Exception:
- printNicely(red('Sorry I can\'t understand.'))