def artwork_download_img_to_file(self, artist, album, dest_filename, all_images=False): self.downloading_image = True # Fetch covers from rhapsody.com etc. cover_fetchers = pluginsystem.get('cover_fetching') imgfound = False for _plugin, cb in cover_fetchers: ret = cb(self.download_progress, artist, album, dest_filename, all_images) if ret: imgfound = True break # XXX if all_images, merge results... self.downloading_image = False return imgfound
def get_lyrics_start(self, search_artist, search_title, filename_artist, filename_title, song_dir): filename_artist = misc.strip_all_slashes(filename_artist) filename_title = misc.strip_all_slashes(filename_title) filename = self._check_for_local_lyrics(filename_artist, filename_title, song_dir) lyrics = "" if filename: # If the lyrics only contain "not found", delete the file and try # to fetch new lyrics. If there is a bug in Sonata/SZI/LyricWiki # that prevents lyrics from being found, storing the "not found" # will prevent a future release from correctly fetching the lyrics. try: with open(filename, 'r') as f: lyrics = f.read() except IOError: pass if lyrics == _("Lyrics not found"): misc.remove_file(filename) filename = self._check_for_local_lyrics(filename_artist, filename_title, song_dir) if filename: # Re-use lyrics from file: try: with open(filename, 'r') as f: lyrics = f.read() except IOError: pass # Strip artist - title line from file if it exists, since we # now have that information visible elsewhere. header = "%s - %s\n\n" % (filename_artist, filename_title) if lyrics[:len(header)] == header: lyrics = lyrics[len(header):] self._show_lyrics(filename_artist, filename_title, lyrics=lyrics) else: # Fetch lyrics from lyricwiki.org etc. lyrics_fetchers = pluginsystem.get('lyrics_fetching') callback = lambda * args: self.get_lyrics_response( filename_artist, filename_title, song_dir, *args) if lyrics_fetchers: msg = _("Fetching lyrics...") for _plugin, cb in lyrics_fetchers: cb(callback, search_artist, search_title) else: msg = _("No lyrics plug-in enabled.") self._show_lyrics(filename_artist, filename_title, lyrics=msg)
def get_lyrics_start(self, search_artist, search_title, filename_artist, filename_title, song_dir): filename_artist = misc.strip_all_slashes(filename_artist) filename_title = misc.strip_all_slashes(filename_title) filename = self._check_for_local_lyrics(filename_artist, filename_title, song_dir) lyrics = '' if filename: # If the lyrics only contain "not found", delete the file and try to # fetch new lyrics. If there is a bug in Sonata/SZI/LyricWiki that # prevents lyrics from being found, storing the "not found" will # prevent a future release from correctly fetching the lyrics. try: with open(filename, 'r') as f: lyrics = f.read() except IOError: pass if lyrics == _('Lyrics not found'): misc.remove_file(filename) filename = self._check_for_local_lyrics( filename_artist, filename_title, song_dir) if filename: # Re-use lyrics from file: try: with open(filename, 'r') as f: lyrics = f.read() except IOError: pass # Strip artist - title line from file if it exists, since we # now have that information visible elsewhere. header = '%s - %s\n\n' % (filename_artist, filename_title) if lyrics[:len(header)] == header: lyrics = lyrics[len(header):] self._show_lyrics(filename_artist, filename_title, lyrics=lyrics) else: # Fetch lyrics from lyrics.wikia.org etc. lyrics_fetchers = pluginsystem.get('lyrics_fetching') callback = lambda *args: self.get_lyrics_response( filename_artist, filename_title, song_dir, *args) if lyrics_fetchers: msg = _('Fetching lyrics...') for _plugin, cb in lyrics_fetchers: cb(callback, search_artist, search_title) else: msg = _('No lyrics plug-in enabled.') self._show_lyrics(filename_artist, filename_title, lyrics=msg)