コード例 #1
0
ファイル: Gmail2SQLite.py プロジェクト: jacobbieker/Insights
def print_payload(message):
    # if the message is multipart, its payload is a list of messages
    if message.is_multipart():
        for part in message.get_payload():
            print_payload(part)
    else:
        Message.insert({'date': message.get('date'),
                        'type': 'email',
                        'sender': message.get('from'),
                        'reciever': message.get('to'),
                        'message': message.get_payload()}).execute()
コード例 #2
0
ファイル: GVoice2SQLite.py プロジェクト: jacobbieker/Insights
def insert_many_queries(call_queries, text_queries, voicemail_queries):
    if len(call_queries) >= num_before_insert:
        Call.insert_many(call_queries).execute()
        # Remove all the stored ones
        del call_dict[:]
        print("Inserted " + str(num_before_insert) + " or more Calls")
    if len(text_queries) >= num_before_insert:
        for text_message in text_queries:
            Message.insert(text_message).execute()

        # Message.insert_many(text_queries).execute()
        del text_dict[:]
        print("Inserted " + str(num_before_insert) + " or more Texts")
    if len(voicemail_queries) >= num_before_insert:
        Voicemail.insert_many(voicemail_queries).execute()
        del voicemail_dict[:]
        print("Inserted " + str(num_before_insert) + " or more Voicemails")
コード例 #3
0
    #print_conversation(conversation)
    # Need to save to the database
    for event in conversation.get_events():
        participants = conversation.get_participants()
        recievers = participants.get_recievers_id(event.get_sender_id())
        list_of_recievers = str(recievers)
        event_type = event.get_type()
        message = str(event.get_formatted_message())
        sender = participants.get_by_id(event.get_sender_id())
        sender_name = str(sender)
        if str(event_type) == "VOICEMAIL":
            Voicemail.insert({'date': event.get_timestamp(), 'caller': sender_name,
                              'message': message}).execute()
        elif str(event_type) == "SMS":
            Message.insert({'date': event.get_timestamp(), 'type': 'sms',
                        'sender': sender_name, 'reciever': list_of_recievers,
                        'message': message}).execute()
        elif str(event_type) == "REGULAR_CHAT_MESSAGE":
            Message.insert({'date': event.get_timestamp(), 'type': 'hangouts',
                            'sender': sender_name, 'reciever': list_of_recievers,
                            'message': message}).execute()
        else:
            print("Event Type not Recognized: " + str(event_type))





def get_particpant(participant):
    name = participant.get("fallback_name")
    chat_id = participant.get("id").get("chat_id")