From 45669a38b5b61734f80ef1288b811472f2a226f8 Mon Sep 17 00:00:00 2001 From: ppwwyyxx Date: Mon, 12 Jan 2015 00:09:00 +0800 Subject: [PATCH] add example --- README.md | 5 +++-- lib/render.py | 3 ++- lib/static/gen_smiley_css.py | 40 ------------------------------------ 3 files changed, 5 insertions(+), 43 deletions(-) delete mode 100755 lib/static/gen_smiley_css.py diff --git a/README.md b/README.md index 7eb0d91..bdcd9ac 100644 --- a/README.md +++ b/README.md @@ -43,10 +43,11 @@ This tool can parse and dump WeChat chat history on a rooted android phone. ./dump_html.py decrypted.db resource output.html ``` -### Screenshot: -An example html (very similar to web wechat): +### Examples: ![byvoid](https://github.com/ppwwyyxx/wechat-dump/raw/master/screenshots/byvoid.jpg) +[An example html](http://ppwwyyxx.com/static/wechat/example.html) + ### TODO + Search by uid/username + Skip existing files when copying android resources diff --git a/lib/render.py b/lib/render.py index 63ad935..b760672 100644 --- a/lib/render.py +++ b/lib/render.py @@ -1,7 +1,7 @@ #!/usr/bin/env python2 # -*- coding: UTF-8 -*- # File: render.py -# Date: Sun Jan 11 23:43:03 2015 +0800 +# Date: Sun Jan 11 23:46:06 2015 +0800 # Author: Yuxin Wu import os @@ -154,6 +154,7 @@ class HTMLRender(object): def _render_partial_msgs(self, msgs): """ return single html""" + self.smiley.used_smiley_id.clear() slicer = MessageSlicerByTime() slices = slicer.slice(msgs) diff --git a/lib/static/gen_smiley_css.py b/lib/static/gen_smiley_css.py deleted file mode 100755 index 38789f2..0000000 --- a/lib/static/gen_smiley_css.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python2 -# -*- coding: UTF-8 -*- -# File: gen_smiley_css.py -# Date: Wed Dec 24 22:20:08 2014 +0800 -# Author: Yuxin Wu - -import os -import glob -import base64 - -DIR_PATH = os.path.dirname(os.path.abspath(__file__)) -OUTPUT_FILE = os.path.join(DIR_PATH, 'smiley.css') - -HEAD = """.smiley { - padding: 1px; - background-position: -1px -1px; - background-repeat: no-repeat; - width: 20px; - height: 20px; - display: inline-block; - vertical-align: top; - zoom: 1; -} -""" - -TEMPLATE = """.smiley{name} {{ - background-image: url("data:image/png;base64,{b64}"); -}}""" - -def get_file_b64(fname): - data = open(fname, 'rb').read() - return base64.b64encode(data) - -with open(OUTPUT_FILE, 'w') as f: - print >> f, HEAD - for fname in glob.glob(os.path.join(DIR_PATH, 'smileys', '*.png')): - b64 = get_file_b64(fname) - basename = os.path.basename(fname) - smileyname = basename[:-4] - print >> f, TEMPLATE.format(name=smileyname, b64=b64);