/// <summary>動画へアクセスするページを取得する</summary> /// <param name="Target">ターゲット動画</param> public VideoPage GetVideoPage(Video.VideoInfo Target) { if (Target.videoPage != null) { return(Target.videoPage); } else { return(Target.videoPage = new VideoPage(Target, this, context)); } }
/// <summary>マイリストから動画を削除するストリームを取得する</summary> /// <param name="RemoveItem">削除する動画</param> /// <param name="IsGetToken">トークンを取得するかどうか</param> public Streams <Mylist.MylistRemoveVideoResponse> OpenMylistRemoveVideStreams(Video.VideoInfo RemoveItem, bool IsGetToken = true) { var streamDataList = new List <StreamData>(); StreamData[] uploadStreamDatas = null; Mylist.MylistRemoveVideoResponse result = null; string threadID = ""; var getThreadID = host.GetVideoPage(RemoveItem).OpenThreadIDStreamData((data) => threadID = data); if (IsGetToken) { streamDataList.AddRange(host.GetToken()); } if (getThreadID != null) { streamDataList.Add(getThreadID); } if (target.ID == "")//とりあえずマイリスト { uploadStreamDatas = context.Client.OpenUploadStreams(ApiUrls.DeflistRemoveVideo, ContentType.Form).GetStreamDatas(); uploadStreamDatas[0].GetWriteData = () => { return(Encoding.UTF8.GetBytes(string.Format( PostTexts.DeflistRemoveVideo, string.Format(PostTexts.ArrayMylistItem, threadID), host.token))); }; } else { uploadStreamDatas = context.Client.OpenUploadStreams(ApiUrls.MylistRemoveVideo, ContentType.Form).GetStreamDatas(); uploadStreamDatas[0].GetWriteData = () => { return(Encoding.UTF8.GetBytes(string.Format( PostTexts.MylistRemoveVideo, target.ID, string.Format(PostTexts.ArrayMylistItem, threadID), host.token))); }; } uploadStreamDatas[1].SetReadData = (data) => { var serialize = new DataContractJsonSerializer(typeof(Serial.MylistRemoveVideo.Contract)); result = converter.ConvertMylistRemoveVideoResponse( (Serial.MylistRemoveVideo.Contract)serialize.ReadObject(new MemoryStream(data))); }; streamDataList.AddRange(uploadStreamDatas); return(new Streams <Mylist.MylistRemoveVideoResponse>( streamDataList.ToArray(), () => result)); }
/// <summary>マイリストから動画を削除する</summary> /// <param name="RemoveItem">削除する動画</param> /// <param name="IsGetToken">トークンを取得するかどうか</param> public Mylist.MylistRemoveVideoResponse MylistRemoveVideo(Video.VideoInfo RemoveItem, bool IsGetToken = true) { var streams = OpenMylistRemoveVideStreams(RemoveItem, IsGetToken); return(streams.Run(streams.UntreatedCount)); }