def process_results(results):
    """ process the results and gather data """

    conn = get_connection()
    new_results = []
    for d in results:
        mirror = d.get('mirror')
        if mirror in IGNORE_MIRRORS:
            # skip mirrors we want to ignore.
            continue
        status = d.get('status')
        location = get_location_for_mirror(mirror)
        d['location'] = location_name(location)
        if status != 'Unavailable':
            resp_time = d.get('response_time')
            age = get_total_seconds(d.get('time_diff'))
            conn.rpush(cache_key('RESPTIME', mirror), resp_time)
            conn.rpush(cache_key('AGE', mirror), age)
            resp_list = conn.lrange(cache_key('RESPTIME', mirror), -60, -1)
            age_list = conn.lrange(cache_key('AGE', mirror), -60, -1)
            d['num_packages'] = find_number_of_packages(mirror)
            d['resp_list'] = ",".join(resp_list)
            d['age_list'] = ",".join(age_list)
        new_results.append(d)
    return new_results
Beispiel #2
0
def process_results(results):
    """ process the results and gather data """

    conn = get_connection()
    new_results = []
    for d in results:
        mirror = d.get('mirror')
        if mirror in IGNORE_MIRRORS:
            # skip mirrors we want to ignore.
            continue
        status = d.get('status')
        location = get_location_for_mirror(mirror)
        d['location'] = location_name(location)
        if  status != 'Unavailable':
            resp_time = d.get('response_time')
            age = get_total_seconds(d.get('time_diff'))
            conn.rpush(cache_key('RESPTIME', mirror), resp_time )
            conn.rpush(cache_key('AGE', mirror), age)
            resp_list = conn.lrange(cache_key('RESPTIME', mirror), -60, -1)
            age_list = conn.lrange(cache_key('AGE', mirror), -60, -1)
            d['num_packages'] = find_number_of_packages(mirror)
            d['resp_list'] = ",".join(resp_list)
            d['age_list'] = ",".join(age_list)
        new_results.append(d)
    return new_results
Beispiel #3
0
def process_results(results):
    """ process the results and gather data """

    new_results = []
    for d in results:
        mirror = d.get('mirror')
        status = d.get('status')
        d['location'] = "n/a"
        if  status != 'Unavailable':
            resp_time = d.get('response_time')
            age = get_total_seconds(d.get('time_diff'))
            resp_list = ["1","2","3","4","5","6","7","8","9","10"] # faked out for test
            age_list = ["1","2","3","4","5","6","7","8","9","10"] # faked out for test
            d['num_packages'] = find_number_of_packages(mirror)
            d['resp_list'] = ",".join(resp_list)
            d['age_list'] = ",".join(age_list)
        new_results.append(d)
    return new_results
Beispiel #4
0
def process_results(results):
    """ process the results and gather data """

    new_results = []
    for d in results:
        mirror = d.get("mirror")
        if mirror in IGNORE_MIRRORS:
            # skip mirrors we want to ignore.
            continue
        status = d.get("status")
        d["location"] = "n/a"
        if status != "Unavailable":
            resp_time = d.get("response_time")
            age = get_total_seconds(d.get("time_diff"))
            resp_list = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]  # faked out for test
            age_list = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]  # faked out for test
            d["num_packages"] = find_number_of_packages(mirror)
            d["resp_list"] = ",".join(resp_list)
            d["age_list"] = ",".join(age_list)
        new_results.append(d)
    return new_results
Beispiel #5
0
def create_emoji_filters(input_file, emoji_amount, emoji_size):
    comp_name = '0:v'
    seconds = get_total_seconds(input_file)
    width, height = get_dimensions(input_file)

    emoji_filters = []
    emoji_amt = emoji_amount * make_random_value([0.75, 0.95])
    smallest_dimension = min(width, height)
    random_emojis = get_random_emojis(int(seconds * emoji_amt),
                                      (smallest_dimension * emoji_size))
    emoji_keys = random_emojis.keys()

    for idx, emoji in enumerate(emoji_keys):
        size = random_emojis[emoji]['size']
        filter_str = random_emojis[emoji]['filter_str']

        max_x = width - size
        max_y = height - size
        pos_x = make_random_value([0, max_x])
        pos_y = make_random_value([0, max_y])

        dur = make_random_value([2, 5])
        max_start = seconds - dur
        start = make_random_value([0, max_start])
        end = start + dur

        new_comp = 'comp_{}'.format(idx)
        overlay = "overlay={}:{}:enable='between(t, {}, {})'".format(
            pos_x, pos_y, start, end)
        emoji_filter = ';'.join(
            [filter_str, '[{}][{}]{}'.format(comp_name, emoji, overlay)])

        if idx < (len(emoji_keys) - 1):
            emoji_filter += '[{}];'.format(new_comp)
            comp_name = new_comp

        emoji_filters.append(emoji_filter)

    return emoji_filters
Beispiel #6
0
def process_results(results):
    """ process the results and gather data """

    new_results = []
    for d in results:
        mirror = d.get('mirror')
        if mirror in IGNORE_MIRRORS:
            # skip mirrors we want to ignore.
            continue
        status = d.get('status')
        d['location'] = "n/a"
        if status != 'Unavailable':
            resp_time = d.get('response_time')
            age = get_total_seconds(d.get('time_diff'))
            resp_list = ["1", "2", "3", "4", "5", "6", "7", "8", "9",
                         "10"]  # faked out for test
            age_list = ["1", "2", "3", "4", "5", "6", "7", "8", "9",
                        "10"]  # faked out for test
            d['num_packages'] = find_number_of_packages(mirror)
            d['resp_list'] = ",".join(resp_list)
            d['age_list'] = ",".join(age_list)
        new_results.append(d)
    return new_results