diff --git a/python/displayCoverArt.py b/python/displayCoverArt.py index 5b22f4c..a9455b7 100644 --- a/python/displayCoverArt.py +++ b/python/displayCoverArt.py @@ -43,15 +43,18 @@ default_image = os.path.join(dir, config['DEFAULT']['default_image']) print(default_image) matrix = RGBMatrix(options = options) + lastImageUrl = None try: while True: try: imageURL = getSongInfo(username, token_path)[1] - response = requests.get(imageURL) - image = Image.open(BytesIO(response.content)) - image.thumbnail((matrix.width, matrix.height), Image.ANTIALIAS) - matrix.SetImage(image.convert('RGB')) + if lastImageUrl != imageURL: + response = requests.get(imageURL) + image = Image.open(BytesIO(response.content)) + image.thumbnail((matrix.width, matrix.height), Image.ANTIALIAS) + matrix.SetImage(image.convert('RGB')) + lastImageUrl = imageURL time.sleep(1) except Exception as e: image = Image.open(default_image)