add internal emoji

This commit is contained in:
ppwwyyxx
2014-12-22 09:49:30 +08:00
parent e2d2f5166f
commit 937fa8b88f
3 changed files with 31 additions and 9 deletions
+12 -1
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env python2
# -*- coding: UTF-8 -*-
# File: parser.py
# Date: Sat Dec 20 19:40:31 2014 +0800
# Date: Mon Dec 22 09:45:35 2014 +0800
# Author: Yuxin Wu <[email protected]>
import sqlite3
@@ -31,6 +31,7 @@ class WeChatDBParser(object):
self.contacts = {}
self.msgs_by_talker = defaultdict(list)
self.emojis = {}
self.internal_emojis = {}
self.parse()
def _parse_contact(self):
@@ -95,6 +96,16 @@ SELECT {} FROM message
md5, desc, group = row
self.emojis[md5] = (group, desc)
NEEDED_EMOJI_CATALOG = [49, 50]
emojiinfo_q = self.cc.execute(
""" SELECT md5, catalog, name FROM EmojiInfo WHERE name <> ''""")
for row in emojiinfo_q:
md5, catalog, name = row
if catalog not in NEEDED_EMOJI_CATALOG:
continue
self.internal_emojis[md5] = name
def parse(self):
self._parse_userinfo()
self._parse_contact()