Esempio n. 1
0
    del config['main']['firstrun']
    config['main']['lastprocessed'] = '0'

debug = 'debug' in config['main'] and config['main']['debug'] == 'true'
if debug:
    print("phonetotiming.py running at " + str(datetime.datetime.now()))

lastprocessed = int(config['main']['lastprocessed'])
currentprocessed = lastprocessed
hadError = False

# connect to Fritz!Box
fCall = FritzCall(address=fritzAddress, password=fritzPassword)

# read call list
calls = fCall.get_calls()

for call in calls:
    callInfo = {}

    # process all calls with id after lastprocessed
    if debug:
        print("Call id ", call.id)
    if call.id <= lastprocessed:
        continue

    if debug:
        print("Found new Call with Id " + str(call.id))

    if firstRun:
        currentprocessed = max(currentprocessed, call.id)
Esempio n. 2
0
    fritzconn = FritzConn()

    fc = FritzCall(fc=fritzconn)
    cp = CallPrefix(fc=fritzconn)
    pb = Phonebook(fc=fritzconn)

    calls = fc.get_missed_calls(update=True)
    missed_list = []
    for call in calls:
        number = call.Called if call.type == 3 else call.Caller
        missed_list.append(number)
    counts = Counter(missed_list)
    print("\nMissed calls, ordered by count:")
    print(counts)

    calls = fc.get_calls(update=True)
    numbers = set()
    for call in calls:
        number = call.Called if call.type == 3 else call.Caller
        if number:  # If CLIR / Anon, there is no number
            if not number.startswith('0'):
                number = cp.area_code + number
            numbers.add(number)

    print(f'\nAll {len(calls)} calls, uniqued {len(numbers)}:')
    print(numbers)

    anylist = pb.get_all_numbers_for_pb_ids([0, 1, 2])  # White- or blacklist

    print('\nWhite- or blacklisted:')
    unknowns = set()