add screenshots

This commit is contained in:
ppwwyyxx
2015-01-09 11:57:12 +08:00
parent c2c9de8fcb
commit cddca228b0
2 changed files with 3 additions and 2 deletions
+3 -2
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env python2 #!/usr/bin/env python2
# -*- coding: UTF-8 -*- # -*- coding: UTF-8 -*-
# File: res.py # File: res.py
# Date: Thu Jan 08 00:52:13 2015 +0800 # Date: Fri Jan 09 11:52:53 2015 +0800
# Author: Yuxin Wu <[email protected]> # Author: Yuxin Wu <[email protected]>
import glob import glob
@@ -31,6 +31,7 @@ JPEG_QUALITY = 50
def do_get_voice_mp3(amr_fpath): def do_get_voice_mp3(amr_fpath):
""" return base64 string, and voice duration""" """ return base64 string, and voice duration"""
assert amr_fpath.endswith('.amr') assert amr_fpath.endswith('.amr')
assert os.path.isfile(amr_fpath), amr_fpath
mp3_file = os.path.join('/tmp', mp3_file = os.path.join('/tmp',
os.path.basename(amr_fpath)[:-4] + '.mp3') os.path.basename(amr_fpath)[:-4] + '.mp3')
@@ -75,7 +76,7 @@ class Resource(object):
@timing(total=True) @timing(total=True)
def get_voice_mp3(self, imgpath): def get_voice_mp3(self, imgpath):
idx = self.voice_cache_idx.get(imgpath) idx = self.voice_cache_idx.get(imgpath)
if not idx: if idx is None:
return do_get_voice_mp3(self.speak_data[imgpath]) return do_get_voice_mp3(self.speak_data[imgpath])
return self.voice_cache[idx].get() return self.voice_cache[idx].get()
Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB