mirror of
https://github.com/beetbox/beets.git
synced 2025-12-27 11:02:43 +01:00
langdetect conditional import
This commit is contained in:
parent
e03c3af91f
commit
58df77e2cb
1 changed files with 7 additions and 6 deletions
|
|
@ -27,7 +27,6 @@ import unicodedata
|
|||
import urllib
|
||||
import warnings
|
||||
from HTMLParser import HTMLParseError
|
||||
from langdetect import detect
|
||||
|
||||
from beets import plugins
|
||||
from beets import ui
|
||||
|
|
@ -673,12 +672,14 @@ class LyricsPlugin(plugins.BeetsPlugin):
|
|||
|
||||
if lyrics:
|
||||
self._log.info(u'fetched lyrics: {0}', item)
|
||||
lang_from = detect(lyrics)
|
||||
if self.config['bing_client_secret'].get() and \
|
||||
self.config['bing_lang_to'].get() != lang_from:
|
||||
if not self.config['bing_lang_from'] or (
|
||||
if self.config['bing_client_secret'].get():
|
||||
from langdetect import detect
|
||||
|
||||
lang_from = detect(lyrics)
|
||||
if self.config['bing_lang_to'].get() != lang_from and (
|
||||
not self.config['bing_lang_from'] or (
|
||||
lang_from in self.config[
|
||||
'bing_lang_from'].as_str_seq()):
|
||||
'bing_lang_from'].as_str_seq())):
|
||||
lyrics = self.append_translation(
|
||||
lyrics, self.config['bing_lang_to'])
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in a new issue