import re
import random
from random import randint
import time
import logging
import os
import urllib2
from bs4 import BeautifulSoup

from packages.google import search

from actions import *
from settings import *

"""
Jarvy : Python Intelligent Assistant for Humans
=================

Jarvy, aims to help humans by trying to understand them and figuring out best ways to respond to them.

"""

__title__ = 'jarvy'
__version__ = '1.3.0'
__build__ = 0x010300  # in the format of 00-00-00
__author__ = 'Semih Yagcioglu'
__license__ = 'MIT'
__copyright__ = 'Copyright 2015 Semih Yagcioglu'


class Jarvy:
    """ Jarvy : Python Intelligent Assistant for Humans
    """

    __LOG_LOCATION__ = "log/jarvy.log"

    def __init__(self):

        self.__setupLogger__()
        self.actions = Actions()
        self.settings = Settings()
        self.status = True

        self.wakeup()

    def __setupLogger__(self):

        self.logger = logging.getLogger('Jarvy')
        self.logger.setLevel(logging.INFO)

        # Log formatting
        formatter = logging.Formatter('%(asctime)s\t%(name)s\t%(levelname)s\t%(message)s')

        # Console handler
        # ch = logging.StreamHandler()
        # ch.setFormatter(formatter)
        # self.logger.addHandler(ch)

        # Logfile handler
        directory = os.path.dirname(self.__LOG_LOCATION__)