public bool OperatorEqualsTest(long _start, long _end, long _start2, long _end2) { VideoSection section = new VideoSection(_start, _end); VideoSection section2 = new VideoSection(_start2, _end2); return(section == section2); }
public DroneConfiguration() { General = new GeneralSection(); Control = new ControlSection(); Network = new NetworkSection(); Pic = new PicSection(); Video = new VideoSection(); Leds = new LedsSection(); Detect = new DetectSection(); Syslog = new SyslogSection(); Userbox = new UserboxSection(); Gps = new GpsSection(); Custom = new CustomSection(); _items = GetItems(General) .Concat(GetItems(Control)) .Concat(GetItems(Network)) .Concat(GetItems(Pic)) .Concat(GetItems(Video)) .Concat(GetItems(Leds)) .Concat(GetItems(Detect)) .Concat(GetItems(Syslog)) .Concat(GetItems(Userbox)) .Concat(GetItems(Gps)) .Concat(GetItems(Custom)) .ToDictionary(x => x.Key); }
public bool ContainsSectionTest(long _start, long _end, long _start2, long _end2) { VideoSection section = new VideoSection(_start, _end); VideoSection section2 = new VideoSection(_start2, _end2); return(section.Contains(section2)); }
public bool OperatorLessThanTest(long _start, long _end, long _start2, long _end2) { VideoSection section = new VideoSection(_start, _end); VideoSection section2 = new VideoSection(_start2, _end2); return(section < section2); }
public void UpdateCacheSegmentMarker(VideoSection cacheSegment) { if (!cacheSegment.IsEmpty && prebufferDisplay) { this.cacheSegment = cacheSegment; UpdateCacheSegmentMarkerPosition(); } }
public bool QueryMatch(VideoSection section, string[] tags, string[] keywords) { bool result = true; if (section != this.Section || !this.ParamsEqual(this.tags, tags) || !this.ParamsEqual(this.keywords, keywords)) { result = false; } return(result); }
public QueryData(VideoSection section, string[] tags, string[] keywords, VideoDataManager.DataListQueryCompleteDelegate callback) { this.tags = tags; this.keywords = keywords; this.callbacks = new List <VideoDataManager.DataListQueryCompleteDelegate>(); this.callbacks.Add(callback); this.Active = true; this.allResults = new List <KeyValuePair <List <string>, bool> >(); this.Section = section; }
public override OpenVideoResult Open(string filePath) { OpenVideoResult res = InstanciateGenerator(filePath); if (res != OpenVideoResult.Success) { return(res); } SetupVideoInfo(filePath); workingZone = new VideoSection(0, videoInfo.DurationTimeStamps); return(res); }
public async Task <IActionResult> CreateVideoSection(VideoSectionViewModel model) { if (this.ModelState.IsValid) { var videoSection = new VideoSection() { VideoUrl = model.VideoUrl, Position = model.Position, Name = model.Name, Description = model.Description, LessonId = model.LessonId }; context.Add(videoSection); await context.SaveChangesAsync(); } return(this.RedirectToAction("Details", "Lessons", new { id = model.LessonId })); }
public DroneConfiguration() { _items = new Dictionary <string, string>(); _changes = new Queue <KeyValuePair <string, string> >(); DroneHostname = "192.168.1.1"; General = new GeneralSection(this); Control = new ControlSection(this); Network = new NetworkSection(this); Pic = new PicSection(this); Video = new VideoSection(this); Leds = new LedsSection(this); Detect = new DetectSection(this); Syslog = new SyslogSection(this); Userbox = new UserboxSection(this); Gps = new GpsSection(this); Custom = new CustomSection(this); }
public static void HandlePostMediaToThread(string mediaUrl, ButtonTypeEnum mediaType, string caption = null) { if (MainPageViewModel.CurrentInstance == null) { return; } Section section = null; switch (mediaType) { case ButtonTypeEnum.GetImage: section = new ImageSection { Url = mediaUrl, Caption = caption }; break; case ButtonTypeEnum.GetAudio: section = new AudioSection { Url = mediaUrl, Caption = caption }; break; case ButtonTypeEnum.GetVideo: section = new VideoSection { Url = mediaUrl }; break; default: return; } MainPageViewModel.CurrentInstance.AddOutgoingSection(section); }
public override OpenVideoResult Open(string filePath) { this.filePath = filePath; this.video = SyntheticVideoSerializer.Deserialize(filePath); if (video == null) { return(OpenVideoResult.NotSupported); } OpenVideoResult res = InstanciateGenerator(video); if (res != OpenVideoResult.Success) { return(res); } SetupVideoInfo(); workingZone = new VideoSection(0, videoInfo.DurationTimeStamps - videoInfo.AverageTimeStampsPerFrame); return(res); }
public override void UpdateWorkingZone(VideoSection newZone, bool forceReload, int maxMemory, Action <DoWorkEventHandler> workerFn) { workingZone = newZone; }
private static Section GetSection(BsonDocument sectionBsonDocument) { Random rnd = new Random(); Section sectObj; string sectionType = sectionBsonDocument.GetValue("SectionType")?.ToString(); Debug.WriteLine("Section Type:" + sectionType); switch (sectionType?.ToLower()) { case "image": ImageSection imgSectObj = BsonSerializer.Deserialize <ImageSection>(sectionBsonDocument); Content imgContent = Contents.GetFor(imgSectObj); if (imgContent != null) { imgSectObj.Title = imgContent.Title; imgSectObj.Caption = imgContent.Caption; } sectObj = imgSectObj; break; case "text": TextSection textSectObj = BsonSerializer.Deserialize <TextSection>(sectionBsonDocument); Content textContent = Contents.GetFor(textSectObj); if (textContent != null) { textSectObj.Text = textContent.SectionText; } sectObj = textSectObj; break; case "graph": GraphSection gphObj = BsonSerializer.Deserialize <GraphSection>(sectionBsonDocument); Content docContent = Contents.GetFor(gphObj); if (docContent != null) { gphObj.Caption = docContent.Caption; gphObj.X.Label = docContent.XLabel; gphObj.Y.Label = docContent.YLabel; } gphObj.CoordinatesSet = new List <Coordinates>(); BsonArray coordinateSetBsonArray = sectionBsonDocument.GetValue("CoordinatesSet").AsBsonArray; if (coordinateSetBsonArray != null) { foreach (BsonDocument coordinateSetBsonDoc in coordinateSetBsonArray) { var coordinateListId = coordinateSetBsonDoc.GetValue("CoordinateListId")?.ToString(); if (!string.IsNullOrWhiteSpace(coordinateListId)) { continue; } var coordinatesObj = new Coordinates() { CoordinateListId = coordinateListId }; var coordinateContent = Contents.GetFor(coordinatesObj); coordinatesObj.LegendName = coordinateContent?.CoordinateListLegend; if (coordinateSetBsonDoc.TryGetValue("CoordinateList", out BsonValue tempCoordinateList)) { BsonArray coordinateListBsonArray = tempCoordinateList?.AsBsonArray; if (coordinateListBsonArray != null) { foreach (BsonDocument coordinateBsonDoc in coordinateListBsonArray) { string x = coordinateBsonDoc.GetValue("X")?.AsString; string y = coordinateBsonDoc.GetValue("Y")?.AsString; string coordinateText = coordinateContent?.CoordinateText; if (string.IsNullOrWhiteSpace(coordinateText)) { coordinatesObj.AddXYCoordinates(x, y); } else { coordinatesObj.AddXYCoordinates(x, y, coordinateText); } Debug.WriteLine(coordinatesObj.ToJson()); } } } gphObj.CoordinatesSet.Add(coordinatesObj); } } sectObj = gphObj; break; case "gif": GifSection gifObj = BsonSerializer.Deserialize <GifSection>(sectionBsonDocument); Content gifContent = Contents.GetFor(gifObj); if (gifContent != null) { gifObj.Title = gifContent.Title; gifObj.Caption = gifContent.Caption; } sectObj = gifObj; break; case "audio": AudioSection audioObj = BsonSerializer.Deserialize <AudioSection>(sectionBsonDocument); Content audioContent = Contents.GetFor(audioObj); if (audioContent != null) { audioObj.Title = audioContent.Title; audioObj.Caption = audioContent.Caption; } sectObj = audioObj; break; case "video": VideoSection videoObj = BsonSerializer.Deserialize <VideoSection>(sectionBsonDocument); Content videoContent = Contents.GetFor(videoObj); if (videoContent != null) { videoObj.Title = videoContent.Title; videoObj.Caption = videoContent.Caption; } sectObj = videoObj; break; case "link": UrlSection urlObj = BsonSerializer.Deserialize <UrlSection>(sectionBsonDocument); sectObj = urlObj; break; case "embeddedhtml": EmbeddedHtmlSection embeddedHtmlObj = BsonSerializer.Deserialize <EmbeddedHtmlSection>(sectionBsonDocument); Content embeddedHtmlContent = Contents.GetFor(embeddedHtmlObj); if (embeddedHtmlContent != null) { embeddedHtmlObj.Title = embeddedHtmlContent.Title; embeddedHtmlObj.Caption = embeddedHtmlContent.Caption; } sectObj = embeddedHtmlObj; break; default: sectObj = null; break; } return(sectObj); }
public void SearchSubCategories(VideoSection section, string[] tags, string[] keywords, VideoDataManager.DataListQueryCompleteDelegate onQueryComplete) { string environmentTag = this.GetEnvironmentTag(); if (!string.IsNullOrEmpty(environmentTag) && Array.IndexOf <string>(tags, environmentTag) < 0) { string[] array = new string[tags.Length + 1]; Array.Copy(tags, array, tags.Length); array[tags.Length] = environmentTag; tags = array; } if (tags.Length == 0 && keywords.Length == 0) { this.GetFeed(onQueryComplete); return; } if (this.activeQuery != null && !this.activeQuery.QueryMatch(section, tags, keywords)) { this.activeQuery.Active = false; } if (this.activeQuery != null && this.activeQuery.Active) { this.activeQuery.AddCallback(onQueryComplete); return; } this.activeQuery = new QueryData(section, tags, keywords, onQueryComplete); for (int i = 0; i < tags.Length; i++) { List <string> list; this.Tags.TryGetValue(tags[i], out list); if (list == null) { Service.Get <Engine>().StartCoroutine(this.Query(this.urlBuilder.Tag(tags[i]), new VideoDataManager.QueryCompleteDelegate(this.ParseTagWithQuery), this.activeQuery, tags[i])); } else { this.activeQuery.AddResult(new List <string>(list), false); this.activeQuery.FilterResults(); } } if (keywords.Length != 0) { string text = string.Join(" ", keywords); List <string> list2; this.Keywords.TryGetValue(text, out list2); if (list2 == null) { Service.Get <Engine>().StartCoroutine(this.Query(this.urlBuilder.Search(text, true, -1, -1), new VideoDataManager.QueryCompleteDelegate(this.ParseKeywords), this.activeQuery, text)); } else { this.activeQuery.AddResult(new List <string>(list2), false); this.activeQuery.FilterResults(); } } if (section == VideoSection.FEATURED) { this.GetFeaturedAll(new VideoDataManager.DataListQueryCompleteDelegate(this.OnCategoriesQueried)); return; } if (keywords.Length == 0) { this.GetFeed(new VideoDataManager.DataListQueryCompleteDelegate(this.OnCategoriesQueried)); } }
public bool ContainsValueTest(long _start, long _end, long _value) { VideoSection section = new VideoSection(_start, _end); return(section.Contains(_value)); }
public bool WrappedTest(long _start, long _end) { VideoSection section = new VideoSection(_start, _end); return(section.Wrapped); }
public bool EmptynessTest(long _start, long _end) { VideoSection section = new VideoSection(_start, _end); return(section.IsEmpty); }
/// <summary> /// 获取视频章节与剧集 /// </summary> /// <returns></returns> public List <VideoSection> GetVideoSections(bool noUgc = false) { if (bangumiSeason == null) { return(null); } List <VideoSection> videoSections = new List <VideoSection> { new VideoSection { Id = bangumiSeason.Positive.Id, Title = bangumiSeason.Positive.Title, IsSelected = true, VideoPages = GetVideoPages() } }; // 不需要其他季或花絮内容 if (noUgc) { return(videoSections); } if (bangumiSeason.Section == null) { return(null); } if (bangumiSeason.Section.Count == 0) { return(null); } foreach (BangumiSection section in bangumiSeason.Section) { List <VideoPage> pages = new List <VideoPage>(); int order = 0; foreach (BangumiEpisode episode in section.Episodes) { order++; // 标题 string name = episode.LongTitle != null && episode.LongTitle != "" ? $"{episode.Title} {episode.LongTitle}" : episode.Title; VideoPage page = new VideoPage { Avid = episode.Aid, Bvid = episode.Bvid, Cid = episode.Cid, EpisodeId = -1, FirstFrame = episode.Cover, Order = order, Name = name, Duration = "N/A" }; // UP主信息 if (bangumiSeason.UpInfo != null) { page.Owner = new Core.BiliApi.Models.VideoOwner { Name = bangumiSeason.UpInfo.Name, Face = bangumiSeason.UpInfo.Avatar, Mid = bangumiSeason.UpInfo.Mid, }; } else { page.Owner = new Core.BiliApi.Models.VideoOwner { Name = "", Face = "", Mid = -1, }; } // 文件命名中的时间格式 string timeFormat = SettingsManager.GetInstance().GetFileNamePartTimeFormat(); // 视频发布时间 DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 当地时区 DateTime dateTime = startTime.AddSeconds(episode.PubTime); page.PublishTime = dateTime.ToString(timeFormat); pages.Add(page); } VideoSection videoSection = new VideoSection { Id = section.Id, Title = section.Title, VideoPages = pages }; videoSections.Add(videoSection); } return(videoSections); }
/// <summary> /// 获取视频章节与剧集 /// </summary> /// <returns></returns> public List <VideoSection> GetVideoSections(bool noUgc = false) { if (videoView == null) { return(null); } List <VideoSection> videoSections = new List <VideoSection>(); // 不需要ugc内容 if (noUgc) { videoSections.Add(new VideoSection { Id = 0, Title = "default", IsSelected = true, VideoPages = GetVideoPages() }); return(videoSections); } if (videoView.UgcSeason == null) { return(null); } if (videoView.UgcSeason.Sections == null) { return(null); } if (videoView.UgcSeason.Sections.Count == 0) { return(null); } foreach (UgcSection section in videoView.UgcSeason.Sections) { List <ViewModels.PageViewModels.VideoPage> pages = new List <ViewModels.PageViewModels.VideoPage>(); int order = 0; foreach (var episode in section.Episodes) { order++; ViewModels.PageViewModels.VideoPage page = new ViewModels.PageViewModels.VideoPage { Avid = episode.Aid, Bvid = episode.Bvid, Cid = episode.Cid, EpisodeId = -1, FirstFrame = episode.Page.FirstFrame, Order = order, Name = episode.Title, Duration = "N/A" }; // UP主信息 page.Owner = videoView.Owner; if (page.Owner == null) { page.Owner = new Core.BiliApi.Models.VideoOwner { Name = "", Face = "", Mid = -1, }; } // 文件命名中的时间格式 string timeFormat = SettingsManager.GetInstance().GetFileNamePartTimeFormat(); // 视频发布时间 DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 当地时区 DateTime dateTime = startTime.AddSeconds(videoView.Pubdate); page.PublishTime = dateTime.ToString(timeFormat); // 这里的发布时间有问题, // 如果是合集,也会执行这里, // 但是发布时间是入口视频的,不是所有视频的 // TODO 修复 pages.Add(page); } VideoSection videoSection = new VideoSection { Id = section.Id, Title = section.Title, VideoPages = pages }; videoSections.Add(videoSection); } videoSections[0].IsSelected = true; return(videoSections); }
private static Section GetSection(BsonDocument sectionBsonDocument) { Section sectObj; string sectionType = sectionBsonDocument.GetValue("SectionType")?.ToString(); Debug.WriteLine("Section Type:" + sectionType); switch (sectionType?.ToLower()) { case "image": ImageSection imgSectObj = BsonSerializer.Deserialize <ImageSection>(sectionBsonDocument); Content imgContent = Contents.GetFor(imgSectObj); if (imgContent != null) { imgSectObj.Title = imgContent.Title; imgSectObj.Caption = imgContent.Caption; } sectObj = imgSectObj; break; case "text": TextSection textSectObj = BsonSerializer.Deserialize <TextSection>(sectionBsonDocument); Content textContent = Contents.GetFor(textSectObj); if (textContent != null) { textSectObj.Text = textContent.SectionText; if (textSectObj.DelayInMs == 0) { textSectObj.DelayInMs = Math.Min(Utils.Settings.MaxCapTimeTakenToType, textSectObj.Text.Length * (Utils.Settings.BaseTimeTakenToTypePerChar + rand.Next(0, Utils.Settings.VariableTimeTakenToTypePerChar))); } } sectObj = textSectObj; break; case "graph": { GraphSection gphObj = BsonSerializer.Deserialize <GraphSection>(sectionBsonDocument); Content docContent = Contents.GetFor(gphObj); if (docContent != null) { gphObj.Caption = docContent.Caption; gphObj.X.Label = docContent.XLabel; gphObj.Y.Label = docContent.YLabel; } gphObj.CoordinatesSet = new List <Coordinates>(); BsonArray coordinateSetBsonArray = sectionBsonDocument.GetValue("CoordinatesSet").AsBsonArray; if (coordinateSetBsonArray != null) { foreach (BsonDocument coordinateSetBsonDoc in coordinateSetBsonArray) { var coordinateListId = coordinateSetBsonDoc.GetValue("CoordinateListId")?.ToString(); if (!string.IsNullOrWhiteSpace(coordinateListId)) { continue; } var coordinatesObj = new Coordinates() { CoordinateListId = coordinateListId }; var coordinateContent = Contents.GetFor(coordinatesObj); coordinatesObj.LegendName = coordinateContent?.CoordinateListLegend; if (coordinateSetBsonDoc.TryGetValue("CoordinateList", out BsonValue tempCoordinateList)) { BsonArray coordinateListBsonArray = tempCoordinateList?.AsBsonArray; if (coordinateListBsonArray != null) { foreach (BsonDocument coordinateBsonDoc in coordinateListBsonArray) { string x = coordinateBsonDoc.GetValue("X")?.AsString; string y = coordinateBsonDoc.GetValue("Y")?.AsString; string coordinateText = coordinateContent?.CoordinateText; if (string.IsNullOrWhiteSpace(coordinateText)) { coordinatesObj.AddXYCoordinates(x, y); } else { coordinatesObj.AddXYCoordinates(x, y, coordinateText); } Debug.WriteLine(coordinatesObj.ToJson()); } } } gphObj.CoordinatesSet.Add(coordinatesObj); } } sectObj = gphObj; } break; case "gif": GifSection gifObj = BsonSerializer.Deserialize <GifSection>(sectionBsonDocument); Content gifContent = Contents.GetFor(gifObj); if (gifContent != null) { gifObj.Title = gifContent.Title; gifObj.Caption = gifContent.Caption; } sectObj = gifObj; break; case "audio": AudioSection audioObj = BsonSerializer.Deserialize <AudioSection>(sectionBsonDocument); Content audioContent = Contents.GetFor(audioObj); if (audioContent != null) { audioObj.Title = audioContent.Title; audioObj.Caption = audioContent.Caption; } sectObj = audioObj; break; case "video": VideoSection videoObj = BsonSerializer.Deserialize <VideoSection>(sectionBsonDocument); Content videoContent = Contents.GetFor(videoObj); if (videoContent != null) { videoObj.Title = videoContent.Title; videoObj.Caption = videoContent.Caption; } sectObj = videoObj; break; case "link": UrlSection urlObj = BsonSerializer.Deserialize <UrlSection>(sectionBsonDocument); sectObj = urlObj; break; case "embeddedhtml": EmbeddedHtmlSection embeddedHtmlObj = BsonSerializer.Deserialize <EmbeddedHtmlSection>(sectionBsonDocument); Content embeddedHtmlContent = Contents.GetFor(embeddedHtmlObj); if (embeddedHtmlContent != null) { embeddedHtmlObj.Title = embeddedHtmlContent.Title; embeddedHtmlObj.Caption = embeddedHtmlContent.Caption; } sectObj = embeddedHtmlObj; break; case "carousel": var carouselObj = BsonSerializer.Deserialize <CarouselSection>(sectionBsonDocument); var carContent = Contents.GetFor(carouselObj); if (carContent != null) { carouselObj.Title = carContent.Title; carouselObj.Caption = carContent.Caption; } if (carouselObj.Items != null) { foreach (var carItem in carouselObj.Items) { var content = Contents.GetFor(carItem); if (content != null) { carItem.Title = content.Title; carItem.Caption = content.Caption; } if (carItem.Buttons != null) { foreach (var carBtn in carItem.Buttons) { var carBtnContent = Contents.GetFor(carBtn); carBtn.Text = carBtnContent?.ButtonText; } } } } sectObj = carouselObj; break; case "printotp": PrintOTPSection printOTPSection = BsonSerializer.Deserialize <PrintOTPSection>(sectionBsonDocument); //No content to load for Section Type: PrintOTP sectObj = printOTPSection; break; default: sectObj = null; break; } return(sectObj); }