def artwork_download_img_to_file(self, artist, album, dest_filename, all_images=False): downloader = CoverDownloader(dest_filename, self.download_progress, all_images) self.downloading_image = True # Fetch covers from covers websites or such... cover_fetchers = pluginsystem.get('cover_fetching') for plugin, callback in cover_fetchers: logger.info("Looking for covers for %r from %r (using %s)", album, artist, plugin.name) try: callback(artist, album, downloader.on_save_callback, downloader.on_err_cb) except Exception as e: if logger.isEnabledFor(logging.DEBUG): log = logger.exception else: log = logger.warning log("Error while downloading covers from %s: %s", plugin.name, e) if downloader.found_images: break self.downloading_image = False return downloader.found_images
def fetch_lyrics_from_plugins(self, search_artist, search_title, song_dir): lyrics_fetchers = pluginsystem.get('lyrics_fetching') if lyrics_fetchers: self._show_lyrics(search_artist, search_title, lyrics=_("Fetching lyrics...")) for plugin, get_lyrics in lyrics_fetchers: try: lyrics = get_lyrics(search_artist, search_title) except Exception as e: if self.logger.isEnabledFor(logging.DEBUG): # Be more verbose if we want something verbose log = self.logger.exception else: log = self.logger.warning log("Plugin %s: unable to fetch lyrics (%s)", plugin.name, e) continue if lyrics: self.logger.info("Lyrics for %r - %r fetched by %r plugin.", search_artist, search_title, plugin.name) self.get_lyrics_response(search_artist, search_title, song_dir, lyrics=lyrics) return msg = _("Lyrics not found.") else: msg = _("No lyrics plug-in enabled.") self._show_lyrics(search_artist, search_title, lyrics=msg)
def fetch_lyrics(self, search_artist, search_title, song_dir): # Homogenize search patterns, so plugins don't have to do it. search_artist = str(search_artist).title() search_title = str(search_title).title() lyrics_fetchers = pluginsystem.get('lyrics_fetching') if lyrics_fetchers: self.logger.info("Looking for lyrics for %r - %r...", search_artist, search_title) self.communicate(search_artist, search_title, lyrics=_("Fetching lyrics...")) for plugin, get_lyrics in lyrics_fetchers: try: lyrics = get_lyrics(search_artist, search_title) except Exception as e: if self.logger.isEnabledFor(logging.DEBUG): # Be more verbose if we want something verbose log = self.logger.exception else: log = self.logger.warning log("Plugin %s: unable to fetch lyrics (%s)", plugin.name, e) continue if lyrics: self.logger.info( "Lyrics for %r - %r fetched by %r plugin.", search_artist, search_title, plugin.name) self.get_lyrics_response(search_artist, search_title, song_dir, lyrics=lyrics) return msg = _("Lyrics not found.") else: self.logger.info("Can't look for lyrics, no plugin enabled.") msg = _("No lyrics plug-in enabled.") self.communicate(search_artist, search_title, lyrics=msg)
def fetch_lyrics(self, search_artist, search_title, song_dir): # Homogenize search patterns, so plugins don't have to do it. search_artist = str(search_artist).title() search_title = str(search_title).title() lyrics_fetchers = pluginsystem.get('lyrics_fetching') if lyrics_fetchers: self.logger.info("Looking for lyrics for %r - %r...", search_artist, search_title) self.communicate(search_artist, search_title, lyrics=_("Fetching lyrics...")) for plugin, get_lyrics in lyrics_fetchers: try: lyrics = get_lyrics(search_artist, search_title) except Exception as e: if self.logger.isEnabledFor(logging.DEBUG): # Be more verbose if we want something verbose log = self.logger.exception else: log = self.logger.warning log("Plugin %s: unable to fetch lyrics (%s)", plugin.name, e) continue if lyrics: self.logger.info("Lyrics for %r - %r fetched by %r plugin.", search_artist, search_title, plugin.name) self.get_lyrics_response(search_artist, search_title, song_dir, lyrics=lyrics) return msg = _("Lyrics not found.") else: self.logger.info("Can't look for lyrics, no plugin enabled.") msg = _("No lyrics plug-in enabled.") self.communicate(search_artist, search_title, lyrics=msg)