예제 #1
0
            'name': 'gaming_min',
            'value': int(totals[date] / 60)
        })
        tags.append({'date': date, 'value': 'gaming'})
elif RESCUETIME_DATABASE != '':
    psl = PublicSuffixList()
    totals = {}
    client.switch_database(RESCUETIME_DATABASE)
    durations = client.query(
        'SELECT "duration","activity" FROM "activity" WHERE category = \'Games\' AND activity != \'Steam\' AND activity != \'steamwebhelper\' AND activity != \'origin\' AND activity != \'mixedrealityportal\' AND activity != \'holoshellapp\' AND activity != \'vrmonitor\' AND activity != \'vrserver\' AND activity != \'oculusclient\' AND activity != \'vive\' AND activity != \'obs64\' AND time >= '
        + start_time)
    for duration in list(durations.get_points()):
        date = datetime.fromisoformat(duration['time'].strip('Z') +
                                      "+00:00").astimezone(
                                          LOCAL_TIMEZONE).strftime('%Y-%m-%d')
        if psl.get_public_suffix(duration['activity'], strict=True) is None:
            if date in totals:
                totals[date] = totals[date] + duration['duration']
            else:
                totals[date] = duration['duration']

    for date in totals:
        values.append({
            'date': date,
            'name': 'gaming_min',
            'duration': int(totals[date] / 60)
        })
        tags.append({'date': date, 'value': 'gaming'})

if len(tags) > 0:
    append_tags(tags)
예제 #2
0
def get_org_domain(domain):
    fn = get_suffix_list_file_name()
    with open(fn) as suffixList:
        psl = PublicSuffixList(suffixList)
        return psl.get_public_suffix(domain)