diff --git a/wad.py b/wad.py index 1b87a69..351c57b 100644 --- a/wad.py +++ b/wad.py @@ -62,51 +62,77 @@ def list(sid): def dump_chats(output, sid): df = get_df('ZWAMESSAGE') - chat_list = get_df('ZWACHATSESSION')[~get_df('ZWACHATSESSION').ZCONTACTJID.str.contains('status')] # Hide status messages + media = get_df('ZWAMEDIAITEM') + chat_list = get_df('ZWACHATSESSION')[~get_df('ZWACHATSESSION').ZCONTACTJID.str.contains('status')].reset_index() # Hide status messages output = os.path.normpath(output) # Setup yattag, generate HTML - doc, tag, text, line = Doc().ttl() def generate_html(df): + is_group_chat = False if 'g.us' in df.ZFROMJID[df.ZFROMJID.first_valid_index()]: is_group_chat = True - + + def is_from_me(): + if row['ZPUSHNAME']: + return False + else: + return True + + doc, tag, text, line = Doc().ttl() doc.asis('') - for index, row in df.iterrows(): - with tag('html'): - with tag('head'): - doc.asis('') - with tag('body'): - with tag('header'): - line('h1', df.ZPUSHNAME[df.ZPUSHNAME.first_valid_index()]) - with tag('main'): - for index, row in df.iterrows(): - if str(row['ZTEXT']) == 'None': - continue - elif str(row['ZPUSHNAME']) == 'None': - line('p', row['ZTEXT'], ('data-date', timestamp_to_apple(row['ZMESSAGEDATE'])), klass = 'host') - else: - if is_group_chat: - line('p', row['ZTEXT'], ('data-from', row['ZPUSHNAME']), ('data-date', timestamp_to_apple(row['ZMESSAGEDATE']))) - doc.asis('