Skip to content
This repository has been archived by the owner on Mar 4, 2023. It is now read-only.

Commit

Permalink
Fixed redownloading already downloaded album art
Browse files Browse the repository at this point in the history
Fixes #50 which can be caused by apps not caching info they send to the plugin like the extension does.
  • Loading branch information
tjhrulz committed May 8, 2021
1 parent 08e2506 commit 905303b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion WebNowPlaying.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public MusicInfo()
Album = "";
Cover = "";
CoverWebAddress = "";
CoverWebAddressInternal = "";
CoverByteArr = new byte[0];
Duration = "0:00";
DurationSec = 0;
Expand Down Expand Up @@ -75,7 +76,11 @@ public string Title
public string Artist { get; set; }
public string Album { get; set; }
public string Cover { get; set; }
//Updated when album art is downloaded so a skin can do an on change
public string CoverWebAddress { get; set; }
//Updated when a thread is spawned to download the artwork, this is not exposed to rainmeter
public string CoverWebAddressInternal { get; set; }

public byte[] CoverByteArr { get; set; }
public string Duration { get; set; }
public int DurationSec { get; set; }
Expand Down Expand Up @@ -190,8 +195,9 @@ protected override void OnMessage(MessageEventArgs arg)
}
else if (type.ToUpper() == InfoTypes.Cover.ToString().ToUpper())
{
if (info.Length > 0)
if (info.Length > 0 && !info.Equals(currMusicInfo.CoverWebAddressInternal))
{
currMusicInfo.CoverWebAddressInternal = info;
Thread imageDownload = new Thread(() => GetImageFromUrl(this.ID, info));
imageDownload.Start();
}
Expand Down

0 comments on commit 905303b

Please sign in to comment.