Implemented #56
This commit is contained in:
@@ -58,54 +58,17 @@ namespace Icarus.Controllers.Utilities
|
||||
|
||||
#region C++ Libs
|
||||
[DllImport("libicarus.so")]
|
||||
public static extern void retrieve_metadata(ref Sng sng, string file_path);
|
||||
public static extern void retrieve_metadata(ref Sng sng,
|
||||
string file_path);
|
||||
|
||||
[DllImport("libicarus.so")]
|
||||
public static extern void update_metadata(ref Sng sng_updated, ref Sng sng_old);
|
||||
public static extern void update_metadata(ref Sng sng_updated,
|
||||
ref Sng sng_old);
|
||||
|
||||
[DllImport("libicarus.so")]
|
||||
public static extern void update_cover_art(ref CovArt cov, string stock_cover_path, string song_path);
|
||||
public static extern void update_cover_art(ref CovArt cov,
|
||||
ref Sng sng, string root_cover_path);
|
||||
#endregion
|
||||
|
||||
// TODO: Remove this when the update_cover_art(..) has been implemented
|
||||
/**
|
||||
public byte[] RetrieveCoverArtBytes(Song song)
|
||||
{
|
||||
try
|
||||
{
|
||||
Console.WriteLine("Fetching image");
|
||||
var tag = TagLib.File.Create(song.SongPath);
|
||||
byte[] imgBytes = tag.Tag.Pictures[0].Data.Data;
|
||||
|
||||
return imgBytes;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var msg = ex.Message;
|
||||
_logger.Error(msg, "An error occurred in MetadataRetriever");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
*/
|
||||
|
||||
// TODO: Remove this when the update_cover_art(..) has been implemented
|
||||
public void UpdateCoverArt(Song song, CoverArt coverArt)
|
||||
{
|
||||
Console.WriteLine("Updating song's cover art");
|
||||
|
||||
var tag = TagLib.File.Create(song.SongPath);
|
||||
var pics = tag.Tag.Pictures;
|
||||
Array.Resize(ref pics, 1);
|
||||
|
||||
pics[0] = new Picture(coverArt.ImagePath)
|
||||
{
|
||||
Description = "Cover Art"
|
||||
};
|
||||
|
||||
tag.Tag.Pictures = pics;
|
||||
tag.Save();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user