from albumart import AlbumArt import generique from PIL import Image # Random generation of a band, album and keywords res = generique.generate(['band/keywords', 'band/album', 'band/base', '1'])[0] album_title = res.split('~~')[1].strip() band_name = res.split('~~')[2].strip() keywords = [] for a in res.split('~~')[0].split('~'): keywords.append(a.strip()) album = AlbumArt(band_name, album_title, keywords) cover = album.generate() album.emit()
def fetch_albumart(self, artist, album, size, request): try: request.finish(AlbumArt.get_image(artist, album, size), raw = True) except ValueError as e: request.finish(AlbumArt.get_standard_image(size), raw = True)
def API_getAlbumArt(self, uri, size = 0): try: track = self.create_track_from_uri(uri) return AlbumArt.get_image(track.artist, track.album, size) except ValueError: return AlbumArt.get_standard_image(size)