+
+ def get_alternatives (self, artist, album, no_alternatives):
+ """
+ return a list of paths of possible album arts
+ """
+ results_page = self.__msn_images (artist, album)
+ valid_images = []
+ for image_url in self.__get_url_from_msn_results_page (results_page):
+ image = self.__get_url (image_url)
+ if (image):
+ image_path = os.path.join (CACHE_LOCATION, "alternative-" + str(len(valid_images)))
+ self.__save_content_into_file (image, image_path)
+ valid_images.append (image_path)
+ if (len (valid_images) > no_alternatives):
+ return valid_images
+ return valid_images
+
+ def save_alternative (self, artist, album, path):
+ if (not os.path.exists (path)):
+ print "**** CRITICAL **** image in path", path, "doesn't exist!"
+
+ filename = getCoverArtFileName (album)
+ thumbnail = getCoverArtThumbFileName (album)
+
+ os.rename (path, filename)
+ if (not self.__request_thumbnail (filename)):
+ print "Something wrong creating the thumbnail!"
+
+