public virtual void OnNewPlayStop(Category category) { int diff; Time stopTime = new Time {MSeconds = (int)player.CurrentTime}; Log.Debug("New play stop time: " + stopTime); diff = stopTime.MSeconds - startTime.MSeconds; if(diff < 0) { guiToolkit.WarningMessage(Catalog.GetString("The stop time is smaller than the start time. "+ "The play will not be added.")); return; } if(diff < 500) { int correction = 500 - diff; if(startTime.MSeconds - correction > 0) startTime = startTime - correction; else stopTime = stopTime + correction; } AddNewPlay(startTime, stopTime, category); }
private void AddNewPlay(Time start, Time stop, Category category) { Image miniature; Log.Debug(String.Format("New play created start:{0} stop:{1} category:{2}", start, stop, category)); /* Get the current frame and get a thumbnail from it */ if(projectType == ProjectType.CaptureProject) { if(!capturer.Capturing) { guiToolkit.InfoMessage(Catalog.GetString("You can't create a new play if the capturer "+ "is not recording.")); return; } miniature = capturer.CurrentMiniatureFrame; } else if(projectType == ProjectType.FileProject) { miniature = player.CurrentMiniatureFrame; player.Pause(); } else miniature = null; /* Add the new created play to the project and update the GUI*/ var play = openedProject.AddPlay(category, start, stop,miniature); mainWindow.AddPlay(play); /* Tag subcategories of the new play */ LaunchPlayTagger(play); if (projectType == ProjectType.FileProject) { player.Play(); } }
private void ProcessNewTag(Category category,Time pos) { Time length, startTime, stopTime, start, stop, fStart, fStop; if(player == null || openedProject == null) return; /* Get the default lead and lag time for the category */ startTime = category.Start; stopTime = category.Stop; /* Calculate boundaries of the segment */ start = pos - startTime; stop = pos + stopTime; fStart = (start < new Time {MSeconds =0}) ? new Time {MSeconds = 0} : start; if(projectType == ProjectType.FakeCaptureProject || projectType == ProjectType.CaptureProject) { fStop = stop; } else { length = new Time {MSeconds = (int)player.StreamLength}; fStop = (stop > length) ? length: stop; } AddNewPlay(fStart, fStop, category); }
public virtual void OnNewTag(Category category) { Time pos; if(projectType == ProjectType.FakeCaptureProject || projectType == ProjectType.CaptureProject) { pos = new Time { MSeconds = (int)capturer.CurrentTime}; } else { pos = new Time {MSeconds = (int)player.CurrentTime}; } ProcessNewTag(category,pos); }
protected virtual void OnNewTagAtFrame(Category category, int frame) { Time pos = new Time { MSeconds = frame*1000/openedProject.Description.File.Fps}; player.CloseActualSegment(); player.SeekTo((long)pos.MSeconds, true); ProcessNewTag(category,pos); }
private void EmitNewTagAtFrame(Category category, int frame) { if (NewTagAtFrameEvent != null) NewTagAtFrameEvent(category, frame); }
private void EmitNewTagStop(Category category) { if (NewTagStopEvent != null) NewTagStopEvent (category); }
public List<Play> PlaysInCategory(Category category) { return timeline.Where(p => p.Category.UUID == category.UUID).ToList(); }
/// <summary> /// Delete a category /// </summary> /// <param name="sectionIndex"> /// A <see cref="System.Int32"/>: category index /// </param> public void RemoveCategory(Category category) { if(Categories.Count == 1) throw new Exception("You can't remove the last Category"); Categories.Remove(category); timeline.RemoveAll(p => p.Category.UUID == category.UUID); }
public void DeleteSubcategoryTags(Category cat, List<ISubCategory> subcategories) { foreach (var play in timeline.Where(p => p.Category == cat)) { foreach (var subcat in subcategories) { Log.Error(play.Name); if (subcat is TagSubCategory) play.Tags.RemoveBySubcategory(subcat); else if (subcat is TeamSubCategory) play.Teams.RemoveBySubcategory(subcat); else if (subcat is PlayerSubCategory) play.Players.RemoveBySubcategory(subcat); } } }
/// <summary> /// Adds a new play to a given category /// </summary> /// <param name="dataSection"> /// A <see cref="System.Int32"/>: category index /// </param> /// <param name="start"> /// A <see cref="Time"/>: start time of the play /// </param> /// <param name="stop"> /// A <see cref="Time"/>: stop time of the play /// </param> /// <param name="thumbnail"> /// A <see cref="Pixbuf"/>: snapshot of the play /// </param> /// <returns> /// A <see cref="MediaTimeNode"/>: created play /// </returns> public Play AddPlay(Category category, Time start, Time stop, Image miniature) { string count= String.Format("{0:000}", PlaysInCategory (category).Count + 1); string name = String.Format("{0} {1}",category.Name, count); var play = new Play { Name = name, Start = start, Stop = stop, Category = category, Notes = "", Miniature = miniature, Fps = Description.File.Fps, }; timeline.Add(play); return play; }
protected virtual void OnHotKeyChanged(HotKey prevHotKey, Category category) { if(hkList.Contains(category.HotKey)) { MessagePopup.PopupMessage(this,MessageType.Warning, Catalog.GetString("This hotkey is already in use.")); category.HotKey=prevHotKey; timenodeproperties2.Category = category; //Update Gui } else if(category.HotKey.Defined) { hkList.Remove(prevHotKey); hkList.Add(category.HotKey); } }
private string CategoryPath(Category cat) { return project.Categories.IndexOf(cat).ToString(); }
void GetPlayersStats(Project project, List<Play> subcatPlays, string optionName, SubCategoryStat subcatStat, Category cat) { foreach (ISubCategory subcat in cat.SubCategories) { PlayerSubCategory playerSubcat; Dictionary<Player, int> localPlayerCount = new Dictionary<Player, int>(); Dictionary<Player, int> visitorPlayerCount = new Dictionary<Player, int>(); if (!(subcat is PlayerSubCategory)) continue; playerSubcat = subcat as PlayerSubCategory; if (playerSubcat.Contains(Team.LOCAL) || playerSubcat.Contains(Team.BOTH)){ foreach (Player player in project.LocalTeamTemplate) { localPlayerCount.Add(player, GetPlayerCount(subcatPlays, player, subcat as PlayerSubCategory)); } subcatStat.AddPlayersStats(optionName, subcat.Name, Team.LOCAL, localPlayerCount); } if (playerSubcat.Contains(Team.VISITOR) || playerSubcat.Contains(Team.BOTH)){ foreach (Player player in project.VisitorTeamTemplate) { visitorPlayerCount.Add(player, GetPlayerCount(subcatPlays, player, subcat as PlayerSubCategory)); } subcatStat.AddPlayersStats(optionName, subcat.Name, Team.VISITOR, visitorPlayerCount); } } }