Example #1
0
    config = get_config()
    if args.testtwitch or args.testyoutube:
        import shutil
        shutil.rmtree('logocache', ignore_errors=True)
        shutil.rmtree('badgecache', ignore_errors=True)
        shutil.rmtree('emotecache', ignore_errors=True)
        shutil.rmtree('profile_images', ignore_errors=True)

    if args.testtwitch:
        from twitch.api import v3 as twitch
        featured_streams = twitch.streams.featured(limit=5)['featured']
        for x in featured_streams:
            config['twitch_channels'].append(x['stream']['channel']['name'])

    try:
        console = TwitchChatDisplay(config['screen_width'], config['screen_height'])
        console.display_message("Loading twitch_api manager")
        thandler = twitchevents(config['twitch_channels'])
        thandler.subscribe_new_follow(console.new_followers)
        thandler.subscribe_viewers_change(console.new_viewers)
        console.display_message("Loading twitch_message handler")
        tirc = twitch_chat(config['twitch_username'], config['twitch_oauth'], config['twitch_channels'],
                           config['client_id'])
        tirc.subscribeChatMessage(console.new_twitchmessage)
        tirc.subscribeNewSubscriber(console.new_subscriber)
        ytchat = None
        if 'youtube_enabled' in config:
            if config['youtube_enabled']:
                console.display_message("Grabbing youtube chat id")
                chatId = None
                if args.testyoutube:
Example #2
0
                        '--debug',
                        help="Enable debugging statements",
                        action="store_const",
                        dest="loglevel",
                        const=logging.DEBUG,
                        default=logging.INFO,)
    args = parser.parse_args()
    logging.basicConfig(level=args.loglevel,
                        format='%(asctime)s.%(msecs)d %(levelname)s %(name)s : %(message)s',
                        datefmt='%H:%M:%S')
    config = get_config()
    if args.test:
        from twitch.api import v3 as twitch
        featured_streams = twitch.streams.featured(limit=5)['featured']
        for x in featured_streams:
            config['twitch_channels'].append(x['stream']['channel']['name'])

    console = TwitchChatDisplay(1920, 1080)
    thandler = TwitchHandler(config['twitch_channels'])
    thandler.subscribe_new_follow(console.new_followers)
    tirc = twitch_chat(config['twitch_username'], config['twitch_oauth'], config['twitch_channels'])
    tirc.subscribeChatMessage(console.new_twitchmessage)
    tirc.subscribeNewSubscriber(console.new_subscriber)
    try:
        console.start()
        thandler.start()
        tirc.run()
    finally:
        console.stop()
        thandler.stop()