Add support for readpicture, aka embedded cover art
This commit is contained in:
parent
0ab1afc2f8
commit
4136c13d5b
@ -384,6 +384,7 @@ namespace unison
|
|||||||
List<byte> data = new List<byte>();
|
List<byte> data = new List<byte>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
bool ReadPictureFailed = true;
|
||||||
long totalBinarySize = 9999;
|
long totalBinarySize = 9999;
|
||||||
long currentSize = 0;
|
long currentSize = 0;
|
||||||
|
|
||||||
@ -392,6 +393,28 @@ namespace unison
|
|||||||
if (_connection == null)
|
if (_connection == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
IMpdMessage<MpdBinaryData> albumReq = await _connection.SendAsync(new ReadPictureCommand(path, currentSize));
|
||||||
|
if (!albumReq.IsResponseValid)
|
||||||
|
break;
|
||||||
|
|
||||||
|
MpdBinaryData response = albumReq.Response.Content;
|
||||||
|
if (response == null || response.Binary == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
ReadPictureFailed = false;
|
||||||
|
totalBinarySize = response.Size;
|
||||||
|
currentSize += response.Binary;
|
||||||
|
data.AddRange(response.Data);
|
||||||
|
}
|
||||||
|
while (currentSize < totalBinarySize && !token.IsCancellationRequested);
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (!ReadPictureFailed)
|
||||||
|
break;
|
||||||
|
if (_connection == null)
|
||||||
|
return;
|
||||||
|
|
||||||
IMpdMessage<MpdBinaryData> albumReq = await _connection.SendAsync(new AlbumArtCommand(path, currentSize));
|
IMpdMessage<MpdBinaryData> albumReq = await _connection.SendAsync(new AlbumArtCommand(path, currentSize));
|
||||||
if (!albumReq.IsResponseValid)
|
if (!albumReq.IsResponseValid)
|
||||||
break;
|
break;
|
||||||
@ -403,7 +426,8 @@ namespace unison
|
|||||||
totalBinarySize = response.Size;
|
totalBinarySize = response.Size;
|
||||||
currentSize += response.Binary;
|
currentSize += response.Binary;
|
||||||
data.AddRange(response.Data);
|
data.AddRange(response.Data);
|
||||||
} while (currentSize < totalBinarySize && !token.IsCancellationRequested);
|
}
|
||||||
|
while (currentSize < totalBinarySize && !token.IsCancellationRequested);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user