#94: Saving the file type of cover art, but there is still some work to do

The filename of cover art is hard coded to have the png extension. Need to correct this
This commit is contained in:
kdeng00
2024-06-20 20:20:47 -04:00
parent 562bc87822
commit 3dd143fa4d
7 changed files with 89 additions and 14 deletions
+20 -2
View File
@@ -10,11 +10,29 @@ public class CoverArt
[JsonProperty("title")]
public string SongTitle { get; set; }
[JsonIgnore]
public string ImagePath { get; set; }
public string Directory { get; set; }
[JsonProperty("filename")]
public string Filename { get; set; }
[JsonProperty("type")]
public string Type { get; set; }
#endregion
#region Methods
public string ImagePath()
{
var fullPath = this.Directory;
if (fullPath[fullPath.Length -1] != '/')
{
fullPath += "/";
}
fullPath += Filename;
return fullPath;
}
public string GenerateFilename(int flag)
{
int length = Constants.DirectoryPaths.FILENAME_LENGTH;
@@ -27,6 +45,6 @@ public class CoverArt
return (flag == 0) ? filename : $"{filename}{extension}";
}
public async Task<byte[]> GetData() => await File.ReadAllBytesAsync(this.ImagePath);
public async Task<byte[]> GetData() => await File.ReadAllBytesAsync(this.ImagePath());
#endregion
}