First pass at sync working. Need to ignore for special cases

This commit is contained in:
watsonb8
2019-11-11 15:10:08 -05:00
parent 5f035e9bcb
commit 1acc383e90
14 changed files with 296 additions and 44 deletions

View File

@ -135,24 +135,5 @@ namespace Aurora.RemoteImpl
return Task.FromResult(mediaList);
}
public override async Task GetSongStream(SongRequest request,
Grpc.Core.IServerStreamWriter<Chunk> responseStream,
Grpc.Core.ServerCallContext context)
{
BaseMedia song = LibraryService.Instance.GetSong(request.Id);
await song.Load();
//Send stream
Console.WriteLine("Begin sending file");
byte[] buffer = new byte[2048]; // read in chunks of 2KB
int bytesRead;
while ((bytesRead = song.DataStream.Read(buffer, 0, buffer.Length)) > 0)
{
Google.Protobuf.ByteString bufferByteString = Google.Protobuf.ByteString.CopyFrom(buffer);
await responseStream.WriteAsync(new Chunk { Content = bufferByteString });
}
Console.WriteLine("Done sending file");
}
}
}