bug fixes

This commit is contained in:
St.Huang 2018-09-19 08:48:32 +08:00
parent f36cd8d1c2
commit 9db4ad1300
4 changed files with 8 additions and 4 deletions

View File

@ -81,7 +81,8 @@ class Bing(WebService):
return seg.get('BrE', u'') if seg else u''
def _fld_mp3(self, fld):
audio_url = self._get_field('pronunciation')[fld]
seg = self._get_field('pronunciation')
audio_url = seg[fld] if seg else u''
if bing_download_mp3 and audio_url:
filename = get_hex_name('bing', audio_url, 'mp3')
if os.path.exists(filename) or self.net_download(filename, audio_url):

View File

@ -40,7 +40,8 @@ class BingXtk(WebService):
return seg.get('BrE', u'') if seg else u''
def _fld_mp3(self, fld):
audio_url = self._get_field('pronunciation')[fld]
seg = self._get_field('pronunciation')
audio_url = seg[fld] if seg else u''
if bing_download_mp3 and audio_url:
filename = get_hex_name('bing', audio_url, 'mp3')
if os.path.exists(filename) or self.net_download(filename, audio_url):

View File

@ -81,7 +81,8 @@ class Bing(WebService):
return seg.get('BrE', u'') if seg else u''
def _fld_mp3(self, fld):
audio_url = self._get_field('pronunciation')[fld]
seg = self._get_field('pronunciation')
audio_url = seg[fld] if seg else u''
if bing_download_mp3 and audio_url:
filename = get_hex_name('bing', audio_url, 'mp3')
if os.path.exists(filename) or self.net_download(filename, audio_url):

View File

@ -40,7 +40,8 @@ class BingXtk(WebService):
return seg.get('BrE', u'') if seg else u''
def _fld_mp3(self, fld):
audio_url = self._get_field('pronunciation')[fld]
seg = self._get_field('pronunciation')
audio_url = seg[fld] if seg else u''
if bing_download_mp3 and audio_url:
filename = get_hex_name('bing', audio_url, 'mp3')
if os.path.exists(filename) or self.net_download(filename, audio_url):