def get_filename(conn, contact_conn, chat_id):
	c = conn.cursor()
	c.execute("SELECT handle_id FROM chat_handle_join WHERE chat_id=?;", (chat_id,))
	names_in_chat = []
	for row in c:
		names_in_chat.append(get_contact_name(conn, contact_conn, row[0]))
	filename = sanitize_filename(" & ".join(names_in_chat))
	filename = os.path.join(OUTPUT_DIR, '%s.html' % filename)
	return filename
Exemple #2
0
def get_filename(conn, contact_conn, chat_id):
    c = conn.cursor()
    c.execute("SELECT handle_id FROM chat_handle_join WHERE chat_id=?;",
              (chat_id, ))
    names_in_chat = []
    for row in c:
        names_in_chat.append(get_contact_name(conn, contact_conn, row[0]))
    filename = sanitize_filename(" & ".join(names_in_chat))
    filename = os.path.join(OUTPUT_DIR, '%s.html' % filename)
    return filename
def output_contact(conn, backup_extractor, is_group, contact_id, contact_name, your_name):
	reset_colors()
	html = open(os.path.join(OUTPUT_DIR, '%s.html' % sanitize_filename(contact_name)), 'w', encoding="utf-8")
	html.write(TEMPLATEBEGINNING % ("WhatsApp",))
	c = conn.cursor()
	c.execute("SELECT {} FROM ZWAMESSAGE WHERE ZFROMJID=? OR ZTOJID=?;".format(FIELDS), (contact_id, contact_id))
	for row in c:
		mdatetime = get_date(row[2])
		mtext = get_text(conn, backup_extractor, row)
		mtext = mtext.replace("\n", "<br>\n")
		mfrom, color = get_from(conn, is_group, contact_id, contact_name, your_name, row)
		html.write((ROWTEMPLATE % (color, mdatetime, mfrom, mtext)))
	html.write(TEMPLATEEND)
	html.close()
Exemple #4
0
def output_contact(conn, backup_extractor, is_group, contact_id, contact_name,
                   your_name):
    reset_colors()
    html = open(os.path.join(OUTPUT_DIR,
                             '%s.html' % sanitize_filename(contact_name)),
                'w',
                encoding="utf-8")
    html.write(TEMPLATEBEGINNING % ("WhatsApp", ))
    c = conn.cursor()
    c.execute(
        "SELECT {} FROM ZWAMESSAGE WHERE ZFROMJID=? OR ZTOJID=?;".format(
            FIELDS), (contact_id, contact_id))
    for row in c:
        mdatetime = get_date(row[2])
        mtext = get_text(conn, backup_extractor, row)
        mtext = mtext.replace("\n", "<br>\n")
        mfrom, color = get_from(conn, is_group, contact_id, contact_name,
                                your_name, row)
        html.write((ROWTEMPLATE % (color, mdatetime, mfrom, mtext)))
    html.write(TEMPLATEEND)
    html.close()