Пример #1
0
def my_break(break_info = None):
    """
    Function to keep track of breaks
    :param break_info: a dictionary with the following keys:
        t_break <int> default is 3
        url <string> default "https://www.youtube.com/watch?annotation_id=annotation_2406068509&feature=iv&src_vid=cUYSGojUuAU&v=AruWNRVZfyk"
        t_sleep <int> in seconds, default = 1 hour
    :return:
    """
    if break_info is None:
        break_info = {}
        break_info['t_breaks'] = 3
        break_info['url'] = "https://www.youtube.com/watch?annotation_id=annotation_2406068509&feature=iv&src_vid=cUYSGojUuAU&v=AruWNRVZfyk"
        break_info['t_sleep'] = 60 * 60 # one hour
        #break_info['t_sleep'] = 5
        # test for individual keys
        # if <keys> in dict
    if not 't_breaks' in break_info:
        break_info['t_breaks'] = 3

    if not 'url' in break_info:
        break_info['url'] = "https://www.youtube.com/watch?annotation_id=annotation_2406068509&feature=iv&src_vid=cUYSGojUuAU&v=AruWNRVZfyk"

    if not 't_sleep' in break_info:
        break_info['t_sleep'] = 60 * 60  # one hour
        #break_info['t_sleep'] = 5

    break_count = 0
    while break_count < break_info['t_breaks']:
        openw(break_info['url'])
        time.sleep(break_info['t_sleep'])
        break_count += 1
Пример #2
0
def break_music(break_info=None):
    """
    Function to keep track of breaks
    :param break_info:  a dictionary with the following info
        t_break <int> default = 3
        url<string> default = TSO Mad Russian Christmas
        t_sleep <integer> integer in seconds, default = 1 hr
    :return: Nothing
    """
    global break_count
    if break_info is None:
        break_info = {}
    if "t_breaks" not in break_info:
        break_info["t_breaks"] = 3
    if "url" not in break_info:
        break_info["url"] = "https://youtu.be/6P9xxJ4V7no"
    if "t_sleep" not in break_info:
        break_info["t_sleep"] = 60 * 60
    while True:
        print("break " + str(break_count))
        openw(break_info["url"])
        break_count += 1
        if break_count >= break_info["t_breaks"]:
            break
        time.sleep(break_info["t_sleep"])
Пример #3
0
def my_break(break_info=None):
    """
    Function to keep track of breaks
    :param break_info: a dictionary with the following keys:
        t_break <int> default is 3
        url <string> default "https://www.youtube.com/watch?v=2vjPBrBU-TM&index=1&list=RDEMieiteXw81tMLBdKv8qkChg"
        t_sleep <int> in seconds, default = 3
    :return:
    """
    if break_info is None:
        break_info = {}
        break_info["t_breaks"] = 3
        break_info[
            "url"] = "https://www.youtube.com/watch?v=2vjPBrBU-TM&index=1&list=RDEMieiteXw81tMLBdKv8qkChg"
        #break_info["t_sleep"] = 60 * 60 # one hour
        break_info["t_sleep"] = 3  # 3 seconds
        # TODO: test for individual keys
        # if <key> in dict

    #total_breaks = 3
    break_count = 0

    while (break_count < break_info['t_breaks']):
        #url = "https://www.youtube.com/watch?v=2vjPBrBU-TM&index=1&list=RDEMieiteXw81tMLBdKv8qkChg"
        openw(break_info['url'])
        #time.sleep(5)
        time.sleep(break_info['t_sleep'])
        break_count += 1
Пример #4
0
def my_break(break_info=None):
    """
    Function to keep track of breaks
    :param break_info: a dictionary with the following info:
         t_break <int> default is 3
         url <string> default "https://www.youtube.com/watch?v=klZDJmV6MVg"
         t_sleep <int> in seconds, default = 1 hours
    :return:
    """
    if break_info is None:
        # Default info
        break_info = {}
        break_info["t_breaks"] = 3
        break_info["url"] = "https://www.youtube.com/watch?v=klZDJmV6MVg"
        break_info["t_sleep"] = 60 * 60  # one hour
        #break_info["t_sleep"] = 3 # one hour
        # TODO: test for individual keys
        # if <key> in dict

        break_count = 0
        while (break_count < break_info['t_breaks']):
            url = "https://www.youtube.com/watch?v=klZDJmV6MVg"
            openw(url)
            time.sleep(3)
            break_count += 1
Пример #5
0
def google():
    if cb.get() == 'Area':
        sh = areas.value()
    else:
        sh = volumes.value()
    with ZipFile('./res.dat') as z:
        z.extract('google.json')
        with open('./google.json', 'r') as f:
            dic = json.load(f)
    openw(dic[sh])
    remove('./google.json')
Пример #6
0
def set_breaks(sleep_time=5, total_breaks=3, url="https://www.youtube.com/watch?annotation_id=annotation_2406068509&feature=iv&src_vid=cUYSGojUuAU&v=AruWNRVZfyk"):
    """
    Opens a web page at specific intervals (for tracking breaks)
    :param sleep_time: seconds between breaks
    :param total_breaks: total number of breaks
    :param url: web page to visit
    :return: none
    """
    #total_breaks = 3
    break_count = 0
    #url = "https://www.youtube.com/watch?annotation_id=annotation_2406068509&feature=iv&src_vid=cUYSGojUuAU&v=AruWNRVZfyk"

    while break_count < total_breaks:
        openw(url)
        time.sleep(sleep_time)
        break_count += 1
Пример #7
0
def my_break(break_info=None):
    """

    :param break_info: dictionary with following items
        t_break int
        url string
        t_sleep int
    :return:
    """
    if break_info is None:
        break_info = {}
        break_info["t_breaks"] = 3
        break_info["url"] = "https://www.youtube.com/watch?v=Q0CbN8sfihY"
        break_info["t_sleep"] = 60 * 60

    break_count = 0

    while break_count < break_info(["t_breaks"]):

        time.sleep(break_info(["t_sleep"]))
        openw(break_info(["url"]))
        break_count += 1
Пример #8
0
def my_break(break_info = None):
    """
    Function to keep track of breaks
    :param break_info: a dictionary with the following keys:
        t_break <int> default is 3
        url <string> default "https://youtu.be/uSD4vsh1zDA"
        t_sleep <int> in seconds, default = 1 hours
    :return:
    """
    if break_info is None:
        # Default info
        break_info = {}
        break_info["t_breaks"] = 3
        break_info["url"] = "https://youtu.be/uSD4vsh1zDA"
        break_info["t_sleep"] = 60 * 60 # one hours
        # TODO: test for individual keys
        # if <key> in dict

    break_count = 0
    while(break_count < break_info['t_breaks']):
        time.sleep(break_info['t_sleep'])
        openw(break_info['url'])
        break_count += 1