add encryption in todo

This commit is contained in:
ppwwyyxx
2015-04-19 17:32:54 +08:00
parent b80bbb39c2
commit 4a5cefbcd1
2 changed files with 21 additions and 13 deletions
+1
View File
@@ -55,6 +55,7 @@ Screenshots:
![byvoid](https://github.com/ppwwyyxx/wechat-dump/raw/master/screenshots/byvoid.jpg)
### TODO
+ (IMPORTANT) Audio file encryption method for latest version of wechat.
+ Export all messages to libchat, and render messages from libchat
+ Search by uid/username
+ Skip existing files when copying android resources
+20 -13
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env python2
# -*- coding: UTF-8 -*-
# File: res.py
# Date: Fri Mar 27 23:42:16 2015 +0800
# Date: Sun Apr 19 17:11:07 2015 +0800
# Author: Yuxin Wu <[email protected]>
import glob
@@ -33,20 +33,24 @@ JPEG_QUALITY = 50
def do_get_voice_mp3(amr_fpath):
""" return base64 string, and voice duration"""
if not amr_fpath: return "", 0
mp3_file = os.path.join('/tmp',
os.path.basename(amr_fpath)[:-4] + '.mp3')
try:
if not amr_fpath: return "", 0
mp3_file = os.path.join('/tmp',
os.path.basename(amr_fpath)[:-4] + '.mp3')
infile = pysox.CSoxStream(amr_fpath)
outfile = pysox.CSoxStream(mp3_file, 'w', infile.get_signal())
chain = pysox.CEffectsChain(infile, outfile)
chain.flow_effects()
outfile.close()
infile = pysox.CSoxStream(amr_fpath)
outfile = pysox.CSoxStream(mp3_file, 'w', infile.get_signal())
chain = pysox.CEffectsChain(infile, outfile)
chain.flow_effects()
outfile.close()
signal = infile.get_signal().get_signalinfo()
duration = signal['length'] * 1.0 / signal['rate']
mp3_string = get_file_b64(mp3_file)
os.unlink(mp3_file)
signal = infile.get_signal().get_signalinfo()
duration = signal['length'] * 1.0 / signal['rate']
mp3_string = get_file_b64(mp3_file)
os.unlink(mp3_file)
except:
logger.warn("Failed to prepare voice file. Wechat changed their protocol!")
return 'fail', 0.1
return mp3_string, duration
class Resource(object):
@@ -90,6 +94,9 @@ class Resource(object):
pool = Pool(3)
self.voice_cache = [pool.apply_async(do_get_voice_mp3,
(self.get_voice_filename(k),)) for k in voice_paths]
# single-threaded version, for debug
#self.voice_cache = map(do_get_voice_mp3,
#(self.get_voice_filename(k) for k in voice_paths))
def get_avatar(self, username):
""" return base64 string"""