/// <summary> /// Gets the details of a specific video. /// </summary> public override async Task <GetVideoResponse> GetVideo(GetVideoRequest request, ServerCallContext context) { PreparedStatement preparedStatement = await _statementCache.GetOrAddAsync("SELECT * FROM videos WHERE videoid = ?"); RowSet rows = await _session.ExecuteAsync(preparedStatement.Bind(request.VideoId.ToGuid())).ConfigureAwait(false); Row row = rows.SingleOrDefault(); if (row == null) { var status = new Status(StatusCode.NotFound, $"Video with id {request.VideoId.Value} was not found"); throw new RpcException(status); } var response = new GetVideoResponse { VideoId = row.GetValue <Guid>("videoid").ToUuid(), UserId = row.GetValue <Guid>("userid").ToUuid(), Name = row.GetValue <string>("name"), Description = row.GetValue <string>("description"), Location = row.GetValue <string>("location"), LocationType = (VideoLocationType)row.GetValue <int>("location_type"), AddedDate = row.GetValue <DateTimeOffset>("added_date").ToTimestamp() }; var tags = row.GetValue <IEnumerable <string> >("tags"); if (tags != null) { response.Tags.Add(tags); } return(response); }
public async Task <GetVideoResponse> GetVideo(GetVideoRequest request) { var videoId = request.Id + ".mp4"; var file = _storageManager.GetFile(videoId, _containerName).Result; if (file != null) { var videoFile = new byte[file.Properties.Length]; for (int k = 0; k < file.Properties.Length; k++) { videoFile[k] = 0x20; } await file.DownloadToByteArrayAsync(videoFile, 0); GetVideoResponse response = new GetVideoResponse { File = videoFile }; return(response); } //else cloudBlockBlob does not exist return(null); }
public static GetVideoResponse Unmarshall(UnmarshallerContext _ctx) { GetVideoResponse getVideoResponse = new GetVideoResponse(); getVideoResponse.HttpResponse = _ctx.HttpResponse; getVideoResponse.RequestId = _ctx.StringValue("GetVideo.RequestId"); getVideoResponse.SetId = _ctx.StringValue("GetVideo.SetId"); getVideoResponse.VideoUri = _ctx.StringValue("GetVideo.VideoUri"); getVideoResponse.RemarksA = _ctx.StringValue("GetVideo.RemarksA"); getVideoResponse.RemarksB = _ctx.StringValue("GetVideo.RemarksB"); getVideoResponse.CreateTime = _ctx.StringValue("GetVideo.CreateTime"); getVideoResponse.ModifyTime = _ctx.StringValue("GetVideo.ModifyTime"); getVideoResponse.VideoWidth = _ctx.IntegerValue("GetVideo.VideoWidth"); getVideoResponse.VideoHeight = _ctx.IntegerValue("GetVideo.VideoHeight"); getVideoResponse.VideoFormat = _ctx.StringValue("GetVideo.VideoFormat"); getVideoResponse.VideoDuration = _ctx.FloatValue("GetVideo.VideoDuration"); getVideoResponse.FileSize = _ctx.IntegerValue("GetVideo.FileSize"); getVideoResponse.VideoFrames = _ctx.IntegerValue("GetVideo.VideoFrames"); getVideoResponse.SourceType = _ctx.StringValue("GetVideo.SourceType"); getVideoResponse.SourceUri = _ctx.StringValue("GetVideo.SourceUri"); getVideoResponse.SourcePosition = _ctx.StringValue("GetVideo.SourcePosition"); getVideoResponse.ProcessStatus = _ctx.StringValue("GetVideo.ProcessStatus"); getVideoResponse.ProcessModifyTime = _ctx.StringValue("GetVideo.ProcessModifyTime"); getVideoResponse.VideoTagsStatus = _ctx.StringValue("GetVideo.VideoTagsStatus"); getVideoResponse.VideoTagsModifyTime = _ctx.StringValue("GetVideo.VideoTagsModifyTime"); getVideoResponse.CelebrityStatus = _ctx.StringValue("GetVideo.CelebrityStatus"); getVideoResponse.CelebrityModifyTime = _ctx.StringValue("GetVideo.CelebrityModifyTime"); getVideoResponse.ProcessFailReason = _ctx.StringValue("GetVideo.ProcessFailReason"); getVideoResponse.VideoTagsFailReason = _ctx.StringValue("GetVideo.VideoTagsFailReason"); getVideoResponse.CelebrityFailReason = _ctx.StringValue("GetVideo.CelebrityFailReason"); getVideoResponse.RemarksC = _ctx.StringValue("GetVideo.RemarksC"); getVideoResponse.RemarksD = _ctx.StringValue("GetVideo.RemarksD"); getVideoResponse.ExternalId = _ctx.StringValue("GetVideo.ExternalId"); getVideoResponse.VideoFacesStatus = _ctx.StringValue("GetVideo.VideoFacesStatus"); getVideoResponse.VideoFacesFailReason = _ctx.StringValue("GetVideo.VideoFacesFailReason"); getVideoResponse.VideoFacesModifyTime = _ctx.StringValue("GetVideo.VideoFacesModifyTime"); getVideoResponse.VideoFrameTagsStatus = _ctx.StringValue("GetVideo.VideoFrameTagsStatus"); getVideoResponse.VideoFrameTagsFailReason = _ctx.StringValue("GetVideo.VideoFrameTagsFailReason"); getVideoResponse.VideoFrameTagsModifyTime = _ctx.StringValue("GetVideo.VideoFrameTagsModifyTime"); getVideoResponse.VideoSTTStatus = _ctx.StringValue("GetVideo.VideoSTTStatus"); getVideoResponse.VideoSTTFailReason = _ctx.StringValue("GetVideo.VideoSTTFailReason"); getVideoResponse.VideoSTTModifyTime = _ctx.StringValue("GetVideo.VideoSTTModifyTime"); getVideoResponse.VideoOCRStatus = _ctx.StringValue("GetVideo.VideoOCRStatus"); getVideoResponse.VideoOCRFailReason = _ctx.StringValue("GetVideo.VideoOCRFailReason"); getVideoResponse.VideoOCRModifyTime = _ctx.StringValue("GetVideo.VideoOCRModifyTime"); getVideoResponse.VideoInfo = _ctx.StringValue("GetVideo.VideoInfo"); List <GetVideoResponse.GetVideo_CelebrityItem> getVideoResponse_celebrity = new List <GetVideoResponse.GetVideo_CelebrityItem>(); for (int i = 0; i < _ctx.Length("GetVideo.Celebrity.Length"); i++) { GetVideoResponse.GetVideo_CelebrityItem celebrityItem = new GetVideoResponse.GetVideo_CelebrityItem(); celebrityItem.CelebrityName = _ctx.StringValue("GetVideo.Celebrity[" + i + "].CelebrityName"); celebrityItem.CelebrityNum = _ctx.IntegerValue("GetVideo.Celebrity[" + i + "].CelebrityNum"); celebrityItem.CelebrityLibraryName = _ctx.StringValue("GetVideo.Celebrity[" + i + "].CelebrityLibraryName"); getVideoResponse_celebrity.Add(celebrityItem); } getVideoResponse.Celebrity = getVideoResponse_celebrity; List <GetVideoResponse.GetVideo_VideoTagsItem> getVideoResponse_videoTags = new List <GetVideoResponse.GetVideo_VideoTagsItem>(); for (int i = 0; i < _ctx.Length("GetVideo.VideoTags.Length"); i++) { GetVideoResponse.GetVideo_VideoTagsItem videoTagsItem = new GetVideoResponse.GetVideo_VideoTagsItem(); videoTagsItem.TagName = _ctx.StringValue("GetVideo.VideoTags[" + i + "].TagName"); videoTagsItem.ParentTagName = _ctx.StringValue("GetVideo.VideoTags[" + i + "].ParentTagName"); videoTagsItem.TagConfidence = _ctx.FloatValue("GetVideo.VideoTags[" + i + "].TagConfidence"); videoTagsItem.TagLevel = _ctx.IntegerValue("GetVideo.VideoTags[" + i + "].TagLevel"); getVideoResponse_videoTags.Add(videoTagsItem); } getVideoResponse.VideoTags = getVideoResponse_videoTags; List <GetVideoResponse.GetVideo_PersonsItem> getVideoResponse_persons = new List <GetVideoResponse.GetVideo_PersonsItem>(); for (int i = 0; i < _ctx.Length("GetVideo.Persons.Length"); i++) { GetVideoResponse.GetVideo_PersonsItem personsItem = new GetVideoResponse.GetVideo_PersonsItem(); personsItem.PersonId = _ctx.StringValue("GetVideo.Persons[" + i + "].PersonId"); personsItem.Age = _ctx.IntegerValue("GetVideo.Persons[" + i + "].Age"); personsItem.AgeConfidence = _ctx.FloatValue("GetVideo.Persons[" + i + "].AgeConfidence"); personsItem.Gender = _ctx.StringValue("GetVideo.Persons[" + i + "].Gender"); personsItem.GenderConfidence = _ctx.FloatValue("GetVideo.Persons[" + i + "].GenderConfidence"); getVideoResponse_persons.Add(personsItem); } getVideoResponse.Persons = getVideoResponse_persons; return(getVideoResponse); }
public static GetVideoResponse Unmarshall(UnmarshallerContext context) { GetVideoResponse getVideoResponse = new GetVideoResponse(); getVideoResponse.HttpResponse = context.HttpResponse; getVideoResponse.RequestId = context.StringValue("GetVideo.RequestId"); getVideoResponse.SetId = context.StringValue("GetVideo.SetId"); getVideoResponse.VideoUri = context.StringValue("GetVideo.VideoUri"); getVideoResponse.RemarksA = context.StringValue("GetVideo.RemarksA"); getVideoResponse.RemarksB = context.StringValue("GetVideo.RemarksB"); getVideoResponse.CreateTime = context.StringValue("GetVideo.CreateTime"); getVideoResponse.ModifyTime = context.StringValue("GetVideo.ModifyTime"); getVideoResponse.VideoWidth = context.IntegerValue("GetVideo.VideoWidth"); getVideoResponse.VideoHeight = context.IntegerValue("GetVideo.VideoHeight"); getVideoResponse.VideoFormat = context.StringValue("GetVideo.VideoFormat"); getVideoResponse.VideoDuration = context.FloatValue("GetVideo.VideoDuration"); getVideoResponse.FileSize = context.IntegerValue("GetVideo.FileSize"); getVideoResponse.VideoFrames = context.IntegerValue("GetVideo.VideoFrames"); getVideoResponse.SourceType = context.StringValue("GetVideo.SourceType"); getVideoResponse.SourceUri = context.StringValue("GetVideo.SourceUri"); getVideoResponse.SourcePosition = context.StringValue("GetVideo.SourcePosition"); getVideoResponse.ProcessStatus = context.StringValue("GetVideo.ProcessStatus"); getVideoResponse.ProcessModifyTime = context.StringValue("GetVideo.ProcessModifyTime"); getVideoResponse.VideoTagsStatus = context.StringValue("GetVideo.VideoTagsStatus"); getVideoResponse.VideoTagsModifyTime = context.StringValue("GetVideo.VideoTagsModifyTime"); getVideoResponse.CelebrityStatus = context.StringValue("GetVideo.CelebrityStatus"); getVideoResponse.CelebrityModifyTime = context.StringValue("GetVideo.CelebrityModifyTime"); getVideoResponse.ProcessFailReason = context.StringValue("GetVideo.ProcessFailReason"); getVideoResponse.VideoTagsFailReason = context.StringValue("GetVideo.VideoTagsFailReason"); getVideoResponse.CelebrityFailReason = context.StringValue("GetVideo.CelebrityFailReason"); List <GetVideoResponse.GetVideo_CelebrityItem> getVideoResponse_celebrity = new List <GetVideoResponse.GetVideo_CelebrityItem>(); for (int i = 0; i < context.Length("GetVideo.Celebrity.Length"); i++) { GetVideoResponse.GetVideo_CelebrityItem celebrityItem = new GetVideoResponse.GetVideo_CelebrityItem(); celebrityItem.CelebrityName = context.StringValue("GetVideo.Celebrity[" + i + "].CelebrityName"); celebrityItem.CelebrityNum = context.IntegerValue("GetVideo.Celebrity[" + i + "].CelebrityNum"); celebrityItem.CelebrityLibraryName = context.StringValue("GetVideo.Celebrity[" + i + "].CelebrityLibraryName"); getVideoResponse_celebrity.Add(celebrityItem); } getVideoResponse.Celebrity = getVideoResponse_celebrity; List <GetVideoResponse.GetVideo_VideoTagsItem> getVideoResponse_videoTags = new List <GetVideoResponse.GetVideo_VideoTagsItem>(); for (int i = 0; i < context.Length("GetVideo.VideoTags.Length"); i++) { GetVideoResponse.GetVideo_VideoTagsItem videoTagsItem = new GetVideoResponse.GetVideo_VideoTagsItem(); videoTagsItem.VideoTagName = context.StringValue("GetVideo.VideoTags[" + i + "].VideoTagName"); videoTagsItem.VideoTagEnName = context.StringValue("GetVideo.VideoTags[" + i + "].VideoTagEnName"); videoTagsItem.VideoTagConfidence = context.FloatValue("GetVideo.VideoTags[" + i + "].VideoTagConfidence"); getVideoResponse_videoTags.Add(videoTagsItem); } getVideoResponse.VideoTags = getVideoResponse_videoTags; List <GetVideoResponse.GetVideo_PersonsItem> getVideoResponse_persons = new List <GetVideoResponse.GetVideo_PersonsItem>(); for (int i = 0; i < context.Length("GetVideo.Persons.Length"); i++) { GetVideoResponse.GetVideo_PersonsItem personsItem = new GetVideoResponse.GetVideo_PersonsItem(); personsItem.PersonId = context.StringValue("GetVideo.Persons[" + i + "].PersonId"); personsItem.Age = context.IntegerValue("GetVideo.Persons[" + i + "].Age"); personsItem.AgeConfidence = context.FloatValue("GetVideo.Persons[" + i + "].AgeConfidence"); personsItem.Gender = context.StringValue("GetVideo.Persons[" + i + "].Gender"); personsItem.GenderConfidence = context.FloatValue("GetVideo.Persons[" + i + "].GenderConfidence"); getVideoResponse_persons.Add(personsItem); } getVideoResponse.Persons = getVideoResponse_persons; return(getVideoResponse); }