#!/usr/bin/env python3 """ This script takes multiple .log data files from PCScreenWatcher and a Firefox history database (places.sqlite) inside a folder to extract each activity title, their url if applicable and usage timestamps into a pseudo-csv file. """ import csv import os import re from datetime import datetime from pathlib import Path from read_sqlite import get_url_from_sqlite # takes the log data string and returns a list of activity titles and their time windows def extract_activities(log_data): BROWSER_TITLE_SUFFIX = " - Mozilla Firefox" # regex which matches between squared brackets reg_titles = re.compile("(?<=\[).*?(?=\])") # regex for total/active time reg_time = re.compile( "(?